Commit Graph

166 Commits

Author SHA1 Message Date
Jonas Maebe
60e77de115 LLVM: remove flags used to support older LLVM versions 2024-01-08 19:33:28 +01:00
Jonas Maebe
49cb7b2564 LLVM: use llvm.dbg.declare instead of llvm.dbg.addr for variable declarations
Even though it's supposedly deprecated, clang also still uses it and without
the declaration ranges of local variables are sometimes cut off
2023-12-06 22:57:16 +01:00
Jonas Maebe
24fcd05e8c LLVM: only round currency values when storing them back to memory
Resolves #40550
2023-12-04 22:52:39 +01:00
Jonas Maebe
821c22a38f LLVM: workaround to fix make all 2023-01-23 22:44:48 +01:00
Jonas Maebe
00a5d30300 LLVM: remove use of getelementptr in make_simple_ref_ptr
We cannot safely infer whether it needs to be indirect or not there,
it should be done at a higher level if appropriate.
2023-01-20 21:07:18 +01:00
Jonas Maebe
ab581c5c30 LLVM: override thlcgobj.g_undefined_ok
Uses the freeze instruction available in LLVM 10.0+. If we don't freeze undef/
poison values before using them in a calculation (even if that calculation is
something like "and 0", which masks the result completely), the result will
still be undef/poison and will keep propagating.
2023-01-20 21:07:18 +01:00
Jonas Maebe
657b9a6203 LLVM: support for -Sv (manual vector usage)
Override register type for vectors to "integer registers" because we don't
use mmregister on LLVM (they're all virtual, so it doesn't matter)
2022-09-16 11:21:05 +02:00
Jonas Maebe
1ab6fc9a4b llvm: fix reading past end of data for some parameter references
Fixes false positives when using address sanitizer
2022-07-06 22:25:05 +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
a76038e1d1 hlcgobj: new getlocal and recordnewsymloc methods
Call hlcg.getlocal instead of tg.getlocal when used for actual parameters/local
variables. Has an extra tsym parameter, which will enable the LLVM backend to
insert debug information.

Call hlcg.recordnewsymloc when the location of a (local/para) symbol changes,
so debug info tracking can be updated (only done for LLVM currently)
2022-06-04 22:26:40 +02:00
Jonas Maebe
a76085e463 tllvmcallpara: record whether it's passed to metadata
Sometimes we need the def to store a the original def of the passed parameter,
e.g. for the first argument to llvm.dbg.addr
2022-06-04 22:26:40 +02:00
Jonas Maebe
dc1e0a6bb3 tllvmcallpara: turned into object and added convenience methods 2022-06-04 22:26:40 +02:00
Jonas Maebe
aa43441ac9 llvm: replaced boolean fields in tllvmcallpara with a set 2022-06-04 22:26:40 +02:00
Jonas Maebe
f1bcd02aaf Typed const builder: store tsym
Useful for LLVM debug info generation
2022-05-13 22:49:02 +02:00
Jonas Maebe
b7b495a679 LLVM: assign procdef.procstarttai, like in the regular code generator 2022-05-13 22:49:02 +02:00
Jonas Maebe
80282d6eff * llvm: only set custom parameter alignments for byval parameters, the rest
is handled automatically by llvm (and since llvm 11.0 you get an error if
    you specify an alignment for them anyway)

git-svn-id: trunk@48100 -
2021-01-06 22:35:40 +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
4caa471a24 * implemented a_load_undefined_cgpara for LLVM, fixes LLVM code generator
after the changes to optimize unused parentfp parameters

git-svn-id: trunk@45456 -
2020-05-21 10:56:39 +00:00
Jonas Maebe
4ba19f5418 * add support for creating non-address-only procvars to
cprocvar.getreusableprocaddr()

git-svn-id: trunk@44516 -
2020-04-02 21:21:36 +00:00
Jonas Maebe
9462d6b1ea * handle non-smallset sets in registers in LLVM like arrays and records
git-svn-id: trunk@43884 -
2020-01-07 20:22:13 +00:00
Jonas Maebe
f659e91a95 * fixed LLVM compilation after r43860
git-svn-id: trunk@43862 -
2020-01-05 13:15:10 +00:00
Jonas Maebe
044d946782 * fixed missing sign extension when adding a signed integer variable with
size < sizeof(pointer) to a pointer for LLVM (fixes tfmtbcd)

git-svn-id: trunk@43833 -
2020-01-01 19:19:12 +00:00
Jonas Maebe
ec0d98156c * use maytrap instead of strict FP exception behaviour in LLVM, so constant
propagation is still allowed

