Commit Graph

159 Commits

Author SHA1 Message Date
florian
2b70c64d09 * patch by J. Gareth Moreton: Some cleaning up of OptPass2JMP and OptPass2MOV, resolves #36553
git-svn-id: trunk@43919 -
2020-01-12 10:33:21 +00:00
florian
124c64152d * patch by J. Gareth Moreton: EAX -> EDX:EAX sign extension shortcuts, and MOVSX shortcuts for AX register, part 2 of #36551
git-svn-id: trunk@43918 -
2020-01-12 09:20:01 +00:00
florian
236c11ef71 * patch by J. Gareth Moreton: EAX -> EDX:EAX sign extension shortcuts, and MOVSX shortcuts for AX register, part 1 of #36551
git-svn-id: trunk@43917 -
2020-01-12 09:20:00 +00:00
florian
3dd6a8e24e * add forgotten exits, fixes r43874
git-svn-id: trunk@43877 -
2020-01-06 19:53:43 +00:00
florian
92671c9b85 o patch by J. Gareth Moreton:
* applies some optimisations to OptPass1MOV. Repeated checks to the "GetNextInstruction_p Boolean"
      variable are factored out, since all of the optimisations bar the first one require a
      succeeding instruction.

git-svn-id: trunk@43875 -
2020-01-06 17:05:48 +00:00
florian
9b68c7a5f5 * fix X86AsmOptimizer.RegModifiedByInstruction for VMOVSS/VMOVSD/IMUL
git-svn-id: trunk@43874 -
2020-01-06 17:05:47 +00:00
florian
76e7833a20 * avoid invalid type cast
git-svn-id: trunk@43865 -
2020-01-05 15:43:04 +00:00
florian
d3f3f81e16 * fixes TX86AsmOptimizer.OptPass1_V_MOVAP after r43855
git-svn-id: trunk@43864 -
2020-01-05 15:43:03 +00:00
florian
22cb46fca9 * cleanup
git-svn-id: trunk@43863 -
2020-01-05 15:43:02 +00:00
florian
73c6cab096 + MovMovMov2XChg optimization by J. Gareth Moreton
git-svn-id: trunk@43858 -
2020-01-04 14:24:28 +00:00
florian
7da6bac960 * look further forward in TX86AsmOptimizer.OptPass1_V_MOVAP
git-svn-id: trunk@43855 -
2020-01-03 22:23:07 +00:00
florian
451afd6e45 * triggered by #36505, removed CmpJxxDecJmp2SubJcc optimization as it was wrong anyways
git-svn-id: trunk@43852 -
2020-01-03 19:15:12 +00:00
florian
b8b5d84108 * missing +')' added
git-svn-id: trunk@43707 -
2019-12-22 20:41:48 +00:00
florian
5f2410b871 * patch by J. Gareth Moreton to fix an ie 2018061400 on darwin
git-svn-id: trunk@43694 -
2019-12-16 21:15:57 +00:00
florian
ef7e4f6f62 * fix J. Gareth Moreton to resolve #36389
git-svn-id: trunk@43670 -
2019-12-09 22:00:45 +00:00
florian
b8a78b135c * simplified and improved TX86AsmOptimizer.RegModifiedByInstruction
git-svn-id: trunk@43623 -
2019-12-01 22:15:48 +00:00
florian
4525edd9f7 * patch by J. Gareth Moreton: x86 implementation of RegModifiedByInstruction, resolves #36376
git-svn-id: trunk@43611 -
2019-11-29 21:57:53 +00:00
florian
7000d82dcd * do not convert cmp 0,... into test ...,... before the post pass of the peephole optimizer
as this conversion might result in missing further optimizer opportunities

git-svn-id: trunk@43596 -
2019-11-26 22:09:34 +00:00
florian
7e6eeebdf0 o patch by J. Gareth Moreton, seeks to improve maintainability, safety and efficiency
in the peephole optimizer by slightly modifying some function headers based
    on their intended purpose, resolves #36353
    * Non-virtual methods and class methods that don't need to access any fields from
      the current object are now static methods, thus removing the hidden "Self"
      parameter and reducing overhead. This includes a large number of
      frequently-used functions such as SkipEntryExitMarker and SuperRegistersEqual.
    * GetNextInstruction, GetLastInstruction, SkipEntryExitMarker and
      SkipLabels have had their 'var' parameter changed to an 'out' parameter because
      they shouldn't depend on its input value. This will cause the compiler to throw warnings
      if you start using the value without initialising it first, and may open up optimisation
      opportunities in the future (e.g. storing written values in a temporary register
      and only writing it to the actual variable when the routine exits).

git-svn-id: trunk@43595 -
2019-11-26 22:09:33 +00:00
florian
cf0716123c * avoid overflow error
git-svn-id: trunk@43593 -
2019-11-26 19:39:04 +00:00
florian
af107ca8fe o patch by J. Gareth Moreton, resolves #36355
+ This patch serves to extend the JMP -> RET optimisation in OptPass2JMP by also doing the same
      for JMP -> MOV/RET, since there are often cases where the result (e.g. EAX) is set just
      prior to the function exiting.
    * RemoveDeadCodeAfterJump will now drop out if it detects SEH information -
      this stops exception information from being stripped if it is called on the final RET instruction.

