Commit Graph

696 Commits

Author SHA1 Message Date
Pierre Muller
2a4ca98e85 Use systems_darwin set for supported targets for as_clang_llvm_darwin 2023-04-06 14:40:15 +00:00
Jonas Maebe
0ea0b69a30 LLVM: cleaned up some comments 2023-03-18 23:14:25 +01:00
Jonas Maebe
e41bfa0495 LLVM: LLVM 16 support
No changes compared to LLVM 15 that affect us
2023-03-18 23:13:58 +01:00
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
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
29bae2297f tcginnode.pass_generate_code: use tlhcgobj.g_undefined_ok
Also override the code that uses this for LLVM with a variant that does not
need it for LLVM versions that do not support the freeze instruction.
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
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
bba1076e12 LLVM: add Xcode 14.0 support (-ClvXcode-14.0) 2022-12-04 21:51:55 +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
57466587c5 llvmdbg: remove unnecessary typedef intermediates 2022-11-12 21:14:28 +01:00
Jonas Maebe
95f94a279c llvmdbg: fixes for method debug info
Mark "self" parameter as artificial

Add methods to the scope of the class/record rather than to the file scope

Add the vmt field, strip the "($)hidden" prefix from its name, and emit its
real type
2022-11-06 16:41:25 +01:00
Jonas Maebe
b26703feaa Darwin version comparisons: factored out into object
Use numeric instead of string comparisons
2022-09-16 11:21:05 +02: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
3a07aadba2 llvm: llvm/clang 15.0 support 2022-07-28 22:59:13 +02:00
Jonas Maebe
815b17a43b llvm: correctly write aliases when using opaque pointers 2022-07-28 22:59:13 +02:00
Jonas Maebe
403292a131 LLVM backend: address sanitizer support
Activate with -Clfsanitize=address. Only tested on Darwin/x86-64 for now.
2022-07-06 22:26:13 +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
b2ea782eb4 agllvm: fix writing strings in metadata arrays
They were interpreted as part of larger strings
2022-07-06 22:25:05 +02:00
Jonas Maebe
d92bc0e760 llvmdbg: fixed variant fields
They have to be members with a union type, rather than union types
themselves.
2022-06-17 21:44:34 +02:00
Jonas Maebe
b68512a969 llvmpara: don't crash if a parameter has no paralocs 2022-06-17 21:44:34 +02: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
71c58c7b3d agllvm: missing space between type and tai operand 2022-06-12 11:45:31 +02:00
Jonas Maebe
d45076d9d6 nllvmadd: fix not always forcing pointer constants in registers
There could have been a typeconversion around the pointerconstn/niln.
This was hidden because llvmtype fixed it up later, but with opaque
pointers it showed up again.
2022-06-12 11:45:31 +02:00
Jonas Maebe
e6b8aa07d7 dbgllvm: removed some commented-out declarations 2022-06-12 11:45:31 +02:00
Jonas Maebe
fc94770cdb dbgllvm: emit all symbolic constants as enum values/strings
Easier to read in the .ll files, and avoids potential mismatches with their
value in LLVM (in case it changes across LLVM versions)
2022-06-12 11:45:31 +02:00
Pierre Muller
da58651398 Avoid Invalid typecast error when using -CR option by using tabstractrecordsymtable type for record or object symtable 2022-06-08 10:29:58 +00:00
Pierre Muller
a730bf2b00 Fix oversized type size constant 2022-06-08 00:07:05 +02:00
Pierre Muller
9e8d779f31 Fix compilation of arm compiler with LLVM=1 2022-06-08 00:00:20 +02:00
Jonas Maebe
f382f2d6ed dbgllvm: support for tobjectdef debug information
Classes, objects, interfaces, Objective-C classes, ...
2022-06-07 21:42:41 +02:00
Jonas Maebe
61f01ded61 dbgllvm: struct_metadef fixes
It will be used to hold a reference to the underlying structure of a class,
whose type is represented as a pointer to a DW_TAG_class_type for compatibility
with the debug information generated by the FPC backend (otherwise we could
instead just add a deref expression to all variables of such a type)
2022-06-07 21:42:41 +02:00
Jonas Maebe
addd0e7dcf dbgllvm: skip static fields when writing struct fields
These are not part of the struct instances
2022-06-07 21:42:41 +02:00
Jonas Maebe
f9b216f99a dbgllvm: remove tmembercallbackinfo
Leftover from dbgdwarf, not used here
2022-06-07 21:42:49 +02:00
Jonas Maebe
4c8249de34 dbgllvm: added appenddef_struct_named
Factored out of appenddef_record_named for reuse by objectdefs.

Also moved responsibility of adding the struct dinode to the asmlist
to the caller, as the name of this method does not imply it will do
that.
2022-06-07 21:42:41 +02:00
Jonas Maebe
706443c354 dbgllvm: support for record field debug information 2022-06-06 23:12:53 +02:00
Jonas Maebe
b456833b03 aasmllvmmetadata: remove leftover unused type 2022-06-06 23:12:53 +02:00
Jonas Maebe
60c95032fa llvm: removed Xcode 10.0/10.1 as supported versions
These already did not work because they predate clang 7
2022-06-06 23:12:53 +02:00
Jonas Maebe
25e832940c llvmdbg: support for generating debug information for local/para varsyms
Note that not all symbols are covered yet, because absolutevarsyms are not
yet supported and those are e.g. used for function result aliases.
Additionally, not all types are fully supported yet.
2022-06-04 22:26:40 +02:00
Jonas Maebe
e7ec91eca8 dbgllvm: rename hastable for staticvarsym declarations 2022-06-04 22:26:40 +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
41a6c5e967 agllvm: support specialised metadata with field names
Necessary for DIExpression
2022-06-04 22:26:40 +02:00
Jonas Maebe
c92a035614 agllvm: support nested constants in parameters
Needed for metadata support
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
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
aa43441ac9 llvm: replaced boolean fields in tllvmcallpara with a set 2022-06-04 22:26:40 +02:00
Jonas Maebe
573b2554f4 llvminfo: fix copy/paste error in llvm 14 comment
Spotted by @Alexey-T1
2022-06-04 22:26:40 +02:00
Jonas Maebe
a45e5e7ab6 llvm: version 14.0 support 2022-06-04 13:34:09 +02:00