Nikolay Nikolov
8bea5dd41e
* WebAssembly code generation fix in thlcgwasm.a_op_reg_reg_reg_checkoverflow, based on patch by Pierre (but simplified, to use a single block)
2022-05-24 11:00:10 +03:00
Nikolay Nikolov
283c213a0c
* patch by Pierre, which fixes WebAssembly code generation for signed div/mod with overflow checking
2022-05-24 10:47:38 +03:00
florian
32fa0ecaf9
* cleanup
2022-05-23 22:28:59 +02:00
florian
e8e53d13cd
* fix #39730 as suggested by Jonas
2022-05-23 22:28:59 +02:00
florian
4c8e802dd3
* continue const. propagation after a for loop when possible
2022-05-22 22:52:18 +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
florian
91481a5fae
* more robust code for constant propagation in for loops
2022-05-21 22:32:23 +02:00
Nikolay Nikolov
f1cb5d8f71
+ support intrinsic for the memory.atomic.notify WebAssembly instruction
2022-05-21 18:03:14 +03:00
Nikolay Nikolov
86643710c4
+ support intrinsics for the WebAssembly memory.atomic.wait32 and memory.atomic.wait64 instructions
2022-05-21 17:53:38 +03:00
Nikolay Nikolov
3cfdf000a2
+ support the new WebAssembly threads and atomics instructions in the internal assembler
2022-05-21 17:24:21 +03:00
Nikolay Nikolov
e03b920520
+ added intrinsic support for the WebAssembly cmpxchg atomic operations as well
2022-05-21 02:52:31 +03:00
florian
a1ee4e04ed
* if a for loop does not change a variable, we can propate it if it is a constant, resolves #39726
2022-05-20 22:52:27 +02:00
Jonas Maebe
8817e896db
Add missing reference increases for ait_jvar labels
2022-05-20 21:18:44 +02:00
Nikolay Nikolov
d8f06aa4f1
+ added instrinsic support for the all the 2-parameter read-modify-write
...
WebAssembly atomic operations (add, sub, and, or, xor, xchg). Note that they
are not implemented in the internal assembler, yet.
2022-05-20 17:36:37 +03:00
florian
c79df5f0fc
* better constant propation for inline nodes
2022-05-19 22:28:58 +02:00
Pierre Muller
be969205ad
Do not alloc/dealloc NR_DEFAULTFLAGS for wasm32, as it is NR_NO
2022-05-17 22:47:13 +02:00
florian
9f47e21da3
* increase default dwarf version for linux targets where current distributions exist
2022-05-16 22:56:30 +02:00
Pierre Muller
7f886cc4b0
Call increfs manually to avoid removal of stabs debug related labels
2022-05-16 15:12:07 +00:00
florian
81fd3e2748
* more readable fix for the missing ait_instruction check
2022-05-15 19:32:27 +02:00
J. Gareth "Curious Kit" Moreton
27db63969a
* a64: Fix where hp1's was assumed to be an instruction and not actually checked
2022-05-15 16:47:55 +00:00
Brendan Dougherty
1923c8a611
Only use Win64 vectorcall special case if calling convention is vectorcall.
2022-05-15 08:56:50 +00: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
florian
e8da1d081a
+ Aarch64: MovOp2AddUtxw optimization
2022-05-14 22:30:56 +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
J. Gareth "Curious Kit" Moreton
f6c741ee73
* Corrected label reference counts caused by TAsmLabel.GetName incrementing refs
2022-05-14 18:57:05 +00: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
Jonas Maebe
fd125b506e
LLVM debug info: LLVM 7.0 support
...
Also defined some llvm flags in a negative way so they can be removed from
later versions rather than added
2022-05-13 22:49:02 +02:00
Jonas Maebe
edbddec98a
llvmdbg: diflags/dispflags fixes
...
Fix MainSubprogram flag for older LLVM versions, as it was a plain flag rather
than a subprogram flag there.
Added visibility flags for procdefs (public/private/protected)
Write flags as enum rather than integer to avoid issues with changing values
across different LLVM versions
2022-05-13 22:49:02 +02:00
Jonas Maebe
816ab7ffcc
llvm metadata: counter per unit rather than globally
...
Results in less high numbers, and reproducible results when partially
rebuilding
2022-05-13 22:49:02 +02:00
Jonas Maebe
9b280db2b1
dbgllvm: add scopeLine attribute for function debug info
...
Ensures that breaking on the function correctly sets the breakpoint on the
first source line of the function (rather than potentially in the prologue
without line information)
2022-05-13 22:49:02 +02:00
Jonas Maebe
d1aaeff832
dbgllvm: fix crash for files without procedures/functions
2022-05-13 22:49:02 +02:00
Jonas Maebe
067d96242c
dbgllvm: fix crash when generating debug info for procdef of imported struct
2022-05-13 22:49:02 +02:00
Jonas Maebe
cf6a97c8ed
LLVM: fix fileinfo of temp allocations
2022-05-13 22:49:02 +02:00
Jonas Maebe
8d2d91d505
dbgllvm: fix infinite loop when writing multi-dimensional array info
2022-05-13 22:49:02 +02:00
Jonas Maebe
a7e19e9f06
llvm metadata: use cardinal instead of tsuperregister for unnamed metadata numbers
...
We're not putting these into registers, so no need to limit ourselves
2022-05-13 22:49:02 +02:00
Jonas Maebe
a75adf542d
dbgllvm: handle empty spFlags
2022-05-13 22:49:02 +02:00
Jonas Maebe
91563115c4
dbgllvm: handle array of const (stub)
2022-05-13 22:49:02 +02:00
Jonas Maebe
aec7aefdd5
dbgllvm: create dummy line info for instructions that shouldn't have any
...
Use line 0 for that, like clang does
2022-05-13 22:49:02 +02:00
Jonas Maebe
20674089bd
llvmdbg: add declaration for all DISPFlags
2022-05-13 22:49:02 +02:00
Jonas Maebe
13055bb58a
llvmtype: ensure all processed defs get recorded
...
This is necessary so they get reset as well, as they may be reprocessed while
compiling other units (both by llvmtype and dbgllvm)
2022-05-13 22:49:02 +02:00
Jonas Maebe
f832444eaa
LLVM lineinfo: fix nolineinfo generation
...
LLVM requires line info metadata for all call instructions that may potentially
be inlined. So attach one to all call instructions in nolineinfo regions, but
set their line number to 0 (same as what clang does)
2022-05-13 22:49:02 +02:00
Jonas Maebe
40418f5b3d
dbgllvm: remove restriction to only write struct procdef in context of struct
...
Does not make a difference for LLVM since all debug info for procdefs is
assigned to the definition instructions for the procdef anyway, and avoids
issues when only generating line info (in that case the structs will never
be processed, but we still have to generate the basic debug info for their
procdefs to provide a scope for their line info)
2022-05-13 22:49:02 +02:00
Jonas Maebe
6cacd9c824
llvmdbg: initial version based on dbgdwarf
...
Line information is mostly functional, type information not yet (except
for basic procdef info, as that's required for line info)
2022-05-13 22:49:02 +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
5075198a8b
tfileposinfo: separate types for the fields
...
Allows other units to declare variables of the appropriate type when storing
those values separately
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
229eb93e72
tnodeuitls: merge GenerateObjCImageInfo into InsertObjectInfo
...
LLVM needs to insert the Objective-C image info into the general object info
metadata. This way we don't need to store a reference to that metadata so
as to add extra data to it later (tnodeutils is never instantiated, it only
contains class methods)
2022-05-13 22:49:02 +02:00
Jonas Maebe
78535bbcd8
agllvm: support for writing specialised metadata nodes
2022-05-13 22:49:02 +02:00
Jonas Maebe
d294731542
LLVM: enable DWARF debug info generation
2022-05-13 22:49:02 +02:00
Jonas Maebe
527c68b6c3
agllvm: remove useless code
2022-05-13 22:49:02 +02:00
Jonas Maebe
a8cb061a50
LLVM: support for attaching metadata to instructions
2022-05-13 22:49:02 +02:00
Jonas Maebe
4293d4455c
LLVM: factor out writing operands in agllvm
2022-05-13 22:49:02 +02:00
Jonas Maebe
411fa298ae
LLVM: data location debug info support
...
This was added to LLVM for Fortran arrays, but can also be used for Pascal
dynamic arrays
2022-05-13 22:49:02 +02:00
Jonas Maebe
1d010d918b
LLVM metadata: specialised metadata fleshing out
2022-05-13 22:49:02 +02:00
Jonas Maebe
ac89cfc6c7
aasmtai: added tai_string.Create(ansistring)
...
Also prevent range check errors for empty strings
2022-05-13 22:49:02 +02:00
Jonas Maebe
4da1ad71a4
* moved a bunch of constants from dbgdwarf to dbgdwarfconst
2022-05-13 22:49:02 +02:00
florian
a285500d36
* patch by Rike: Use reverse_longword instead of manually reversing longword, resolves #39720
2022-05-13 22:38:03 +02:00
Nikolay Nikolov
812736bd41
+ support the atomic.fence instruction in the WebAssembly internal object writer
2022-05-13 22:56:36 +03:00
Nikolay Nikolov
1d70437017
+ added intrinsic (for RTL internal use) that emits the WebAssembly atomic.fence instruction
2022-05-13 22:46:27 +03:00
Nikolay Nikolov
ddab39dbdc
+ enable the atomics extension on the llvm-mc command line (extension appears
...
to be recognized since LLVM 8.0, so it should be safe to always enable this
from the llvm-mc command line)
2022-05-13 21:15:54 +03:00
Nikolay Nikolov
5198e47e36
+ added the atomic memory access WebAssembly instructions from the threading proposal for WebAssembly
2022-05-13 20:55:12 +03:00
florian
4f9c19d943
* simplifications by Rika (*2 loops => shl/Bsr), resolves #39717
2022-05-12 22:56:36 +02:00
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
florian
deec6fc4ba
* set max. variable and constant alignment for win32 and win64 to 64 byte boundaries
2022-05-11 20:58:38 +02:00
Pierre Muller
8184287ec0
Fix for variables longer than 127 chars
2022-05-10 23:18:01 +02:00
florian
578ce51fc3
* fix broken merge
2022-05-10 22:38:19 +02:00
florian
a73869b879
* arm-linux: set max. alignment for constants and variables to 32 byte boundaries
2022-05-09 22:45:21 +02:00
J. Gareth "Curious Kit" Moreton
971b8b9217
* Compiler error is now thrown if record alignment is not a power of 2 or is greater than 64.
2022-05-09 20:03:44 +00:00
Jonas Maebe
8bef28ccbe
PPU version: bump
...
fcaea21075
changed name mangling
2022-05-09 21:19:06 +02:00
florian
4add05c625
* x86_64-linux and i386-linux align variables and constants up to 64 byte boundaries
2022-05-08 17:50:00 +02:00
Jonas Maebe
3d3c904ac5
TSymStr: more consistent usage
2022-05-08 15:03:44 +02:00
Jonas Maebe
fcaea21075
SymAnsiStr: fix "make all" and webtbs/tw39661*
...
Fixes compilation with LLVM backend
2022-05-08 14:59:36 +02:00
florian
78f23a462e
* set minimum compiler to compile the compiler to 3.2.0
2022-05-07 23:13:16 +02:00
J. Gareth "Curious Kit" Moreton
f4e28ab357
* x86: Fixes to GetInt/MMRegisterBetween assignments
2022-05-07 20:54:40 +00:00
J. Gareth "Curious Kit" Moreton
54aae023ea
* Bug fix that prevents downsizing of
...
"(x div y) and z" when "x div y" is 64-bit and
z is 32-bit or less. Fixes i39646
2022-05-07 20:53:35 +00:00
florian
bce88f2e2b
* AVR: trgcpu.do_spill_read must load ofs
2022-05-05 19:35:38 +02:00
Pierre Muller
5acd7a7b83
Rename tsymtable.insert and delete methods to insertsym ands deletesym
2022-05-03 23:00:28 +02:00
ccrause
a6766d62ee
Fix generation of default linker script for esp-idf v4.4
2022-05-02 21:18:40 +00:00
florian
0ae45bd2cf
+ AVR: track flag usage
...
+ AVR: take care of allocated flags when spilling
* AVR: trgcpu.do_spill_read might also use ADIW
2022-05-01 22:42:57 +02:00
florian
038230bbea
* AVR: use adiw to create spilling constants if possible
...
* AVR: insert allocations for registers used by spilling so the assembler optimizer does not remove spilling code
2022-05-01 22:42:57 +02:00
florian
46b52d92d3
+ AVR: helpers take care of ADIW
2022-05-01 22:42:57 +02:00
florian
eba76dd052
* allow 32 byte alignment of constants and variables on aarch64-darwin
2022-05-01 10:55:48 +02:00
Karoly Balogh
74ab27ae47
cutils: also use minalign, when varalign equals it, not only when varalign is less than it (21 years old bug?)
2022-04-29 23:45:45 +02:00
florian
5d97ff43fa
+ CPUAVR_HAS_ADIW
2022-04-29 23:06:17 +02:00
florian
314d3579fc
* avr3 and avr31 should also have a movw instruction
2022-04-29 23:06:17 +02:00
Sergey Larin
60c967f255
Optimized the comparison of a widestring variable with ''
2022-04-27 21:12:47 +00:00
Sergey Larin
35db2b2da3
Fixed optimization Length(W)=0
-> (Pointer(W)=nil) or (PLongword(Pointer(W)-4)^=0)
for WideString
2022-04-27 21:12:47 +00:00
J. Gareth "Curious Kit" Moreton
62d5ddffb8
* x86: Improvement to CMP/JE/CMP/@Lbl/SETE ->
...
CMP/SETE/CMP/SETE/OR optimisation to reduce
pass counts (and work better with improved
FLAGS register allocation).
2022-04-27 20:46:32 +00:00
J. Gareth "Curious Kit" Moreton
1fd2d3a83d
* x86: Improved TrySwapMovCmp to insert before
...
the FLAGS register is allocated.
2022-04-27 20:46:32 +00:00
J. Gareth "Curious Kit" Moreton
6f24c8b4ef
* x86: Code generation fixes where FLAGS
...
register is not properly allocated.
2022-04-27 20:46:32 +00:00
florian
33eef1f9b1
* AVR: moved MovMov2Movw optimization into pass2 as it might prevent other optimizations
2022-04-25 22:18:37 +02:00
florian
9695dba4d9
* AVR: fix TCpuAsmOptimizer.InstructionLoadsFromReg for MOVW
...
* simplify code for MovMov2Movw optimization
2022-04-24 22:42:09 +02:00