git-svn-id: trunk@43592 -
2019-11-25 21:15:41 +00:00
florian
c6116258fd o patch by J. Gareth Moreton:
* adds an extra optimisation to "PostPeepholeOptMov" in compiler/x86/aoptx86.pas:
      If the instruction "MOV REG, -1" (Intel notation) is found, where REG is either
      a 32- or 64-bit register, it is changed to "OR REG, -1" instead.
      The effect is the same and takes exactly the same speed to execute, but the encoding is much smaller.
      As it cause false data dependencies, it is only applied in -Os mode

      For 16-bit registers, only AX is optimised this way because it has its own encoding for OR that takes fewer bytes.

git-svn-id: trunk@43579 -
2019-11-24 20:26:02 +00:00
florian
94b728005d * more RemoveCurrentP usage
git-svn-id: trunk@43576 -
2019-11-24 19:51:04 +00:00
florian
d444f750f9 * factored out TX86AsmOptimizer.OptPass1Cmp
* fixed it
  * activated it for x86-64

git-svn-id: trunk@43574 -
2019-11-24 16:33:50 +00:00
florian
f5caa9940b * make use of RemoveCurrentP
git-svn-id: trunk@43532 -
2019-11-21 20:19:49 +00:00
pierre
ff415ba39c Fixes by Gareth Moreton for problems exposed by use of -CriotR option
git-svn-id: trunk@43529 -
2019-11-21 10:00:20 +00:00
florian
40c54e9d37 * do not generate conditional jump with full references
+ more assembler optimizer output

git-svn-id: trunk@43520 -
2019-11-20 22:12:27 +00:00
florian
6bed497c7c * be carefully with references using RIP when doing LeaOp2Op optimizations
git-svn-id: trunk@43460 -
2019-11-13 20:47:40 +00:00
florian
ae6b204c94 + added comments for LeaOp2Op
git-svn-id: trunk@43457 -
2019-11-12 22:10:01 +00:00
florian
7ee0ad4d63 + LeaOp2Op optimization
* replaced some manual removels of p by RemoveCurrentP calls

git-svn-id: trunk@43456 -
2019-11-12 22:04:23 +00:00
florian
5c0a5b73c7 * patch by J. Gareth Moreton: fix compilation with debug info after r43441 and friends, resolves #36299
git-svn-id: trunk@43455 -
2019-11-12 20:03:19 +00:00
florian
1d6e719e38 * improve ShlAddLeaSubIncDec2Lea to take care of foldable LEAs
git-svn-id: trunk@43453 -
2019-11-11 22:08:17 +00:00
florian
83a11c2a7d * patch by J. Gareth Moreton to clean up TX86AsmOptimizer.OptPass2Jcc, resolves #36295
git-svn-id: trunk@43452 -
2019-11-11 21:29:13 +00:00
florian
7464c88003 * fix and improve MovImul2Imul: we cannot insert the move target into imul if the imul is 64 bit and the mov 32 bit as
we cannot ensure that the upper 32 bits of the move target are really clear

git-svn-id: trunk@43447 -
2019-11-10 21:09:06 +00:00
florian
4b455600b8 * swapped decrefs and StripLabelFast as proposed by Gareth on the mailing list
git-svn-id: trunk@43445 -
2019-11-10 18:23:50 +00:00
florian
2d295a3816 * patch by J. Gareth Moreton, issue #36271, part 2: x86 specific rework of the jump optimizer
git-svn-id: trunk@43440 -
2019-11-10 16:11:39 +00:00
florian
20a47afe13 * more aggressive LeaCallLeaRet2Jmp
git-svn-id: trunk@43373 -
2019-11-02 22:37:31 +00:00
florian
1fc7667b3b + LeaCallLeaRet2Jmp
git-svn-id: trunk@43372 -
2019-11-02 22:37:30 +00:00
florian
6842c5784d * CallRet2Jmp works with PIC
git-svn-id: trunk@43371 -
2019-11-02 22:37:29 +00:00
florian
3487c34ed9 * unified TX86AsmOptimizer.OptPass1MOVAP and TX86AsmOptimizer.OptPass1VMOVAP
git-svn-id: trunk@43370 -
2019-11-02 18:48:23 +00:00
florian
f9530437c2 * fix i386 building
git-svn-id: trunk@43369 -
2019-11-02 18:34:53 +00:00
florian
c3ef42b164 * allow cmov with memory reference if it is a pure symbol or a rip relative symbol: as the symbol is
allocated within the image of the program, this should never cause a seg. fault, so it is save
    to use cmov with it

git-svn-id: trunk@43368 -
2019-11-02 18:09:11 +00:00
florian
172a4a999b + MovMov2Mov 6 and MovMov2Mov 7 optimization
git-svn-id: trunk@43339 -
2019-10-30 22:39:13 +00:00
florian
cfec725195 * clean up TX86AsmOptimizer.OptPass1MOV
git-svn-id: trunk@43336 -
2019-10-30 20:07:26 +00:00
florian
533a113885 + LeaCallLeaRet2Jmp optimization
git-svn-id: trunk@43178 -
2019-10-12 21:51:15 +00:00
florian
00c2fd4005 + x86: LeaLea2Lea optimization
git-svn-id: trunk@43177 -
2019-10-12 21:51:14 +00:00
pierre
af03c0208b Use tcgint typecast instead of aint, as it is the type of the second parameter of loadconst taicpu method
git-svn-id: trunk@42281 -
2019-06-25 04:24:56 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
florian
d657373933 * patch by J. Gareth Moreton which avoids that the optimizer causes reads of invalid memory, resolves #35187
git-svn-id: trunk@41667 -
2019-03-10 10:48:50 +00:00
florian
c7bb028d35 * factored out OptPass1FLD, used bx x86-64 now as well
- removed unused function

git-svn-id: trunk@41061 -
2019-01-24 20:10:29 +00:00