Commit Graph

1762 Commits

Author SHA1 Message Date
florian
e7d2c93ca7 * patch by J. Gareth Moreton: deadstore removal improvement, resolves #36669
git-svn-id: trunk@44147 -
2020-02-10 20:48:45 +00:00
florian
12d015a935 * patch by J. Gareth Moreton: CMOV extensions: frame/stack pointer relative references are always valid, resolves #36675
git-svn-id: trunk@44141 -
2020-02-09 17:39:50 +00:00
florian
bbcbd4eae1 * patch by J. Gareth Moreton, avoid illegal MovAdd2Lea and MovSub2Lea optimziations, resolves #36630
git-svn-id: trunk@44101 -
2020-02-02 19:49:47 +00:00
florian
2ea35e55b1 * patch by J. Gareth Moreton: x86 "OptPass1MOV" improvements - Part 2, resolves #36608
git-svn-id: trunk@44086 -
2020-02-01 21:31:56 +00:00
florian
43c83b3ae6 * improve LeaLea2Lea optimization
git-svn-id: trunk@44058 -
2020-01-29 21:35:26 +00:00
yury
1b3a3a7983 * Removed lot of unused local vars. It is useful to turn on the notes in options. :)
git-svn-id: trunk@44053 -
2020-01-28 18:45:33 +00:00
florian
993144b91b * patch by J. Gareth Moreton: x86 SUB and LEA optimisations, resolves #36622
git-svn-id: trunk@44030 -
2020-01-24 21:10:17 +00:00
florian
a807e18591 * patch by J. Gareth Moreton: x86 CMP/TEST/Jcc optimisations, resolves #36624
git-svn-id: trunk@44029 -
2020-01-24 20:41:11 +00:00
florian
16152cf948 * patch by J. Gareth Moreton: get rid of another pass through the assembler list by integrating OptReferences
into the post optimizer pass

git-svn-id: trunk@44001 -
2020-01-19 20:11:05 +00:00
florian
70a836c4a2 * first part of merging parts of Jeppe's intrinsics patch, mainly r31135
is merged by this commit with a lot of adaptions

git-svn-id: trunk@43949 -
2020-01-14 21:52:39 +00:00
florian
5a1e6c2e91 * compilation on i386 fixed
git-svn-id: trunk@43920 -
2020-01-12 12:00:44 +00:00
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
11287f018f * explicitly emit a sub instruction in tx86inlinenode.second_high, resolves #36530
git-svn-id: trunk@43888 -
2020-01-07 21:46:07 +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
fca4d3315b * let the operation do the type conversion for x87 floating point operations
git-svn-id: trunk@43867 -
2020-01-05 17:47:23 +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
a34ae2261a * copy fpu parameters using fld/fst onto the stack
git-svn-id: trunk@43861 -
2020-01-04 22:19:15 +00:00
florian
b7c6e01b03 * cleaning up tcgsize: it makes no sense to declare every combination and type
the different vector types must be either handled in the high level cg or
    by using the shuffle parameter

git-svn-id: trunk@43860 -
2020-01-04 21:54:53 +00:00
florian
73c6cab096 + MovMovMov2XChg optimization by J. Gareth Moreton
git-svn-id: trunk@43858 -
2020-01-04 14:24:28 +00:00
florian
3c16324f80 * x86: avoid to put variables into registers if they are handled by the x87-FPU
git-svn-id: trunk@43856 -
2020-01-03 22:23:49 +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
Jonas Maebe
9bd33f7a45 + support for LLVM metadata constant string parameters
o they are implemented as a new metadata register class, whereby the
     subregister indicates the metadata type (currently always a string)
     and the superregister is an index in the metadata array (which
     contains the strings). LLVM metadata can only be passed as parameters
     to intrinsics in bitcode, so moves of metadata into other registers
     triggers internal errors and when moving them into parameters, we
     replace the parameter's register with the metadata register (and look
     up the corresponding string when writing out the bitcode)

git-svn-id: trunk@43816 -
2019-12-30 15:04:57 +00:00
florian
f7a052f884 + inline high(<dyn. array>), resolves #28536
git-svn-id: trunk@43808 -
2019-12-28 21:38:38 +00:00
Jonas Maebe
1a9e246c29 * added is_normal_fieldvarsym() helper and use it
o fixes several places where there was a check whether something is a
     fieldvarsym, but not whether it's an instance rather than a class field

git-svn-id: trunk@43786 -
2019-12-24 22:12:44 +00:00
Jonas Maebe
1e3f72403e * renamed getintparaloc to getcgtempparaloc
o it can be used for more than integer parameters

git-svn-id: trunk@43781 -
2019-12-24 22:12:25 +00:00
florian
b8b5d84108 * missing +')' added
git-svn-id: trunk@43707 -
2019-12-22 20:41:48 +00:00
florian
30927039a6 + MULX instruction
* change information for RORX corrected

git-svn-id: trunk@43705 -
2019-12-21 16:20:09 +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
svenbarth
f4d96906c2 * reference FPC_ABSMASK_SINGLE/-DOUBLE using the indirect symbol if required for dynamic packages
git-svn-id: trunk@43536 -
2019-11-21 21:44:22 +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
91f3f022fe * MM registers which might not be changed can be still used in 3 op mathematical operations as source
git-svn-id: trunk@43509 -
2019-11-17 14:48:45 +00:00