Commit Graph

90 Commits

Author SHA1 Message Date
Jonas Maebe
839849085b LLVM: don't use type names in ctor/dtor arrays
Workaround for https://github.com/llvm/llvm-project/issues/56809
2023-03-18 23:13:03 +01:00
Jonas Maebe
0b6942de8a llvm:a fix opaque ptr IR for Objective-C protocol
Also for interfacecom functions and properties. Fixes test/tobjc9 and
test/tobjc9b with LLVM 15.0+
2023-01-20 21:07:18 +01:00
Jonas Maebe
1e83d415c3 LLVM: us paraloc def instead of para def for byval
We also use the paraloc instead of the para to write the def
2022-12-04 21:51:55 +01:00
Jonas Maebe
3a34fc7be3 llvm: use formaldef rather than undefineddef for llvm_metadata
Better matches the intent, and fixes compilation issues on AArch64
2022-06-12 21:20:37 +02:00
Jonas Maebe
25999ad8ff llvm: support for opaque pointers
Will be the default starting with LLVM 15, and required with LLVM 16.
Tested with LLVM 14 and '-mllvm -opaque-pointers'. See
https://releases.llvm.org/14.0.0/docs/OpaquePointers.html for more
information.
2022-06-12 11:45:31 +02:00
Jonas Maebe
fe0048bcec llvm: changed llvm_metadatatype from untyped pointer to undefineddef
That matches its meaning better, as it should not result in type conversions.
E.g. some kinds of metadata parameters expect a "type register" parameter such
as "metadata i32* %reg.3"
2022-06-04 22:26:40 +02:00
Jonas Maebe
a45e5e7ab6 llvm: version 14.0 support 2022-06-04 13:34:09 +02:00
Jonas Maebe
1b06599e82 llvm: version 12.0 support 2022-06-03 21:46:23 +02:00
Jonas Maebe
c3e2285c45 * when getting an llvm temporary recorddef, recurse into arrays rather than
treating them as opaque defs. This is required to ensure that the temporary
    recorddef for all x86-64 function results are the same on the caller and
    callee side, as we allocate new arrays when generating them

git-svn-id: trunk@47584 -
2020-11-25 18:44:44 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
Jonas Maebe
d5de84c6c5 * use typenames in more cases in the generated LLVM IR (results in smaller
IR in textual form)

git-svn-id: trunk@44518 -
2020-04-02 21:21:44 +00:00
Jonas Maebe
3188dc18d4 * fixed tdel1/2 tests again for AArch64/LLVM
git-svn-id: trunk@44195 -
2020-02-16 16:58:25 +00:00
Jonas Maebe
a6a17efa42 * use LLVM constrained fpext/fptrunc intrinsics when fastmath is not enabled
for accurate exception behaviour

git-svn-id: trunk@43820 -
2019-12-30 15:05:13 +00: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
6d51c69dbe * fixed writing of calling convention for function declarations/definitions
in LLVM

git-svn-id: trunk@43785 -
2019-12-24 22:12:40 +00:00
Jonas Maebe
96dfe3d03a * LLVM support for writing vector types
git-svn-id: trunk@43783 -
2019-12-24 22:12:34 +00:00
Jonas Maebe
e775ecdc43 * cleaned up safecall support: use a hidden localvarsym instead of result
register hacking
   o this also allowed fixing/adding safecall support for LLVM

git-svn-id: trunk@43578 -
2019-11-24 20:23:22 +00:00
Jonas Maebe
49026e1261 * add "readonly" attribute for constant pointer parameters on LLVM
git-svn-id: trunk@43089 -
2019-09-29 10:29:57 +00:00
Jonas Maebe
d8903ce6b3 - removed maxcrecordalign parameter/field from recordsymtables, as this value
cannot be modified in the settings (so we can directly use the one from
    current_settings)