git-svn-id: trunk@43832 -
2020-01-01 19:19:08 +00:00
Jonas Maebe
9b53ed53e3 * the llvm.experimental.constrained.fpext intrinsic doesn't have a rounding
mode parameter

git-svn-id: trunk@43828 -
2019-12-31 18:05:50 +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
1e3f72403e * renamed getintparaloc to getcgtempparaloc
o it can be used for more than integer parameters

git-svn-id: trunk@43781 -
2019-12-24 22:12:25 +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
faf75095cd * synchronised with trunk till r42189
git-svn-id: branches/debug_eh@42190 -
2019-06-07 18:24:38 +00:00
Jonas Maebe
1dee4c41dd - removed "cmp 0/1, pasbool1" optimization for llvm because this discards
the upper 7 bits of the boolean, while other platforms take it into
    account (even though they're technically always required to be 0, and
    the value is undefined if they're not)

git-svn-id: trunk@42189 -
2019-06-07 18:17:55 +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
024b38e1ff * fixed setting calling convention for calls (the callpd passed to the
taillvm constructors is not necessarily a proc(var)def)

git-svn-id: branches/debug_eh@41979 -
2019-05-02 19:45:30 +00:00
Jonas Maebe
fcde89cb26 * support forcing to write the parameter alignment for parameters for LLVM,
even when it's the same as the stack alignment (it can also refer to the
    alignment of the data pointed to by pointer parameters)

git-svn-id: branches/debug_eh@41729 -
2019-03-17 15:28:27 +00:00
Jonas Maebe
3b254affb7 * support for the individual alignment flags for the memcpy intrinsic of
LLVM 7.0

git-svn-id: branches/debug_eh@41728 -
2019-03-17 15:28:23 +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
af098474f4 * keep track of the alignment requirements of parameters with LLVM, and emit
them when they are different from the default

git-svn-id: branches/debug_eh@41216 -
2019-02-03 21:10:14 +00:00
Jonas Maebe
a0d796e98d * synchronised with trunk till r41159
git-svn-id: branches/debug_eh@41160 -
2019-02-01 17:01:54 +00:00
Jonas Maebe
e52cf555ab * fix loading of constants in registers in the LLVM CG if the constant
does not fit in ptrsinttype

git-svn-id: trunk@41138 -
2019-01-29 21:39:26 +00:00
Jonas Maebe
14cc517f40 * synchronised with trunk till r40724
git-svn-id: branches/debug_eh@40737 -
2019-01-01 17:15:29 +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
473fef315d * synchronised with trunk till r40732
git-svn-id: branches/debug_eh@40733 -
2019-01-01 16:24:18 +00:00
Jonas Maebe
4d03f3a65e * fixed LLVM memory leaks
git-svn-id: trunk@40732 -
2019-01-01 16:22:31 +00:00
Jonas Maebe
1a0ffbc82b * fixed llvm compiler compilation with -O3/-Oodfa
git-svn-id: branches/debug_eh@40590 -
2018-12-18 21:13:56 +00:00
Jonas Maebe
b41cd1eb6a * synchronised with trunk till r40575
git-svn-id: branches/debug_eh@40576 -
2018-12-16 20:45:55 +00:00
Jonas Maebe
e69b4d2d9a * replaced some stray cpointerdef.create() calls with cpointerdef.getreusable()
git-svn-id: trunk@40572 -
2018-12-16 20:44:31 +00:00
Jonas Maebe
440026bb25 * synchronised with trunk till r40503
git-svn-id: branches/debug_eh@40504 -
2018-12-08 15:33:36 +00:00
Jonas Maebe
8a4947dba2 * don't do anything in thlcgllvm.allocallcpuregisters() like in
deallocallcpuregisters()

git-svn-id: trunk@40499 -
2018-12-08 15:31:41 +00:00
Jonas Maebe
fceb34dbd5 * converted tllvmpara contents from tlocation to toper, so we can also
store tai in them
  + support for direct symbol parameters to llvm routines (without first
    loading them into register)
   o needed to pass such symbols to llvm intrinsics

git-svn-id: branches/debug_eh@40414 -
2018-11-29 21:31:27 +00:00
Jonas Maebe
4cd6f59bc3 * changed create_hlcodegen into a procvar, so that we don't have to insert
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
   o prevents dependency cycles that can cause llvm codegen units to init
     before the cpu variants, which is bad since the llvm versions have to
     override the cpu variants in their init code (+ added checks in the
     init code that they are in fact initialised later)

git-svn-id: branches/debug_eh@40410 -
2018-11-29 21:31:15 +00:00