Commit Graph

28004 Commits

Author SHA1 Message Date
florian
4a4eadc60e * throw an error if varargs is used without appropriate calling conventions, resolves #40342 2024-05-14 22:44:12 +02:00
Pierre Muller
291532e740 Do not set default target to system_sparc64_solaris on solaris OS for sparc64 compiler as this target is not yet supported 2024-05-14 06:44:39 +00:00
florian
a9c88ace25 * handle unary minus in the preprocessor, resolves #40782 2024-05-13 22:36:40 +02:00
Nikolay Nikolov
cdba427bcf + added WASI multithreading helper for setting the stack pointer for the linear stack 2024-05-13 14:00:36 +02:00
Michaël Van Canneyt
897caac4ac * Seems not all was committed 2024-05-13 14:00:36 +02:00
florian
1fa83a91ab + cs_opt_consts for sparc64 2024-05-11 23:41:33 +02:00
florian
5284948087 * proper alignment information for constant addresses stored in registers 2024-05-09 23:42:40 +02:00
florian
1e3865a187 * patch by rasberryrabbit to resolve #40761 2024-05-09 20:41:58 +02:00
florian
5e00358f13 + cs_opt_consts for sparc 2024-05-08 23:13:05 +02:00
florian
9b1861a104 + enable cs_opt_consts on arm as well 2024-05-07 22:40:13 +02:00
Sven/Sarah Barth
485b31de21 * fix #40764: declare procsyms of a class/object also as sp_generic_dummysym if a symbol in a parent class has it set so that the parser will treat it as a potential generic
+ added test
2024-05-06 23:39:18 +02:00
Sven/Sarah Barth
bfe5733624 * allow sp_generic_dummysym for procsyms even if there are no generic overloads 2024-05-06 23:39:18 +02:00
florian
04631040b8 + do do_consttovar optimization on i386 as well 2024-05-06 23:12:36 +02:00
florian
70d2f81e5e + store pic references in registers if possible 2024-05-06 22:46:21 +02:00
Michaël Van Canneyt
a04d2b59f6 * Emit better error when not able to load auto units 2024-05-06 16:56:29 +02:00
Michaël Van Canneyt
02704f85a9 * Wasm: generator for invoke helper now handles overloaded methods in interfaces 2024-05-06 15:49:28 +02:00
J. Gareth "Curious Kit" Moreton
e60a7d01a4 * Inc/Dec nodes converted to Add/Sub now remove
the "nf_modify" flag from the destination so
    constant propagation works more efficiently.
2024-05-05 20:50:37 +00:00
J. Gareth "Curious Kit" Moreton
e7145f5f7c * Blocks of statements are now pruned (within reason) if a raise, exit, break, continue or goto node is found 2024-05-05 20:46:30 +00:00
Michaël Van Canneyt
a888a141a2 * remove do_compile, clearer flow when loading ppu/pas files 2024-05-04 16:58:04 +02:00
Michaël Van Canneyt
3302dae600 * hlgcodegen needed when creating module info (fixes AV) 2024-05-04 16:44:33 +02:00
Michaël Van Canneyt
312cf246ad * Fix creating thunk class when inherited interfaces are used 2024-05-04 16:44:32 +02:00
Michaël Van Canneyt
1e9e533e6c * Replace object with record where possible 2024-05-04 16:44:32 +02:00
Michaël Van Canneyt
a478a33c32 * Correct location of new error message 2024-05-04 09:18:05 +02:00
J. Gareth "Curious Kit" Moreton
edc1c79cbb * Bug fix where copied block nodes didn't inherit the original's flags 2024-05-03 21:13:43 +00:00
J. Gareth "Curious Kit" Moreton
b828529b24 * Block nodes are now marked as strippable when created from "begin" statements 2024-05-03 21:13:43 +00:00
J. Gareth "Curious Kit" Moreton
6cc391dfa1 * x86: Improved "Test2Bt" peephole optimisation 2024-05-02 23:46:20 +01:00
florian
b6da7a799a * regenerated 2024-05-02 22:46:49 +02:00
Pierre Muller
1e5240b5a4 Do allocate a new regset for top_regset for ARM compiler to avoid heap memory corruption 2024-05-02 13:52:04 +00:00
Pierre Muller
f6a0da71fc Do not set USEINLINE macro if DISABLE_INLINE macro is set 2024-05-02 09:36:27 +00:00
florian
346962beaa * compiler part of #35433 2024-05-01 23:05:06 +02:00
J. Gareth "Curious Kit" Moreton
ac3425a14d * Only perform the block flattening if "forinline" is true or under -O2 and above 2024-04-29 18:17:55 +00:00
J. Gareth "Curious Kit" Moreton
63e8633262 * New block node optimisation that attempts to
flatten nested blocks (makes labels and later
    optimisation more efficient).
