Commit Graph

13 Commits

Author SHA1 Message Date
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
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
nickysn
9853c4a2a3 + enabled the load-modify-store optimization for the double argument version
(i.e. shift/rotate by k) of sar, rol and ror with type conversion on i386 and
  x86_64.

git-svn-id: trunk@36755 -
2017-07-21 13:17:18 +00:00
nickysn
c8377d3bfc + enabled the load-modify-store optimization for the double argument version
(i.e. shift/rotate by k) of sar, rol and ror on i386 and x86_64. Only the case
  without any implicit type conversions is handled for now.

git-svn-id: trunk@36753 -
2017-07-20 14:09:25 +00:00
nickysn
e562926763 + implemented the load/modify/store optimization for i:=sar/rol/ror(i) when
there's a type conversion involved as well (e.g. uint32:=SarLongInt(unit32) ).
  This only works for signed<->unsigned conversions of equal size, due to the
  nature of the sar, rol and ror operations.

git-svn-id: trunk@36745 -
2017-07-18 13:48:35 +00:00
nickysn
cb0c947f37 + enabled the load-modify-store optimization for the single argument version
(i.e. shift/rotate by 1) of sar, rol and ror on i386 and x86_64.

git-svn-id: trunk@36739 -
2017-07-17 14:50:39 +00:00
Károly Balogh
dd01b7ca8b fix a typo to hopefully fix the build
git-svn-id: trunk@36312 -
2017-05-23 21:13:00 +00:00
nickysn
720ac63a28 + preserve the node fileinfo and verbosity properties from the previous
assignment node when applying the optloadmodifystore node transformations.
  This keeps the source line info intact in the -al asm output (and probably
  makes the optimization debugger friendly, although this isn't tested and not
  at all guaranteed for all the other -O3 level optimizations)

git-svn-id: trunk@36256 -
2017-05-19 15:40:48 +00:00
nickysn
751d47c568 + enable the optloadmodifystore optimization for statements such as "x:=x shl k"
and "x:=x shr k" (only enabled for i386 and x86_64 for now, since the other
  code generator backends are untested)

git-svn-id: trunk@36254 -
2017-05-19 15:21:38 +00:00
nickysn
a7ca75a4b6 * use current node's localswitches field for checking whether range and overflow
checking is on, when handling the inc/dec inline nodes, instead of using
  current_settings.localswitches
* when creating inline nodes in the optloadmodifystore optimization pass, copy
  localswitches from the node, that is being replaced, because otherwise,
  localswitches is copied from current_settings.localswitches at the time the
  new node is created, and that can already be in a different state, since
  optloadmodifystore is performed in a separate pass, after the current
  procedure has already been parsed and in this moment, it reflects the state
  of localswitches after the end of the procedure.
* these two fixes fix a bug, where an internalerror 2017032701 can happen, when
  compiling with -O3 code that turns on and off range/overflow checking in the
  middle of a procedure.

git-svn-id: trunk@36195 -
2017-05-12 14:07:13 +00:00
nickysn
1529aee506 + apply the "x:=k+x" / "x:=k [and/or/xor] x" optimization even when there are
two implicit type conversions, inserted by the compiler. This makes it work
  for smaller ints also (e.g. int16 and int8 on 32-bit platforms, etc.)

git-svn-id: trunk@36180 -
2017-05-11 15:27:11 +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
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