git-svn-id: trunk@42447 -
2019-07-14 19:24:32 +00:00
Jonas Maebe
0cd0e1614b * synchronised with trunk till r42105
git-svn-id: branches/debug_eh@42106 -
2019-05-19 19:24:25 +00:00
Jonas Maebe
a418dc6c91 * made the fields array parameter of llvmgettemprecorddef "const", as it
doesn't get modified and hence doesn't need to be copied

git-svn-id: trunk@42103 -
2019-05-19 19:20:42 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
a079e5fa80 * synchronised with trunk till r41449
git-svn-id: branches/debug_eh@41450 -
2019-02-24 20:01:53 +00:00
Jonas Maebe
08791712d7 * also specify the byval alignment at the callee side
git-svn-id: trunk@41448 -
2019-02-24 19:59:00 +00:00
Jonas Maebe
a87a7270d5 * remove double "nocapture" attributes
* also add "noalias nocapture" to sret parameters

git-svn-id: trunk@41445 -
2019-02-24 19:58:51 +00:00
Jonas Maebe
e829596750 * type left-over parts of parameters as arrays of "stack slot alignment" if
they're an exact multiple of the ialignment size on LLVM. This prevents
    both overalignment (e.g. remainder of 8 individual bytes on ARM
    would be aligned to 8 bytes instead of 4 if typed as int64) and
    underalignment (e.g. 32 bytes remainder of a record that needs to be
    aligned to 8 bytes would be aligned to 1 or 4 bytes if types as
    array of resp. bytes or longints)

git-svn-id: trunk@41444 -
2019-02-24 19:58:47 +00:00
Jonas Maebe
a0831b058a * fixed LLVM para loading for byval paralocs that are preceded by other
paralocs

git-svn-id: branches/debug_eh@41217 -
2019-02-03 21:10:18 +00:00
Jonas Maebe
8eb07ed7b1 * add support for custom calling conventions to LLVM function declarations
git-svn-id: branches/debug_eh@41211 -
2019-02-03 21:09:58 +00:00
Jonas Maebe
a72a12eef6 * don't emit 0-sized parameters for LLVM: clang doesn't either, and some
LLVM backends (like the AArch64 one) trigger internal errors when
    encountering them

git-svn-id: trunk@40736 -
2019-01-01 16:55:41 +00:00
Jonas Maebe
93e39fb0cd * only coerce the type of the leftover bytes of a record if the location
size doesn't match the number of remaining bytes
   o prevents a second "single" field of a record getting interpreted as a
     "cardinal"

git-svn-id: trunk@40569 -
2018-12-16 20:44:21 +00:00
Jonas Maebe
97bc58d248 * fixed bug that caused the "sret" argument attribute to never be used (and
a guaranteed internalerror on AArch64/llvm)

git-svn-id: trunk@40565 -
2018-12-16 20:44:09 +00:00
Jonas Maebe
32a51d7b62 * add nocapture and dereferenceable/dereferenceable_or_null decorators to
parameters for llvm where appropriate

git-svn-id: trunk@40503 -
2018-12-08 15:31:54 +00:00
Jonas Maebe
50ab607676 + customint torddef type to create arbitraty bit-width integers
o use this to handle non-power-of-two-sized parameters for llvm
   o no general support in the parser/code generator, so don't expose