2024-04-29 18:17:55 +00:00
J. Gareth "Curious Kit" Moreton
5a9d4d44fa * Calling "internalstatements" now sets the "bnf_strippable" flag on the result 2024-04-29 18:17:55 +00:00
J. Gareth "Curious Kit" Moreton
060a7185ab * Framework for more complex block node simplification 2024-04-29 18:17:55 +00:00
J. Gareth "Curious Kit" Moreton
5605566e42 * Added field to identify blocknodes that wrap entire subroutines 2024-04-29 18:17:55 +00:00
florian
7b0578dc17 * cleanup tnodeutils.InsertThreadvars as suggested in #40538, resolves #40538 2024-04-28 22:38:28 +02:00
J. Gareth "Curious Kit" Moreton
e601156b8c * x86-64: Bug fix where RIP-relative references were made absolute in minmax optimisations by mistake. 2024-04-27 16:32:04 +00:00
florian
1de3aba4e3 * few types fixed 2024-04-26 22:54:27 +02:00
J. Gareth "Curious Kit" Moreton
17b7782929 * i386: Fixed issue where the peephole optimizer entered an infinite loop when building for CPUs older than Pentium II 2024-04-26 19:08:00 +00:00
florian
fc6d6c123d * more debug statments removed 2024-04-25 22:50:38 +02:00
florian
ab66440e76 * accidently committed debug statement removed 2024-04-25 22:47:17 +02:00
florian
51f5726343 * (hopefully) more consistent message when the compiler is stopped during showing the help screen, resolves #39455 2024-04-25 22:12:31 +02:00
Sven/Sarah Barth
7f03fb6966 * revert the changes from b0d61558e3, as 61397d40ae fixes it more correctly 2024-04-24 23:13:57 +02:00
Sven/Sarah Barth
61397d40ae * ensure that Insert() of a single element into a dynamic array is typechecked in a way that the user is notified of errors
+ added test
2024-04-24 23:13:36 +02:00
florian
2d1fba1fa1 * disable (type ...), it did never work and there are not test, resolves #40562 2024-04-24 22:51:11 +02:00
florian
2e86cdb620 * allow swapping of operands for three operand instructions if they are commutative 2024-04-22 22:25:37 +02:00
florian
c3a3cfe80f * avoid range check error in TVMTBuilder.intf_optimize_vtbls by early bailing out if a class has no interfaces 2024-04-21 19:26:01 +02:00
J. Gareth "Curious Kit" Moreton
88ab9576b1 * a64: Added "ABS" and "CTZ" mnemonics (CSSC instructions) 2024-04-21 09:06:16 +00:00
J. Gareth "Curious Kit" Moreton
1ba93085f7 * a64: Added DOTPROD and PAUTH support flags to relevant instruction sets (v8.4+ and v8.3+ respectively) 2024-04-21 09:06:16 +00:00
J. Gareth "Curious Kit" Moreton
bba4edb6d0 * a64: ARMv8.7 through ARMv8.9 have been added as AArch64 CPU types, along with support for the CSSC extension. 2024-04-21 09:06:16 +00:00
florian
9409ec6341 * workaround unsupported -march=...+pauth for some assembler/clang versions 2024-04-21 11:04:42 +02:00
florian
902c93f3c3 * do not limit the number of interfaces per class, resolves #40268 2024-04-20 22:05:18 +02:00
J. Gareth "Curious Kit" Moreton
9ee1821622 * arm / a64: Extended the AND; CMP -> ANDS family of optimisations to catch BIC as well as AND 2024-04-20 12:55:47 +00:00
florian
e412f6be55 + in on an empty set is always false, resolves #40745 2024-04-19 23:43:35 +02:00
florian
2f9ed0576e * optimize x </>= length(...) also if the operands are swapped 2024-04-18 23:07:40 +02:00
florian
e130557d9f * optimize x < length(arr) and x >= length(arr) as proposed in #40292 2024-04-17 23:29:13 +02:00
Pierre Muller
a4240a0c62 Fix compilation of i8086/n8086add.pas unit after introduction of get_int_value function 2024-04-17 07:52:05 +00:00
florian
f29ff58ab9 + get_int_value 2024-04-16 23:11:16 +02:00
florian
48eeaf00a4 + fold also divisons involving pointer constants (those nodes are internally generated only) 2024-04-15 23:02:28 +02:00
florian
2e9556f2eb + fold also constant pointer operations on nil nodes 2024-04-15 22:52:32 +02:00
florian
b3c1f294ba + propagate also widechar/pointer constants 2024-04-14 10:34:37 +02:00
florian
0aa851b7f7 * run constant propagation multiple times if needed and if slow optimizations are turned on 2024-04-14 10:00:20 +02:00
florian
5c46b5116d + also fold nil nodes when used as pointer constants 2024-04-13 22:52:46 +02:00
florian
1222456c13 * allow [] for constant set constraints, resolves #37020 2024-04-13 22:28:54 +02:00
florian
13fc4075f5 + propagate pointer constants 2024-04-12 21:40:04 +02:00
Sven/Sarah Barth
b0d61558e3 * fix #40725: pass along whole array constructor to the Insert() so that it's converted with the correct checks
+ added test
2024-04-12 17:34:58 +02:00
Sven/Sarah Barth
e76c5d96d8 * Fix #40716: only add helpers if the type doesn't belong to the current object/class/record hierarchy
+ added test
2024-04-12 17:34:58 +02:00
Sven/Sarah Barth
7a1ef994b4 * fix #40721: correctly set up the generic defs when parsing fields, especially important when dealing with anonymous fields
+ added tests
2024-04-12 17:34:58 +02:00
Sven/Sarah Barth
0e9efd07ef * extend read_anon_type() so that it can take a genericdef as well 2024-04-12 17:34:58 +02:00
Sven/Sarah Barth
eaf24269bc * check that the corresponding genericdef of the adjusted def is indeed valid 2024-04-12 17:34:58 +02:00
Sven/Sarah Barth
550397b982 * fix #40708: when creating the sub-arraydefs for comma separated arrays, ensure that the new sub array also has the generic related information set up correctly
+ added test
2024-04-12 17:34:58 +02:00
J. Gareth "Curious Kit" Moreton
3cae3e7e48 * x86: Registers are now allocated properly during a FuncMov2Func
optimisation
2024-04-09 20:51:24 +00:00
J. Gareth "Curious Kit" Moreton
18eec3055e * x86: More accurate register tracking in CheckJumpMovTransferOpt 2024-04-09 20:51:24 +00:00
florian
fd68d3bfbb * ensure that left and right have a result type set in tx86addnode.pass_1, resolves #40727 2024-04-08 22:53:34 +02:00
florian
80750f7591 * second_abs: don't supply a separate 64 bit code path for high level cpu targets 2024-04-07 22:49:18 +02:00
Nikolay Nikolov
2e65a5d458 + introduced cgbase.topcg2str and topcmp2str for converting TOpCg and TOpCmp to strings (useful for debug logging, etc) 2024-04-07 22:10:41 +03:00
florian
139f2dfe84 * fix internalerror 200502052 with certain min/max optimizations on x86-64, resolves #40730 2024-04-06 23:31:37 +02:00
Pierre Muller
f56587bddd Use correct check for unsigned size in a_op64_{const/reg}_reg_reg_checkoverflow methods 2024-04-03 23:41:50 +02:00
Pierre Muller
8511b0fc7b Increase default stack size to 8Mb for i386 and sparc solaris systems 2024-04-03 23:17:55 +02:00
florian
8cdb3deebd * another fix for min/max intrinsics on x86_64 for non constant/reference/register locations, resolves #40724 2024-04-03 22:03:30 +02:00
Pierre Muller
8fa80295d0 Avoid running cleanppulogs and ppulogs rules in parallel 2024-04-03 14:56:51 +00:00
florian
e7716dc05f + avr: overflow checking for abs, together with the other recent abs-related commits, resolves #40694 2024-04-02 19:01:42 +02:00
florian
b00e9543a7 * sparc: overflow support for 64 bit operations 2024-04-02 16:41:38 +02:00
florian
3b8fcfc6eb * fix min/max intrinsics on x86_64 for non constant/reference/register locations, resolves #40721 2024-04-01 23:25:24 +02:00
Michael Ring
7c3ab69c50 Fixed missing section for Raspberry Pi Pico 2024-04-01 21:00:12 +00:00
florian
e88248d453 + comment to explain last commit 2024-03-31 22:33:22 +02:00
florian
bf1c674672 * don't remove align directives before case jump tables (they have the type alt_addr) 2024-03-31 22:15:08 +02:00
florian
a90691435b + abs(long/int64): overflow checking for xtensa implemented 2024-03-30 20:29:48 +01:00
florian
240739e71d * compilation on 64 bit targets fixed 2024-03-29 21:44:23 +01:00
florian
a8d496ade7 * i386 uses generic x86 abs(long/int64) code now 2024-03-29 20:54:52 +01:00
florian
13e7f947ea * all CPUs use now internal abs(<int64>) so overflow checking is possible
+ added overflow checking to generic abs(<longint>)
2024-03-29 20:30:57 +01:00
florian
c87213085f * overflow checking for generic abs(<int64>)
* fix overflow checking on arm for 64 bit signed numbers
  * arm uses generic abs(<int64>)
