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
Jonas Maebe
591c1b0177
llvm: added support for newer Xcode toolchains
...
Based on https://en.wikipedia.org/wiki/Xcode#Xcode_11.x_-_13.x_(since_SwiftUI_framework)_2
2022-06-04 09:43:39 +02:00
Jonas Maebe
dcf6063dc3
llvm: version 13.0 support
2022-06-03 21:46:23 +02:00
Jonas Maebe
1b06599e82
llvm: version 12.0 support
2022-06-03 21:46:23 +02:00
Jonas Maebe
a19deace45
llvmdbg: fix overflows for aggregates > 2^61 bytes
...
LLVM does not support aggregates larger than that at all, because internally
it stores all sizes in bits in an uint64. Their rationale for not having
special support for that is that there is no hardware with full 64 bit VM
address space anyway. So truncate our size emissions in debug info also to
that.
2022-05-29 13:33:27 +02:00
Jonas Maebe
70908b1449
llvm: support for adding/subtracting constants to pointers in typed constants
...
Fixes webtbs/tw34027 for llvm
2022-05-29 13:33:27 +02:00
Sven/Sarah Barth
088c746d45
* reset written source lines once a section is encountered
2022-05-26 21:43:35 +02:00
Jonas Maebe
ccc843f983
llvmdbg: emit uppercase symbol names unless C++-style debug info is selected
...
Otherwise gdb won't find the symbols unless you use the exact case
2022-05-21 22:32:35 +02:00
Jonas Maebe
9a7a97175e
llvmdbg: emit debug information for global variables
2022-05-21 22:32:35 +02:00
Jonas Maebe
1b393c80aa
llvmdbg: fix missing initialisation when there are no procedures
2022-05-21 22:32:35 +02:00
Jonas Maebe
d0bf7acc18
llvmdbg: build hashtable to lookup llvmdecl belonging to a global variable
...
We need to attach the debug info to it
2022-05-21 22:32:35 +02:00
Jonas Maebe
e865ab4c3a
llvmdbg: handle nil in more places
...
"void" is represented as "null" in LLVM debug information, which we represent
by nil
2022-05-21 22:32:35 +02:00
Jonas Maebe
a33e6230a0
llvm metadata: add DIGlobalVariableExpression enum
...
Only documented as of LLVM 9.0, but existed already in 7.0.
Also fixed DIGlobalVariable not being marked as unique
2022-05-21 22:32:35 +02:00
Jonas Maebe
f896766837
agllvm: fix writing metadata operands for variable declarations
2022-05-21 22:32:35 +02:00
Jonas Maebe
16cb409fbf
LLVM: separate as_clang_llvm_darwin
...
The Darwin local label prefix ('L') is different from that on most other
platforms ('.L). While LLVM generally handles that for us, for inline
assembly it's still FPC's job to adhere to the target conventions.
2022-05-14 22:38:49 +02:00
Jonas Maebe
481741c65b
llvmdbg: remove some commented dbgdwarf code
...
Also adjusted some hashtable sizes
2022-05-14 22:38:49 +02:00
Pierre Muller
9b87fb4a34
Use '.L' as labelprefix for LLVM compiler variant
2022-05-14 21:26:13 +02:00
Pierre Muller
a0d4cccd87
Fix syntax error for isLocal field for function/procedure type LLVM debug information
2022-05-14 21:05:54 +02:00
Jonas Maebe
cddffbed58
llvmdbg: disable open array data location
...
Since we don't generate full debug info for parameters yet, this internalerrors
2022-05-14 08:34:38 +02:00