Commit Graph

786 Commits

Author SHA1 Message Date
Sven/Sarah Barth
599b187589 * fix #40979: don't recurse further into the nested hierarchy for code generation if the function is generic
+ added test
2025-01-14 20:38:37 +01:00
Rika Ichinose
11d16be702 Add a bound parameter to node_count(_weighted). 2024-11-30 20:04:34 +00:00
Rika Ichinose
8784dbc095 Outline freeing TFPList with disposing its items into TFPList.FreeAndNilDisposing. 2024-10-27 16:45:35 +00:00
J. Gareth "Curious Kit" Moreton
ffe97bb7d9 * do_optconstpropagate and do_optdeadstoreelim now set their
"changed" parameter properly and is now an out type.
  * Optimisations on calls to said functions
2024-09-22 12:13:14 +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
1ab46c909a * Reduced the number of expensive calls to "GetUserCode" in DFA 2024-03-03 00:10:41 +00:00
J. Gareth "Curious Kit" Moreton
5c090fce2c * Node dumps now output the convention if it's not pocall_default 2023-12-13 21:35:31 +00:00
Jonas Maebe
50040a2cab default values: store as staticvarsyms in staticsymtable
Previously, they were stored as localvarsyms in either the localsymtable
(for procedures/functions) or as localvarsyms in the staticsymtable (for
init/fini code of units/main programs). The latter was a hack (staticsymtables
normally cannot contain localvarsyms) and caused the temp allocator to also
allocate them as a local in fini code even if the default was only in the init
code.

The new approach ensures at most one copy gets allocated per unit, it doesn't
require explicit initialisation (since staticvarsyms are in bss -> zeroed by
default), gets rid of the localvarsyms in staticsymtables, and as a bonus
solves an issue with inconsistent LLVM debug information for the localvarsym
in init/fini code (since the staticsymtable is shared between the init and
fini code, so was the local, and therefore we generated debug info stating
it was defined in the fini code but within the scope of the init code).

Resolves #40395
2023-08-15 21:13:48 +02:00
florian
0d3ec87492 * also initalize default helper variables of initialization sections, resolves #40183 2023-03-19 21:19:10 +01:00
Jonas Maebe
0e46041717 WPO: also consider NewInstance to detect class instancing
Resolves #40200
2023-03-18 21:18:25 +01:00
florian
342524c312 * run dead store elimination multiple times if needed 2022-11-02 22:14:12 +01:00
Jonas Maebe
d12bf094ab cs_opt_consts: disable when non-local gotos are active
This optimisation can insert code after the call to fpc_setjmp, resulting in
it not getting executed after a longjmp. Fixes tmacnonlocalgoto on AArch64
with -O2 or higher.
2022-10-08 22:27:23 +02:00
Jonas Maebe
3d6c53ee74 parentfpstruct: explicitly trash before initialising
It's an internal sym, but it contains user data. Together with the previous
commit resolves #39845
2022-07-26 22:36:13 +02:00
Sven/Sarah Barth
f8b1801a8f + implement necessary functionality in tcgprocinfo to initialize and populate the capturer
Based on code by Blaise.ru
2022-05-26 21:44:23 +02:00
Sven/Sarah Barth
4dbdb4f0f1 + initial support for anonymous functions, for now as essentially nested functions
Based on work by Blaise.ru
2022-05-26 21:43:00 +02:00
Sven/Sarah Barth
ee187f78f4 * have read_body return the created procdef 2022-05-26 21:42:53 +02:00
Sven/Sarah Barth
f6a444c6fc * combine the Boolean parameters of read_proc and read_proc_dec into a set 2022-05-26 21:42:53 +02:00
florian
4c8e802dd3 * continue const. propagation after a for loop when possible 2022-05-22 22:52:18 +02: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
Pierre Muller
5acd7a7b83 Rename tsymtable.insert and delete methods to insertsym ands deletesym 2022-05-03 23:00:28 +02:00
Karoly Balogh
60919b4979 * m68k: disable the frame pointer optimization on subarchs that don't support long displacements for now, until the shortcomings of the cg can be addressed 2022-03-11 13:01:42 +01:00
florian
2b66f60a88 * do not throw an internal error in case of a misplaced string, resolves #39609 2022-03-02 23:09:53 +01:00
Florian Klämpfl
a47f153dae * avoid to create a stack frame on aarch64 if possible 2021-11-02 22:23:24 +01:00
Yuriy Sydorov
b78761efd3 * Removed obsolete OLDREGVARS ifdefs. 2021-11-02 17:08:08 +02:00
florian
d0fdda6da7 + TDFABuilder.redodfainfo 2021-10-22 22:39:39 +02:00
Nikolay Nikolov
c96e203780 * moved the 'end_block' WebAssembly instruction before the 'exit' label right
before the procedure finalization code. This fixes compilation errors in
  procedures with implicit finalization code (e.g. for ansistring local vars,
  etc).