2024-03-29 20:06:23 +01:00
florian
8132ccd42b + generic implementation of abs(<int64>) 2024-03-29 15:30:18 +01:00
florian
56d84c9283 * compilation fixed 2024-03-28 18:31:38 +01:00
florian
0efd3afb8c + arm: internal abs(<int64>)
+ arm: overflow checking for abs(...)
2024-03-28 15:56:52 +01:00
florian
f0cc07fe68 + 8086: overflow checking for abs(<long/int64>) 2024-03-28 15:07:47 +01:00
florian
2641f65bb7 * compilation with -dEXTDEBUG fixed 2024-03-28 15:07:35 +01:00
florian
fea8050457 * fix i386 building after fb3c4ff75b 2024-03-27 00:04:46 +01:00
florian
15398549a4 * fix simplication of max(double,double) with both values being constants 2024-03-26 23:55:47 +01:00
florian
fb3c4ff75b * avoid CMPs with constants outside the range of signed 32 bit values 2024-03-26 23:53:46 +01:00
Michaël Van Canneyt
564597a573 * Fix access violation: module can be reset while loading dependent units. Fixes issue #40705 2024-03-26 16:06:27 +01:00
J. Gareth "Curious Kit" Moreton
ee1916e919 * i8086: Local variables unused in "second_AndOrXorShiftRot_assign" on i8086 are now not defined on this platform 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
11b341cc97 * x86: Added new OptPass1CMOVcc peephole optimisation routine to dust up min/max code 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
c79361c010 * Min/max intrinsics now simplify deterministic results 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
e4a0ce2fb5 * x86: Min/max intrinsic support 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
77c86cafd0 * a64: Fixed bug where unsigned min/max inlines used a signed comparison 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
81b7b80749 * Added support for 64-bit min/max intrinsics 2024-03-26 14:18:31 +00:00
florian
8971103a00 * use bit_set_reg_reg also to clear single bits in thlcgobj.a_load_regconst_subsetref_intern 2024-03-26 14:46:01 +01:00
J. Gareth "Curious Kit" Moreton
4378319f87 * Added missing "override" directive for XML node dump routine on TDerefNode 2024-03-26 13:25:46 +00:00
Pierre Muller
afea558fbe Add -32/-64 for sparc GNU assembler calls 2024-03-25 23:48:14 +01:00
Pierre Muller
c68ddc5360 Add $EMUL also for sparc CPU GNU linker call on solaris OS 2024-03-25 23:48:14 +01:00
J. Gareth "Curious Kit" Moreton
948766a37a * x86: New Op/TEST optimisation that rearranges register usage for the most efficient execution 2024-03-25 22:25:29 +00:00
florian
7c609ee7c4 * proper fix for 9056ab8025 2024-03-25 22:33:30 +01:00
Pierre Muller
9056ab8025 Fix generation of i8086 CPU code, as BTR/BTS instructions require at least 386 CPU 2024-03-25 14:29:08 +00:00
florian
ac150e58c8 * thlcgobj.a_load_regconst_subsetref_intern uses a_bit_set_reg_reg if applicable 2024-03-25 00:01:24 +01:00
florian
12176d3683 * avoid to generate bts/r with memory operand
+ thlcgx86.a_bit_set_reg_reg
2024-03-24 23:03:33 +01:00
J. Gareth "Curious Kit" Moreton
2b7df4237b * nf_pass1_done, nf_error, nf_processing and nf_do_not_execute
have been moved to a new "transientflags" node field that
    isn't stored in PPU files
