Jonas Maebe
12bde4e903
WPO: fix dead code detection, and handle procvars
...
Extend dead code detection to not only look for the main mangled name, but also
for any aliases before deciding that a routine has been dead-stripped.
Assume objects/classes can also be constructed if the address of one of their
constructors or of the TObject.NewInstance class method has been taken.
Resolves #40204
2023-03-24 21:22:18 +01:00
Sven/Sarah Barth
3c2703787c
* ensure that newly created tloadparentfpnodes have a valid resultdef as they might be created in situation where the loadnode itself is no longer typechecked
2022-11-06 22:01:48 +01:00
Sven/Sarah Barth
2be8f01efe
* implement assignment of anonymous functions to procedure or method variables if they either capture nothing or (in case of method variables) at most the Self variable
2022-05-26 21:43:01 +02:00
Sven/Sarah Barth
5129c2cb9a
* consider Self parameters of nested functions as captured as well
2022-05-26 21:43:01 +02:00
Sven/Sarah Barth
d56a90e5ed
* keep track of symbols that are accessed from a nested/anonymous function that belong to a surrounding scope
2022-05-26 21:43:01 +02:00
Sven/Sarah Barth
2cc621618a
* Delphi-mode calling without parenthesis
2022-05-26 21:43:00 +02:00
Sven/Sarah Barth
90844c2027
* fix #35261 : apply slightly adjusted changes by Ryan Joseph to implement support for implicit generic function specializations
...
The main adjustments were as follows:
- fixing coding style and identation
- fixing some typos
- using a better name for the property in tcallcandidates which holds the symbols created for anonymous parameter values
2022-04-20 18:59:31 +02:00
Yuriy Sydorov
07698050e5
* Before r35961 (back in 2017) some simple assignment optimizations, such as "x:=x+y" to "inc(x,y)", were performed when -O2 in tassignmentnode.simplify. In r35961 these optimizations were moved to a separate pass which is enabled only when -O3 by cs_opt_use_load_modify_store. This separate pass can benefit from other optimization. But worse code is generated with -O2 since then.
...
This commit restores applying of simple assignment optimizations when -O2.
2021-08-13 13:53:40 +03:00
svenbarth
067b9b2922
* copy and compare the typesym inside type nodes as well
...
git-svn-id: trunk@49062 -
2021-03-27 09:34:59 +00:00
Jonas Maebe
8ba4c4bcf0
* factored out the creation of loadnodes for special variables/parameters
...
git-svn-id: trunk@47857 -
2020-12-27 13:18:56 +00:00
florian
b36597c76a
* better calculation of estimated stack frame size
...
git-svn-id: trunk@46733 -
2020-08-30 20:53:59 +00:00
yury
7bffafdf8b
* Improved the parentfp optimization to properly handle cases when a nested routine calls other nested routines.
...
git-svn-id: trunk@45665 -
2020-06-20 18:34:26 +00:00
yury
c15b6f4516
* Fixed the parentfp optimization for some cases when nested procvars are used.
...
git-svn-id: trunk@45664 -
2020-06-20 18:28:07 +00:00
yury
2808873d1b
* Reworked the optimization of unused $parentfp for nested routines.
...
- Do not remove the $parentfp parameter as was done in the previous optimization approach. Instead when $parentfp is unused to the following:
- On the caller side: Omit passing the value for $parentfp for targets where tcgcallparanode.push_zero_sized_value_para=false (classic CPU targets).
Pass 0/nil as $parentfp for targets where tcgcallparanode.push_zero_sized_value_para=true;
- On the callee side: Prevent allocation of registers/resources for $parentfp.
- When possible keep $parentfp in a register.
- Set the pio_nested_access flag in tprocinfo.set_needs_parentfp() to properly handle deep nesting levels;
git-svn-id: trunk@45436 -
2020-05-19 13:17:47 +00:00
florian
fc98a0db4f
* cosmetics
...
git-svn-id: trunk@44542 -
2020-04-03 20:15:25 +00:00
florian
fa4cbc89a5
+ Xtensa: hard float support, i.e. make use of floating point extension if available
...
git-svn-id: trunk@44539 -
2020-04-03 20:15:23 +00:00
florian
f6c16323fa
* unified loadnf_load_self_pointer into loadnf_load_addr
...
+ var parameters are now allowed when doing tail recursion optimziation, resolves #32811
git-svn-id: trunk@43824 -
2019-12-30 22:43:10 +00:00
Jonas Maebe
ac1e0f96bd
* replaced tentryfile.get/putsmall/normalset() with a common tget/putset
...
that expects an open array of byte, and use it for all sets
o since all sets need to be typecasted to an array type of the appropriate
size, we'll get a compilation error in case this needs to be done and
that also tells us at the same time that the ppu version will need to
be increased
* enabled {$packset 1} for the compiler, as this is now safe with the above
changes
git-svn-id: trunk@43407 -
2019-11-06 21:50:19 +00:00
Jonas Maebe
ef6dde6de3
* fixed loading the address of a copied labelnode in a loadnode
...
(mantis #35877 )
git-svn-id: trunk@42987 -
2019-09-13 19:06:40 +00:00
pierre
243c967967
Commit of new debug feature implemented by J. Gareth Moreton
...
Allows compilation of compiler using -dDEBUG_NODE_XML
which will generate a NAME-node-dump.xml file for each
unit, program or library compiled,
containing a XML description of the nodes handled during
compilation of the unit, program or library.
git-svn-id: trunk@42271 -
2019-06-22 14:08:47 +00:00
yury
e5c2d13671
* Do not set pi_needs_got in current_procinfo.flags at the node level, since the GOT usage can only be estimated there. Instead set the pi_needs_got flag at places where the GOT register is accessed during the code generation. This eliminates generation of the unneeded initialization of the GOT register and fixes linker errors when the _GLOBAL_OFFSET_TABLE_ symbol is referenced but no actual GOT references are present.
...
git-svn-id: trunk@41460 -
2019-02-25 13:35:40 +00:00
Jonas Maebe
51e68eb302
* fixed several places where the interface crc could change:
...
o unsetting po_inline while parsing the implementation for various reasons
(interprocedural goto/label, accessing a local in a parent frame,
having nested procedures)
o instead handle this via the pio_inline_not_possible flag
o noreturn can no longer be specified only in the implementation
git-svn-id: trunk@40789 -
2019-01-06 20:35:56 +00:00
florian
ae8304f657
* set nf_write flag properly for vec. nodes of types with implicit dereferencing
...
git-svn-id: trunk@40339 -
2018-11-17 15:08:23 +00:00
florian
9f16c34329
+ initial work for tls-based threadvar support on arm-linux
...
git-svn-id: trunk@40267 -
2018-11-07 22:02:58 +00:00
svenbarth
a8b2ad31d1
* fix for Mantis #34355 : correctly check whether the array constructor is empty (aka []) or not
...
git-svn-id: trunk@39882 -
2018-10-07 12:25:24 +00:00
svenbarth
85439a0fa0
* also check for nf_assign_done_in_right flag after typechecking the right side
...
git-svn-id: trunk@39118 -
2018-05-25 15:54:41 +00:00
florian
0fd0e356e1
+ new flag ra_different_scope: used if a node tree is marked as non-regable if a variable is accessed from a different scope
...
git-svn-id: trunk@38689 -
2018-04-04 21:39:47 +00:00
florian
c230f81719
+ support for <dyn. array>+<dyn. array>, resolves #30463
...
git-svn-id: trunk@38406 -
2018-03-04 16:12:43 +00:00
svenbarth
d50848174a
+ add putboolean and getboolean convenience methods to tentfile
...
* use putboolean and getboolean where approbiate
git-svn-id: trunk@37972 -
2018-01-14 21:36:02 +00:00
nickysn
efc5e339d0
* use an enum instead of integer constants to represent inline numbers
...
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
their enum name, instead of number
git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf
* removed unused units
...
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
8f4ef91efb
* tarrayconstructornode: force conversion to set if there's a range node in the tree
...
git-svn-id: trunk@36101 -
2017-05-04 21:55:12 +00:00
svenbarth
82b2d22ed6
* keep track of allow_array_constructor as part of the array constructor node
...
git-svn-id: trunk@36099 -
2017-05-04 21:52:21 +00:00
svenbarth
dfc23da06c
* tassignmentnode.pass_typecheck: also allow "dynarray := []" in addition to "dynarray := nil"
...
git-svn-id: trunk@36098 -
2017-05-04 21:40:37 +00:00
svenbarth
b1c66dee9b
+ tarrayconstructornode: add utility method has_range_node to check whether the array constructor node tree contains any range node
...
git-svn-id: trunk@36091 -
2017-05-04 21:16:47 +00:00
svenbarth
4a2266ac44
* tarrayconstructornode.pass_typecheck: set elementdef of the arraydef only after the arrayoptions are changed
...
git-svn-id: trunk@36090 -
2017-05-04 21:03:33 +00:00
nickysn
012153201a
* moved the conversion of "x:=x op k" to inline nodes to a separate optimization
...
pass, so that it can be done after other optimizations, such as constant
propagation
git-svn-id: trunk@35961 -
2017-04-26 22:44:01 +00:00
nickysn
5bb77905cd
* fixed the missing warnings for unused variables at -O3, when one of the new
...
modify-in-place inline nodes are used
git-svn-id: trunk@35773 -
2017-04-11 14:25:57 +00:00
nickysn
4697a653a4
+ perform the "i:=i +/-/and/or/xor k" optimization when there are two typecasts
...
inserted. This makes the optimization work for more integer types.
git-svn-id: trunk@35772 -
2017-04-11 11:25:40 +00:00
nickysn
d8406c4227
+ perform the "i:=-i" / "i:=not i" optimization even when there are typecasts
...
inserted; this makes the optimization work for all integer types
git-svn-id: trunk@35763 -
2017-04-10 14:06:19 +00:00
nickysn
98be270adb
* fixed a memory leak in the "i:=-i" / "i:=not i" optimization
...
git-svn-id: trunk@35762 -
2017-04-10 13:27:29 +00:00
nickysn
e78f0aafcd
- remove whitespace, was inserted by accident
...
git-svn-id: trunk@35760 -
2017-04-10 11:55:26 +00:00
nickysn
3616627d0b
* at -O3 optimization level, convert "i:=not i" and "i:=-i" to the new
...
in_not_assign_x and in_neg_assign_x inline nodes, which may generate better
code on certain cpus (such as x86)
git-svn-id: trunk@35758 -
2017-04-09 14:55:15 +00:00
nickysn
f29492bdea
* at -O3 level, convert i:=i and/or/xor k to the new in_[and/or/xor]_assign_x_y
...
inline nodes, which should generate better code for certain CPU targets,
including x86. Note that the optimization isn't applied yet for all integer
types (those that have extra implicit typecasts, inserted by the compiler,
aren't handled yet).
git-svn-id: trunk@35685 -
2017-03-29 15:20:57 +00:00
florian
b55cb246da
* do +/-/pred/succ to inc/dec optimizations only at an appropriate optimziation level
...
git-svn-id: trunk@35569 -
2017-03-12 07:49:37 +00:00
pierre
a7c7319352
Avoid use of getcopy method for i:=i+/i k optimization
...
git-svn-id: trunk@35568 -
2017-03-11 21:41:51 +00:00
florian
a679cd4e37
* copy loadnodeflags in tloadnode.dogetcopy as well
...
git-svn-id: trunk@35558 -
2017-03-10 20:44:20 +00:00
nickysn
bd48a71a98
* replace i:=i+k/i:=k+i/i:=i-k (integer only, for now; later we can also do this for pointers too) by inc/dec(i,k)
...
git-svn-id: trunk@35550 -
2017-03-09 15:35:27 +00:00
florian
a27b07b342
+ more restrictions on pred/succ to dec/inc optimization
...
o check if the argument can be used as a call by reference parameter
o check if the argument has no side-effects
+ tests
git-svn-id: trunk@34816 -
2016-11-06 16:36:02 +00:00
florian
000cffa8e3
* make more use of nf_internal to avoid range check errors
...
git-svn-id: trunk@34793 -
2016-11-05 23:05:51 +00:00