Commit Graph

17 Commits

Author SHA1 Message Date
Pierre Muller
69d40dd17a Use round to convert float constant into s64comp type for LLVM compiler as is done in general case 2022-05-12 22:32:26 +02:00
Jonas Maebe
9bd33f7a45 + support for LLVM metadata constant string parameters
o they are implemented as a new metadata register class, whereby the
     subregister indicates the metadata type (currently always a string)
     and the superregister is an index in the metadata array (which
     contains the strings). LLVM metadata can only be passed as parameters
     to intrinsics in bitcode, so moves of metadata into other registers
     triggers internal errors and when moving them into parameters, we
     replace the parameter's register with the metadata register (and look
     up the corresponding string when writing out the bitcode)

git-svn-id: trunk@43816 -
2019-12-30 15:04:57 +00:00
Jonas Maebe
a352a12bb4 * use value_real rather than value_curency when writing currency
realconstnodes (fixes tcurrency1, tw33439 and tw36179 with LLVM)
   o we need to load the fpu representation of the currency values,
     not the scaled currency value

git-svn-id: trunk@43681 -
2019-12-14 14:11:12 +00:00
Jonas Maebe
ff2d718699 * fixed occasional rounding error with currency constants on the LLVM targets
(fixes test/tcustomattr13.pp)

git-svn-id: trunk@43017 -
2019-09-15 20:43:09 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
Jonas Maebe
18a59dddb9 * use ctai_typedconstbuilder.get_dynstring_rec() to get the recorddef representing
string constants instead of giving an internal error if we can't find it in
    the current context (in most cases it will exist, but not when inlining a
    routine from another unit that accesses a locally declared string constant)

git-svn-id: trunk@34373 -
2016-08-24 16:41:04 +00:00
Jonas Maebe
9a8a323578 * (again) fixed loading the address of the string data of an ansi/
unicodestring constants: specify the type of the pointer to the
    string record (which is indirect) rather than that of the string
    array (which will implicitly be the result of the getelementptr)

git-svn-id: trunk@31256 -
2015-07-30 16:58:19 +00:00
Jonas Maebe
f40ea04540 * changed getarraydef() into a tarraydef.getreusable() class method
git-svn-id: trunk@31147 -
2015-06-23 21:23:18 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
4c11d34169 * fixed loading the address of the string data of an ansi/unicodestring
constant in the llvm code generator (the constant is a record rather than
    a pointer to a record -> not indirect)

git-svn-id: trunk@31062 -
2015-06-13 22:48:43 +00:00
Jonas Maebe
b176ed9f80 * ensure that the llvmst is initialised before using a field's llvmfieldnr
(and at the same time take advantage of this to perform a sanity check)

git-svn-id: trunk@31061 -
2015-06-13 22:48:40 +00:00
Jonas Maebe
9e074d036b * migrated the handling of ansi/unicodestring constants to the high level
typed constant builder + llvm implementation

git-svn-id: branches/hlcgllvm@28327 -
2014-08-06 18:04:40 +00:00
Jonas Maebe
4f906fb9c9 * fixed datadef for untyped string constants (terminating #0 is one
character, not two)

git-svn-id: branches/hlcgllvm@28320 -
2014-08-06 18:04:19 +00:00
Jonas Maebe
5c8e723cf8 * handle the fact that we emit constant strings that can be longer or shorter
than their type at the Pascal level

git-svn-id: branches/hlcgllvm@28211 -
2014-07-12 22:42:31 +00:00
Jonas Maebe
80c6225bf4 * fixed handling of comp and currency when they have to be handled by the
fpu: treat them as extended when they are loaded into registers, and as
    int64 when loading from/storing to memory

git-svn-id: branches/hlcgllvm@26048 -
2013-11-11 11:16:01 +00:00
Jonas Maebe
d04e05ff82 + handling of floating point constants in llvm code (just load them in a
register, llvm will take care of putting them in memory if necessary)

git-svn-id: branches/hlcgllvm@26046 -
2013-11-11 11:15:54 +00:00