2024-03-24 18:14:49 +00:00
ccrause
dd858f37aa Ensure register to be eliminated is de-allocated before applying optimization LdsMov2Lds. 2024-03-24 13:54:31 +00:00
J. Gareth "Curious Kit" Moreton
99851f22f5 * a64: New B -> RET peephole optimisation 2024-03-24 13:31:52 +00:00
florian
20f9b82543 * AArch64: overflow checking for abs
* tabs adapted: also abs(longint) must overflow check on 64 bit platforms
2024-03-24 12:47:16 +01:00
florian
1fccfd3ee1 * AArch64: avoid false overflow error in case of -2^63+0 2024-03-24 12:36:02 +01:00
florian
b7322ae4c3 * write correct type name in error message 2024-03-23 22:24:55 +01:00
florian
4100f75056 + optimize s:=s+[e] into include(s,e) 2024-03-23 21:02:15 +01:00
florian
06fc6f1e6b * use destination location instead of a temp when constructing sets, resolves #40384 2024-03-22 21:50:42 +01:00
J. Gareth "Curious Kit" Moreton
e1297e0859 * Adjustment to "(v>=x) and (v<=y)" so it also optimises its inverse: "(v<x) or (v>y)" 2024-03-20 21:01:35 +00:00
Pierre Muller
36b511f057 FFix compilation of compiler with -dTest_Double_checksum 2024-03-20 17:30:12 +00:00
Michaël Van Canneyt
c52794f943 * Fix build of nativent 2024-03-19 10:27:30 +01:00
J. Gareth "Curious Kit" Moreton
f77b9fa4ef * arm/a64: Fixed bug where shifter operand was not preserved in AND/CMP -> TST optimisation 2024-03-18 21:21:54 +00:00
florian
316e127948 * overflow checking for ti386inlinenode.second_abs_long 2024-03-17 10:24:20 +01:00
florian
c3b8b51cb5 * more overflow checking for abs(...) 2024-03-16 21:54:12 +01:00
J. Gareth "Curious Kit" Moreton
a907eb49c9 * a64: Several secondary peephole optimizations that clean up CSEL instructions 2024-03-15 18:08:37 +00:00
J. Gareth "Curious Kit" Moreton
ef1cb852a8 * a64: New CSEL block optimisations ported over from x86 CMOV block optimisations 2024-03-15 18:08:37 +00:00
florian
2a46596edd * overflow check abs(...) for x86 2024-03-14 23:14:47 +01:00
Pierre Muller
f88622a799 Be sure not to consume semicolon after _USES twice 2024-03-11 11:07:02 +00:00
J. Gareth "Curious Kit" Moreton
755d221230 * x86: Additional optimisation in OptPass2MOV to help with sub-optimal MOV/CMP/MOV triplets (and a minor refactor). 2024-03-10 21:09:59 +00:00
J. Gareth "Curious Kit" Moreton
f4e955d04f * x86: Improvement to CMOVcc/Jcc optimisation that attempts to remove temporary registers storing constants 2024-03-10 21:09:59 +00:00
J. Gareth "Curious Kit" Moreton
a7fe49f38f * x86: CMOVcc/Jcc pairs are now changed to MOV/Jcc if the register is not used if the jump doesn't branch 2024-03-10 21:09:59 +00:00
florian
e35403c3b8 * optimize additions of empty sets away if possible, part of #40384 2024-03-10 10:47:24 +01:00
florian
594d4cc4f9 * transform -1-x into not(x) 2024-03-08 22:42:26 +01:00
florian
5086cf7e72 * set packenum and setalloc to defined values when changing mode, resolves #40056 2024-03-08 20:12:55 +01:00
J. Gareth "Curious Kit" Moreton
1dbcba4796 * arm/a64: Bug fix where instructions optimised into "mov r0,r0"
could leave registers undefined in some circumstances
2024-03-08 18:24:52 +00:00
Michaël Van Canneyt
4c434ceb08 * Only consume semicolon after uses clause when units have been connected. Fixes remaining failing tests 2024-03-08 11:31:49 +01:00
Michaël Van Canneyt
22de07446d * Fix tgeneric91, need to postpone some additional generic procedures 2024-03-07 16:12:24 +01:00
Michaël Van Canneyt
b2bc020fd7 * Handle rename of module during parsing, rebuild hash list. Fixes broken test tb0406.pas 2024-03-07 10:26:22 +01:00
florian
f41025f5dd * optimize also -(x+1) and -(1+x) into not(x) 2024-03-06 22:56:37 +01:00
Michaël Van Canneyt
2e6c3b060d * Initialize firstwaiting, after remark by Pierre 2024-03-06 21:55:47 +01:00
Michaël Van Canneyt
76687a04e5 * Fix TW22160B1 2024-03-06 17:08:52 +01:00
Pierre Muller
821f3e326f Fix compilation with -dDEBUG_DEVIRT 2024-03-06 14:40:22 +00:00
Pierre Muller
cc552c0815 Fix compilation with -dEXTDEBUG 2024-03-06 14:34:53 +00:00
Pierre Muller
9db42f5e67 Fix post_load_or_compile tppumodule method for SHORT_ON_FILE_HANDLES code by adding from_module parameter
Fixes compilation of text mode IDE for go32v2 target.
2024-03-06 14:16:37 +00:00
florian
0fb4fca957 * fix building of llvm compiler after node flag refactoring 2024-03-05 22:23:39 +01:00
florian
59c77a48b5 * transform -x-1 into not(x), resolves #40313 2024-03-05 22:11:32 +01:00
florian
1f2203c304 * fix compilation with 3.2.2 rtl 2024-03-05 22:11:32 +01:00
Michaël Van Canneyt
a15dfba971 * Fix compilation 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
325d29307f * Indentation and casing changes 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
91946b78d5 * Fix xtensa compilation 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
4e8b1cb97a * Fixed signature of insert_init_final_table 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
64e7dcbc81 * Log continue result 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
6ac14de986 * Properly handle finish state 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
42c9eb4096 * Add Logging of tasks under define 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
c96ef4902b * Handle finish state separately 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
2ba04dbd13 * generate init_final table from actual uses clauses 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
0bf0f26dd5 * Introduce m_processed 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
546de9f7e7 * Return first waiting in usedunitsloaded 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
c98e160c19 * Introduce state variables, used to construct list of used units 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
462c201ce6 * Introduce m_processed 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
5298e25c84 * Introduce task (Single main-level task at the moment, no change in behaviour). 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
881eb0fab5 * Check whether call to deref(impl) is needed during re-resolve (indexes may be -1 if not yet built) 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
a5caf91f74 * Split load_ppu for clarity 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
8aa9ac99a6 * Remove loaded_from in tmodule. The same unit can be loaded from different places 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
9cc30829fa * Restore messages state 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
1351746a46 * Make tglobalstat a class 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
6f7481fd24 * Remove freeold from set_current_scanner 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
7cd044eae7 save/restore state when loading other modules. 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
d9317e5df5 * Remove use of current_module 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
a81715d6ea * Pass loaded from 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
3ce07ef6fa * use set_current_scanner, add mainscanner 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
93ae6261cc * Make current_scanner a function/procedure to better control lifetime 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
4443e83b75 * replace/restore_scanner use var in state to make sure the correct scanner is freed 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
8fa3c57c1b * split module creation from parsing start 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
5b27fa9375 * Remove commented variables 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
83b5047931 * Move program/library header parsing to separate routines 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
b45aee980f * Split parsing from post-processing, code generation and linking 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
122251f71d * Move interface parsing part to separate routine so we can split tasks later 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
560d597c85 * Move implementation part to separate routine so we can split tasks later 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
97f159e4b2 * Refactory: remove current_module use from top-level parsing 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
277a3be9b0 * DRY Refactoring: introduce discardppu 2024-03-05 07:56:14 +00:00
florian
bf2a3566fa * patch by Sergey Larin: Compile dynarr := nil (and, preferably, SetLength(dynarr, 0)) as fpc_dynarray_clear, resolves #40309 2024-03-04 22:44:23 +01:00
florian
bcf320a76e * patch by Rika: Don’t pretend optinfo^.index can be aword(−1), resolves #40405 2024-03-03 22:49:28 +01:00
J. Gareth "Curious Kit" Moreton
1ab46c909a * Reduced the number of expensive calls to "GetUserCode" in DFA 2024-03-03 00:10:41 +00:00
florian
64141c8bdd * increase ppu long version as the format changed 2024-03-02 21:31:21 +01:00
florian
4103b3d180 * formatting 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
dba69917a9 * Flags specific to TInlineNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
4736cc2360 * Flags specific to TDerefNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
179fc5848b * Flags specific to TArrayConstructorNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
ecc16278f0 * Flags specific to TAssignmentNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
0e5da37533 * Flags specific to TAsmNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
c21a0f0654 * Flags specific to TModDivNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
b804fc5164 * Flags specific to TAddNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
5ea60b97b1 * Clarity over blocknode and VMT flags. nf_usercode_entry doesn't need to be cascaded in "firstpass" as TBlockNode.Simplify already does this 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
1bba83cebb * Flags specific to TVecNode have been moved to their own field 2024-03-02 21:31:21 +01:00
Michaël Van Canneyt
05f0ceeb26 * Atributes for class/record methods 2024-03-02 14:15:22 +01:00
Michaël Van Canneyt
2c9870f85a * Attributes must be assigned only to elements before the first colon 2024-02-29 10:22:19 +01:00
Michaël Van Canneyt
4769ed948a * Add codeaddress to extended RTTI for static methods 2024-02-28 11:52:16 +01:00
florian
f9b98092c4 * stack checking is actually 'S' 2024-02-27 22:37:01 +01:00
Nikolay Nikolov
6a28ac53da + support the native exception instructions in TWasmValidationStacks.Validate 2024-02-27 12:54:56 +02:00
Nikolay Nikolov
9da276b352 * fixed bug in thlcgwasm.a_op_reg_reg_reg_checkoverflow that used to generate
code that fails WebAssembly validation
2024-02-27 11:59:39 +02:00
florian
1966ce7c1c + Skylake-X for i386 2024-02-26 22:41:55 +01:00
Nikolay Nikolov
f2d739b93a + perform WebAssembly validation, if the compiler is compiled with the
DEBUG_WASM_VALIDATION defined
2024-02-26 12:13:59 +02:00
florian
cad21584e5 + Skylake-X 2024-02-25 22:52:30 +01:00
Michaël Van Canneyt
fb821b8c9b * Allow use of attributes on fields and properties in records and classes 2024-02-25 19:57:39 +01:00
Michaël Van Canneyt
91284ba543 * Create and correctly typed variable for fieldsym instead of using typecasts 2024-02-25 19:57:39 +01:00
Nikolay Nikolov
0ae014a98f + support the BR and BR_IF instructions in TWasmValidationStacks.Validate 2024-02-25 13:52:34 +02:00
Nikolay Nikolov
13f58fe343 + support if,block,loop,else,end_if,end_block,end_loop in TWasmValidationStacks.Validate 2024-02-25 13:08:41 +02:00
Nikolay Nikolov
472f9be9a6 + support the global.get and global.set instructions in TWasmValidationStacks.Validate 2024-02-25 11:38:36 +02:00
Nikolay Nikolov
ab65c9889b + added the WasmBasicType to TWasmGlobalAsmSymbol. This will help WebAssembly
validation and stack tracking.
2024-02-25 08:54:39 +02:00
Nikolay Nikolov
f4b9d51aff + introduced TWasmGlobalAsmSymbol subclass of TAsmSymbol. Use it for all
AT_WASM_GLOBAL symbols. This allows in the future to add extra data to the
  TWasmGlobalAsmSymbol, such as the WebAssembly global type, which will aid in
  WebAssembly validation and stack tracking.