2021-10-20 14:35:52 +03:00
florian
1e072aef31 + for loop optimizations can be controller by a switch (-Oo(no)forloop) 2021-09-12 10:54:46 +02:00
florian
468975aa30 + move often used floating point constants into registers 2021-09-05 18:19:58 +02:00
florian
d2921dfb55 * move more node tree optimizations to tcgprocinfo.OptimizeNodeTree 2021-09-05 18:00:11 +02:00
nickysn
940738a3a1 * synchronized with trunk
git-svn-id: branches/wasm@48846 -
2021-03-01 13:21:24 +00:00
florian
fe57cd3536 * fix LLVM after r48828
* global gotos really use the return type of fpc_setjmp to test where we come from

git-svn-id: trunk@48835 -
2021-02-27 22:07:58 +00:00
florian
4c2e0b9ff0 * for setjmp based exception handling, get the type of the exception reason from the setjmp result
git-svn-id: trunk@48828 -
2021-02-27 16:47:36 +00:00
nickysn
64bb0359d2 * synchronized with trunk
git-svn-id: branches/wasm@48412 -
2021-01-24 23:38:35 +00:00
yury
64c586b86d * Removed/ifdefed lots of unused variables.
git-svn-id: trunk@48384 -
2021-01-24 12:24:01 +00:00
nickysn
96de6c4b96 * synchronize with trunk
git-svn-id: branches/wasm@47877 -
2020-12-28 18:45:24 +00:00
marco
185f20b9ec * fix comment typo mentioned by Bart
git-svn-id: trunk@47866 -
2020-12-28 10:46:35 +00:00
Jonas Maebe
5d51a788f7 - revert r47208
* properly fix the internalerror it hid: only replace the local symbols
    migrated to the parentfpstruct right before generating debug information,
    so that internally generated self/result loads during optimisation passes
    don't get confused by the replacement absolutevarsyms (those are normally
    never encountered during optimisation, as regular absolutevarsyms are
    replaced during parsing)

git-svn-id: trunk@47855 -
2020-12-27 13:18:50 +00:00
nickysn
47ff701db7 * synchronized with trunk
git-svn-id: branches/wasm@47778 -
2020-12-14 23:07:56 +00:00
florian
00af340feb * cleanup
git-svn-id: trunk@47774 -
2020-12-14 21:55:41 +00:00
nickysn
91e9558f5b * synchronized with trunk
git-svn-id: branches/wasm@47766 -
2020-12-12 23:20:33 +00:00
yury
8b7c5666a2 * Renamed fc_block_with_exit to fc_no_direct_exit to expand its usage.
* Set fc_no_direct_exit in case when a routine has an additional implicit exit code, such as calling FreeInstance in the destructor.

git-svn-id: trunk@47749 -
2020-12-10 17:38:37 +00:00
nickysn
dc5b78d5f0 * synchronized with trunk
git-svn-id: branches/wasm@47716 -
2020-12-08 06:57:57 +00:00
pierre
a7232669ff * Adapted from patch node-dump-pass-1.patch submitted by J. Gareth Moreton from bug report 38156.
This patch extends the DEBUG_NODE_XML debug feature by also outputting, 
     to the *-node-dump.xml files, the node tree as it appears after the first pass, 
     since it often contains many more internal nodes like temporary allocations that may need
     to be evaluated for debugging and development purposes, or node-level optimisation opportunities.

git-svn-id: trunk@47709 -
2020-12-07 07:28:04 +00:00
florian
9c6bdcfbb7 * fix in r47632 should be enabled for all targets as it is a stack tainting
parameter

git-svn-id: trunk@47680 -
2020-12-03 21:22:07 +00:00
nickysn
4676146e3d * synchronized with trunk
git-svn-id: branches/wasm@47662 -
2020-12-02 03:53:02 +00:00
pierre
af17e9460b Apply patch proposed by J. Gareth Moreton in:
bug report #0036882: [Feature] Class and record definition XML dump extension

  These patches extend the node dump feature (enabled with DEBUG_NODE_XML)
  so it also dumps class and record definitions to the XML file. They are contained within <definition> tags.
  Currently only fields and constants are dumped to the XML file. Methods, constant and variable definitions may be added later.

git-svn-id: trunk@47658 -
2020-12-01 11:45:14 +00:00
nickysn
aeafe42144 * synchronized with trunk
git-svn-id: branches/wasm@47653 -
2020-12-01 03:27:01 +00:00
florian
c47d6d7af0 * check if an invisible parameter for the result occupies parameter space
git-svn-id: trunk@47632 -
2020-11-29 13:38:33 +00:00
florian
fbb2e63fea + #QLvember work: stack frame optimization for m68k
git-svn-id: trunk@47629 -
2020-11-29 10:16:00 +00:00
nickysn
48b81da877 * synchronized with trunk
git-svn-id: branches/wasm@47249 -
2020-10-29 10:49:36 +00:00