Commit Graph

72 Commits

Author SHA1 Message Date
Nikolay Nikolov
da37fabc42 * fixed a div by zero error, when compiling a wasi-hosted compiler 2023-10-22 01:11:17 +03:00
florian
5921fa9a62 + store references to global variables in registers if benefical (currrently used for aarch64 only) 2021-12-11 22:46:27 +01:00
florian
2240c69078 * improved heurisics when thread var addresses or float constants are put in registers 2021-11-03 22:28:48 +01:00
Jonas Maebe
89d2775191 optcse: fix wrong typecast 2021-11-01 13:56:51 +01:00
florian
4f77cbbac4 + keep addresses of thread vars in registers if possible and likely an advantage 2021-10-31 19:25:01 +01:00
florian
5e9eb673f8 * x86: only add mm capable consts to register candidate list, this is better
than checking when they are assigned
2021-09-12 20:31:45 +02:00
florian
468975aa30 + move often used floating point constants into registers 2021-09-05 18:19:58 +02:00
florian
6e4997265c + min/max intrinsics for internal use by the compiler
git-svn-id: trunk@47692 -
2020-12-05 22:00:58 +00:00
florian
af1e6fde5c * setelementn cannot be the root node of a cse domain, resolves #37477
git-svn-id: trunk@46299 -
2020-08-06 20:49:07 +00:00
Jonas Maebe
59331c3d3c * enable putting records that contain a single field into records on all
targets (patch by J. Gareth Moreton, mantis #37343)

git-svn-id: trunk@45801 -
2020-07-17 20:57:24 +00:00
florian
851accbb4b * cse adjusted
git-svn-id: trunk@43496 -
2019-11-16 14:07:59 +00:00
Jonas Maebe
a7cb99f012 * when transforming the structure of a node tree involving full boolean
evaluation flags, also move the full boolean evaluation flags

git-svn-id: trunk@40367 -
2018-11-25 20:56:58 +00:00
florian
88f83280dc * correctly take care of short boolean evaluation when rearranging nodes during CSE
git-svn-id: branches/laksen/riscv_new@39803 -
2018-09-25 20:31:03 +00:00
Jeppe Johansen
8f4173c54d Add a number of optimizations.
Don't do CSE restructuring when has full evaluation enabled.

git-svn-id: branches/laksen/riscv_new@39781 -
2018-09-20 20:27:58 +00:00
florian
1497b64804 * the temp. locations created by cse were not properly cleanup up, this patch fixes this
git-svn-id: trunk@38624 -
2018-03-25 15:55:34 +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
Jonas Maebe
179c1ab328 * changed ttemp*node.tempinfo^.flags to a private field, and added setters
and getters for the ttemp*node classes instead
   o this will allow descendants to prevent certain flags from being added
     or removed. E.g. for LLVM, certain temps must never be put in registers
     because it cannot typecast a value in a register from a non-record/array
     type to an array type without forcing it to memory (so if that is done
     on an lvalue, the result will be written to the memory temp instead of
     to the register)

git-svn-id: trunk@34358 -
2016-08-21 14:23:09 +00:00
florian
260ea81c82 * improve cse on record/array accesses
git-svn-id: trunk@33134 -
2016-02-28 18:44:45 +00:00
Jonas Maebe
af2c7bf00f * don't perform CSE on typeconversion nodes inserted for absolute
references, or anything below them (mantis #27210)

git-svn-id: trunk@31193 -
2015-07-04 22:28:31 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
florian
bd6c6d83f8 + do cse on length as well
git-svn-id: trunk@30734 -
2015-04-26 20:11:45 +00:00
Jonas Maebe
86bde57b0f * do not switch around node subtrees if they have different resultdefs, e.g.
because a subtree has been optimized for a 32x32->64 multiplication (so
   some subtrees have a 32 bit resultdef and others a 64 bit resultdef)

git-svn-id: trunk@30033 -
2015-02-28 22:31:00 +00:00
florian
99e1bb32a2 + apply cse to more inline nodes
git-svn-id: trunk@27675 -
2014-04-27 14:28:17 +00:00
florian
7107e9d5ea * do cse on all const. intregable expressions
git-svn-id: trunk@27245 -
2014-03-23 20:11:15 +00:00
florian
25fc10b556 * do not store references to dyn. arrays
git-svn-id: trunk@26741 -
2014-02-09 08:41:51 +00:00
florian
3e4198ea45 * take care of dyn. arrays in cse
git-svn-id: trunk@26740 -
2014-02-08 21:47:46 +00:00
florian
1366498255 + nf_addr_taken: it marks nodes which address is taken
+ check if tnodeflags is 4 bytes or less
* do not do cse on expressions which address is taken

git-svn-id: trunk@26713 -
2014-02-07 20:40:42 +00:00
florian
c5523fc780 * do not search a node tree which has been found being subject to cse further on
git-svn-id: trunk@26691 -
2014-02-06 19:27:11 +00:00
florian
8fba876904 * apply cse to static symbols on x86-64 as well, if their address can be stored
git-svn-id: trunk@26634 -
2014-01-30 20:24:36 +00:00
florian
809549a31f * addr nodes can be also considered in cse
git-svn-id: trunk@26625 -
2014-01-30 17:19:06 +00:00
florian
3a11dd1055 * create the addr node for cse with create_internal to avoid errors when taking the address of a temp.
git-svn-id: trunk@26624 -
2014-01-30 17:19:04 +00:00
florian
1b355ce1e4 * apply cse to all non-regable variables if possible
git-svn-id: trunk@26579 -
2014-01-25 08:50:13 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
florian
b4481544ef * work with actualtargetnode when checking load nodes for cse
git-svn-id: trunk@25434 -
2013-09-07 17:44:44 +00:00
florian
be2ab84474 * make actualtargetnode a normal procedure using pointers to node so it can be used also when replacing nodes
+ replacenode to replace nodes inline

git-svn-id: trunk@25013 -
2013-06-29 22:20:30 +00:00
florian
2c7b34cda1 * don't apply cse on static variables being regable
git-svn-id: trunk@23785 -
2013-03-10 20:29:52 +00:00
paul
5d74e0578a compiler: remove unused variables and unneeded assignments
git-svn-id: trunk@23467 -
2013-01-21 01:24:36 +00:00
florian
4aca018f62 * setelement nodes itself should not be considered, since setelement
nodes generate no code except loading data into registers, this does
  not hurt, resolves #23342

git-svn-id: trunk@23039 -
2012-11-20 21:15:38 +00:00
Jonas Maebe
ae56841ee6 * do not apply node CSE to nested loads on high level cpu targets, because
their nested tree already contains the load (subscriptn) for the variable
    itself and there is no clean/easy way to avoid that in a completely
    portable way in ncgnstld + test

git-svn-id: trunk@22519 -
2012-10-02 18:12:24 +00:00
florian
ca5fabda6d * cleanup some unused units from uses clauses
git-svn-id: trunk@22433 -
2012-09-21 18:53:46 +00:00
florian
a1da9b7710 * better cse handling of short boolean evaluated boolean expressions
git-svn-id: trunk@22369 -
2012-09-10 18:42:50 +00:00
Jonas Maebe
a080669771 * disabled arrayconstructorn,arrayconstructorrangen as cseinvariants
(fixes lazarus compilation)

git-svn-id: trunk@22251 -
2012-08-26 17:59:21 +00:00
florian
1c2ed53735 * updated comments to reflect latest changes to cse
git-svn-id: trunk@22054 -
2012-08-09 20:18:04 +00:00
florian
4d86d25c6c * -O4 switch for optimizations which are correct but which might have unexpected effects
like field reordering (possible problems cracker classes) or using ebp as normal register (broken
      stack traces from dump_stack)
    + niln is also valid in a cse domain
    * parameters passed by reference shall have a complexity >1
    * load nodes from outer scopes shall have a complexity >1
    * better cse debugging
    + more node types added to cse
    * consider parameters passed by reference in cse
    * take care of cse in parameters in simple cases

git-svn-id: trunk@22050 -
2012-08-09 18:58:54 +00:00
florian
03071709a9 * the transformation (a or/and b) or/and c into a or/and (b or/and c) can be applied for booleans as well
git-svn-id: trunk@22041 -
2012-08-08 21:21:45 +00:00
florian
b330bba0bc + introduce -Oofastmath
* limit the application of the tree transformation introduced in r21986 to safe cases and -Oofastmath

git-svn-id: trunk@22040 -
2012-08-08 19:35:45 +00:00
florian
b20c4cfe87 * replace is_written by using actualtargetnode
git-svn-id: trunk@22022 -
2012-08-06 20:26:23 +00:00
florian
405a80066e + cse across assignment operator fixed and enabled
git-svn-id: trunk@22017 -
2012-08-05 20:37:18 +00:00
florian
562a45f2e1 * try to transform the tree to be able to do better cse
git-svn-id: trunk@21986 -
2012-07-29 21:29:07 +00:00
florian
a27cc3e5f2 + be able to handle CSE's of records/arrays/objects
* consider static array/records/object variables during CSE determination on non x86 CPUs

git-svn-id: trunk@21985 -
2012-07-29 17:17:12 +00:00