git-svn-id: trunk@40398 -
2018-11-29 20:57:08 +00:00
Jonas Maebe
0b246f3dbd * converted Boolean8 to an internal type, and mapped Boolean to the
new internal pasbool1(type) (part of mantis #34411)
   o apply the _Bool x86-64 parameter passing rules only to pasbool1

git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +00:00
Jonas Maebe
807fcb3371 * support pasbool8 as type for a record field when a record is passed/
returned in multiple registers (llvm)

git-svn-id: trunk@38862 -
2018-04-28 16:17:37 +00:00
Jonas Maebe
7503c2bd3e * changed llvmgettemprecorddef() to take an open array instead of a tfplist
as list of defs to be stored in the record, so we don't need to create and
    free a class instance every time we call this routine

git-svn-id: trunk@35155 -
2016-12-18 13:57:22 +00:00
Jonas Maebe
8b1c90124e * support encoding helper types for LLVM (encode the same type as the
extended class) (fixes webtbs/tw21457 for LLVM)

git-svn-id: trunk@35060 -
2016-12-04 11:15:19 +00:00
Jonas Maebe
8c167f4e40 * handle already quoted symbol names for LLVM (like for Objective-C)
git-svn-id: trunk@35045 -
2016-12-02 18:04:14 +00:00
Jonas Maebe
ee014fa4ff * fixed handling of typed files for LLVM when ISO-like I/O is active: encode
the buffer in the type, and support typecasting the typed file to a
    different size (needed to be able to pass it to the compiler helpers that
    expected a "TypedFile", whose buffer is 0 bytes and which hence will
    always have a smaller size than the original type) (fixes test/tisoext1)

git-svn-id: trunk@35017 -
2016-11-29 21:54:21 +00:00
svenbarth
ee466b9a28 * extend tdef.fullownerhierarchyname() with a parameter that skips the inclusion of a procdef's parameter declaration using the new pno_noparams option
git-svn-id: trunk@35009 -
2016-11-28 18:06:35 +00:00
Jonas Maebe
702715a518 * generalised llvmgettemprecorddef() so it works for almost all types
git-svn-id: trunk@34513 -
2016-09-11 17:11:57 +00:00
Jonas Maebe
0311528502 * always write bitpacked typed constant arrays as a multiple of bytes rather
than of their loadsize, because otherwise if they are e.g. part of a record
    they would occupy more space than allowed
   o adapted llvm code to deal with the fact that bitpacked arrays are now
     always arrays of bytes rather than arrays of integers with the same size
     as their loadsize -- this also fixes several type inconsistencies
     detected by llvm

git-svn-id: trunk@34125 -
2016-07-14 15:23:07 +00:00
Jonas Maebe
0cce590982 * encode the result type of functions returning a zero-sized value
using their actual type (array/record) rather than using the
    simplified type (void), so we can also return an actual value and
    assign it to something (void means that nothing is returned and
    cannot be assigned to anything) (completes fixing
    tests/test/tnoext4.pp for llvm)

git-svn-id: trunk@34120 -
2016-07-14 15:19:45 +00:00
Jonas Maebe
cdfe299f23 * encode extended in a dynamic array the same as in regular arrays and
records: as an array of 10 bytes. We handle indexing dynamic arrays
    the same as indexing other arrays, and hence that code expects extended
    to be encoded the same way.

git-svn-id: trunk@34116 -
2016-07-14 15:17:27 +00:00
Jonas Maebe
ea54b6b2c5 * factored comp/currency-in-register handling out of a_loadfpu_reg_reg()
into llvmconvop() so it's also used by code using that routine

git-svn-id: trunk@33938 -
2016-06-09 21:59:58 +00:00
Jonas Maebe
7f2d970a1e * fixed type encoding of C-style blocks for LLVM
git-svn-id: trunk@33926 -
2016-06-05 21:34:47 +00:00
Jonas Maebe
9d2bba1917 * create a separate type and def for the LLVM "i1" type, because reusing
pasbool8type for this results in too much trouble (we mustn't use i1
    for parameters, because then LLVM will try to apply the ABI convention
    for passing "1 bit" values, or in records because then this may
    result in unwanted bitpacking). Downside: the new LLVMBool1 type is
    also exposed in the system unit, because we need it to define LLVM
    intrinsics...

git-svn-id: trunk@33726 -
2016-05-20 20:51:44 +00:00
Jonas Maebe
90071e04c4 * encode objc classrefdefs as objc_idtype as that is how they are typed
elsewhere in the compiler as well

git-svn-id: trunk@32914 -
2016-01-10 17:22:11 +00:00
Jonas Maebe
3f7169e250 * treat Objective-C metaclasses (classrefdefs) as voidpointertype at the
LLVM type level

git-svn-id: trunk@32884 -
2016-01-07 22:06:13 +00:00