2024-02-25 07:29:56 +02:00
Nikolay Nikolov
b367d7c905 + introduced TAsmData.WeakRefAsmSymbolByClass 2024-02-25 07:18:22 +02:00
Nikolay Nikolov
26a2ae92ad + introduced TAsmData.RefAsmSymbolByClass - similar to RefAsmSymbol, but allows
to create a subclass of TAsmSymbol even in the case of external symbol.
2024-02-25 07:15:23 +02:00
Nikolay Nikolov
81d98f5ae2 + support the CALL instruction in TWasmValidationStacks.Validate 2024-02-25 04:51:14 +02:00
Nikolay Nikolov
21cc89f1e3 + added a second TWasmFuncType parameter to the CALL WebAssembly instruction. It
is not part of the WebAssembly syntax and binary encoding, but it helps
  WebAssembly stack tracking and validation.
2024-02-25 04:48:17 +02:00
florian
587af1c78e * icelake is x86-64-v4 2024-02-24 21:54:11 +01:00
J. Gareth "Curious Kit" Moreton
7c5847bc70 * x86: "StcClcSet(c)2Mov" optimisation now checks to see if the destination register is in use 2024-02-24 20:37:10 +00:00
Michaël Van Canneyt
a2939e4187 * Force VMT at first position in system.tobject 2024-02-24 18:11:23 +01:00
Nikolay Nikolov
2dcb15f88f + support a_call_indirect in TWasmValidationStacks.Validate 2024-02-24 10:49:15 +02:00
florian
37ed03667f * fixed fpu_x86_64_v4_flags 2024-02-23 21:51:37 +01:00
Pierre Muller
e7f9626592 Be sure not to add a symbol with empty name as an alias for function return variable 2024-02-23 16:00:05 +00:00
Pierre Muller
37c3e86c7f Also reset check_valid_var after calling var_para_allowed 2024-02-23 15:48:50 +00:00
Sven/Sarah Barth
3447512e29 * ensure that "type SomeName = type reference" is still allowed when function references are disabled
+ added test
2024-02-23 15:31:38 +01:00
florian
3cf7890352 * don't throw an internalerror in case of an illegal assignment to an open array, resolves #40662 2024-02-22 22:35:18 +01:00
florian
b8bf295cd1 * patch by Rika: Fold repetitive scandir.pas cases, resolves #40660 2024-02-21 22:01:44 +01:00
Sven/Sarah Barth
5c890b59e3 * fix #40655: apply changes to packrecords, packenum and setalloc using the recordpending*() functions so that they are applied correctly in case of them being used directly after a {$POP}{$PUSH} sequence
+ added test
2024-02-20 23:52:52 +01:00
florian
bccc0b195e * allow type = type ... ; syntax only for previously declared types, avoids also internal error for #40566 2024-02-20 23:14:31 +01:00
florian
bf57750436 * cosmetics 2024-02-19 22:27:06 +01:00
florian
a75e453c30 + thlcgobj.location_force_mem now supports LOC_JUMP as well, resolves #40650 2024-02-19 22:22:12 +01:00
Pierre Muller
728fb7c58c Set ba variable upfront to avoid warning treated as error 2024-02-19 22:12:46 +01:00
Jonas Maebe
a512273976 WPO: handle classes defined in localsymtables
Can happen since the support for anonymous methods
2024-02-19 21:26:42 +01:00
florian
906571fa25 * improve pretty printing of symbols 2024-02-19 20:41:08 +01:00
Pierre Muller
79ed0db624 Avoid warning about unintialized 'ba' variable 2024-02-19 20:37:35 +01:00
Pierre Muller
2044868c10 Swap real constant in internal assembler 2024-02-19 20:19:36 +01:00
Pierre Muller
e3b93b07c6 * Fix writereloc for cross-endian compilation 2024-02-19 20:19:36 +01:00
Pierre Muller
f3e03f0483 Fix tabs 2024-02-19 20:19:35 +01:00
Pierre Muller
1d1e070ad2 Support cross-endian compilation for telfobjdata.writereloc method 2024-02-19 20:19:35 +01:00
Pierre Muller
5c564ea940 Use writeint8/writeuint8 methods to avoid cross-endian issues 2024-02-19 20:19:35 +01:00
Pierre Muller
ca6fe96360 Add writeInt8/writeUInt8 methods to fix some cross-endian generation issues 2024-02-19 20:19:35 +01:00
florian
af482fde23 * generate specializations only of no error happened so far to prevent further (internal)errors, resolves #40646 2024-02-18 23:08:21 +01:00
Michaël Van Canneyt
ccb1985953 * Fix latex error due to unescaped dollar 2024-02-18 21:39:04 +01:00
Pierre Muller
462d0eb07c Restrict use of A_MOVE to ufromsize and utosize = OS_INT. (contributed by Jinyang He)
Fix issue #40648
2024-02-18 20:18:50 +00:00
Sven/Sarah Barth
ea102d792f * fix #40634 the 2nd: a (strict) protected symbol in a parent class of the owner is supposed to be visible
+ added test
2024-02-18 19:35:24 +01:00
Sven/Sarah Barth
5e05630713 * fix the internal error of #40639; however as the test code in question will only compile correctly with the next commit no test is added yet 2024-02-18 19:35:24 +01:00
Sven/Sarah Barth
1dbde8a79d - remove no longer required check as that is now handled by check_strict_private (not to mention that the check had been placed incorrectly anyway...) 2024-02-18 19:35:24 +01:00
Sven/Sarah Barth
11200cfaf6 * use check_strict_private and check_strict_protected in their respective non-strict checks to avoid code duplication 2024-02-18 19:35:23 +01:00
Sven/Sarah Barth
852aee489c * move the checks for strict private and protected into their own nested functions 2024-02-18 19:35:23 +01:00
J. Gareth "Curious Kit" Moreton
ae927b0689 * x86: Fixed "Cmp1Jl2Cmp0Jle" and "CmpJe2NegJo" optimisations
being applied incorrectly if another jump follows
2024-02-18 15:37:27 +00:00
J. Gareth "Curious Kit" Moreton
e406cbd9c8 * x86: Minor efficiency gains in OptPass1CMP 2024-02-18 15:37:27 +00:00
J. Gareth "Curious Kit" Moreton
1e0f6f9f64 * x86: Fixed error in "LeaLea2Lea 1" optimisation
not properly accounting for the first LEA
	 instruction having a repeated register
2024-02-18 15:31:20 +00:00
Pierre Muller
692754b422 Move test to end of possible conversion and add check_valid_var boolean variable 2024-02-17 21:33:52 +00:00
Pierre Muller
f39cfc75fc First attempt to fix bug report #40537 2024-02-17 21:33:52 +00:00
florian
8146443336 + set pi_do_call on ARM as well if we check for fpu exceptions 2024-02-17 21:03:55 +01:00
Michaël Van Canneyt
7a29d8f54d * Fix compilation with DEBUG_NODE_XML 2024-02-17 11:04:29 +01:00
florian
a736a4bba7 + set pi_do_call on RiscV as well if we check for fpu exceptions 2024-02-16 22:48:14 +01:00
Sven/Sarah Barth
d9903e6e16 * fix #40634: correctly check visibility for child classes in case of a mixture of specializations and non-specializations
+ added test
2024-02-16 16:54:23 +01:00
florian
421d67556a + set pi_do_call on loongarch64 as well if we check for fpu exceptions 2024-02-15 22:47:31 +01:00
florian
1ee9a39fe2 + lazarus project for a loongarch64 compiler 2024-02-15 22:47:31 +01:00
florian
57f6ed804e + set pi_do_call on xtensa as well if we check for fpu exceptions
* cosmetics
2024-02-14 23:04:25 +01:00
J. Gareth "Curious Kit" Moreton
f7e4c0f282 * 3-operand LEA instructions are now expanded if the latency could cause slowdown 2024-02-14 20:59:01 +00:00
Michaël Van Canneyt
fe62b3ace8 * Introduce constwresourcestring - in unicode mode, resource strings are unicode strings, and must be streamed differently 2024-02-13 19:44:36 +01:00
florian
a71cc71585 + function needs_check_for_fpu_exceptions to unify fpu exception handling 2024-02-13 17:42:21 +01:00
J. Gareth "Curious Kit" Moreton
629c87efc8 * x86-64: Typo fixed in FPU type string array 2024-02-13 14:39:29 +00:00
florian
3ed5a4a022 + when calling FPC_THROWFPUEXCEPTION in a sub routine, pi_do_call must be set, fixed for aarch64 2024-02-12 23:25:35 +01:00
Pierre Muller
eae74aaee0 Follow sdas documentation for .ascii limitations by using only printable chars and .byte for others 2024-02-12 14:03:02 +00:00
Pierre Muller
53bf5dc6ef Avoid wrong typecast by adding check that p1 is an instuction before casting it to taicpu 2024-02-12 10:39:18 +00:00
J. Gareth "Curious Kit" Moreton
271f69db12 * arm/a64: "OptPass2AND" and "OptPass2CMP" adapted to remove vestigial CMP and TST instructions 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
6b2e4fa413 * arm: "OpCmp2OpS" moved to Pass 2 so it doesn't conflict with AND; CMP -> TST optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
bf29f2051c * arm/a64: Added new TST post-peephole optimisation to replace previous AND/CMP/B(c) optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
b18c10d0d8 * arm/a64: New "OptPass2TST" routine to catch "TST; B.c; AND -> ANDS; B.c" optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
9f19f582c4 * arm/a64: New AND/CMP -> TST or ANDS optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
29916bc6f6 * arm: Fixed "RegInInstruction" and "RegModifiedByInstruction" not handling the flags properly 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
38d2f3d58c * a64: Renamed OptPostCMP/And to PostPeepholeOptCMP/AND for internal consistency 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
d7d4b446c1 * FindRegAllocBackward will now return nil if it hits a dealloc for the register first 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
1fafcbc125 * New "TryRemoveRegAlloc" optimisation utility 2024-02-11 21:39:19 +00:00
florian
4f82fade82 * extend LeaCallLeaRet2Jmp optimization to work on windows 2024-02-11 18:56:26 +01:00
J. Gareth "Curious Kit" Moreton
62495c964a * x86: New "aoc_DoPass2JccOpts" option to catch branch and
STC/CLC optimisations that only manifest in Pass 2
2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
2055ef4e88 * x86: STC/CLC optimisations can now handle multiple Jcc instructions 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
de03a1b894 * x86: Additional STC/CLC; J(N)C deterministic jump optimisation 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
698d432cce * x86: Separated out Jcc; STC/CLC optimisation and added additional peephole optimisations 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
3e06242fd8 * x86: New "STC/CLC; MOV" peephole optimisation 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
d06dd2b0ea * x86: New "Jcc; CLC/STC; .Lbl" optimisation 2024-02-11 15:05:57 +00:00
florian
2575cbc439 * complain about turned off support of c style operators only in the parser,
so error recovery is better
2024-02-11 11:05:05 +01:00
florian
8a48d1bbbc * clean up of arrayconstructor_to_set, the stringdef case didn't work for years and is not tested, so it probably is not supposed to be there at all 2024-02-10 22:16:02 +01:00
florian
bc0d2293a1 * stricter type checking for set constants, resolves #40631 2024-02-09 23:36:44 +01:00
Sven/Sarah Barth
43721f21c4 * fix #40621: when checking for visibility of members then always use the genericdefs for specializations for correct scoping
+ added test
2024-02-09 17:24:39 +01:00
Sven/Sarah Barth
ed8a05d697 * use iscurrentunit only when there isn't a suitable def that the moduleid of the symtables can be compared to 2024-02-09 17:22:46 +01:00
Sven/Sarah Barth
ddc2259e5e * protect against comparisons of nested types of generics and specializations 2024-02-09 17:14:29 +01:00
Sven/Sarah Barth
2c527cfc01 * fix typos in comment, no code changes 2024-02-09 14:01:00 +01:00
Nikolay Nikolov
26855a29c8 * fix warning 2024-02-08 16:54:33 +02:00
Nikolay Nikolov
e073d5f7f7 + implemented support for the local.get, local.set and local.tee instructions in TWasmValidationStacks.Validate 2024-02-08 16:49:45 +02:00
J. Gareth "Curious Kit" Moreton
b4eabbe5ce * x86: Fixed CPU feature flags for AMD Jaguar and Piledriver 2024-02-06 22:15:51 +00:00
J. Gareth "Curious Kit" Moreton
e4bd58d66a * x86: Replaced CPU features array with "cpu_x86_64_v1_flags" where possible 2024-02-06 22:15:51 +00:00
florian
d7a486f225 * comment fixed, hint by Maxim Ganetsky 2024-02-06 22:09:52 +01:00