* This patch makes some minor improvements to the cross-platform code that deals with jump optimisations.
More specifically, it attempts to do more in a single pass which has the nice side-effect of
fixing a couple of minor mistakes (in some situations, it would erroneously remove an alignment entry).
- Most improvements are with dealing with Jcc/JMP pairs and their equivalents on other platforms, by
collapsing label clusters and stripping dead code as soon as it has enough information to do so, and being
more intelligent before calling Continue to see if another optimisation can be performed in the same sitting.
- RemoveDeadCodeAfterJump is now a function that returns True if a jump was found among the dead code,
thus allowing the ability to flag the peephole optimizer for another iteration of Pass 1 - the
destination label may have appeared earlier in the code and become dead as a result of the removal
of the jump, thus opening up new optimisations with instructions that sat either side of the label.
- Preliminary tests show that it does sometimes reduce the number of passes required to optimise a subroutine
under -O3.
git-svn-id: trunk@43668 -
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 -
+ 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 -
* TAOptObj.CollapseZeroDistJump: Change hp1 to local variable,
initialized as p.next, to avoid problems of dangling pointers
revealed by use of "-CriotR -O2" compilation arguments.
git-svn-id: trunk@43554 -
* disable matching volatile references in the assembler optimisers, so they
can't be removed (more conservative than needed, but better than removing
too many)
o the CSE optimiser will ignore them by default, because they're an unknown
inline node for it
* also removed no longer used fpc_in_move_x and fpc_in_fillchar_x inline node
identifiers from rtl/inc/innr.inc, and placed fpc_in_unaligned_x at the
right place
git-svn-id: trunk@40465 -
Fix float loading.
Fix a number of small issues with wrong operand sizes.
Fixed concatcopy code generation.
Align jump table for case statements.
git-svn-id: branches/laksen/riscv_new@39481 -
for x86 instructions, entered via inline assembler, using intel syntax
(the low level optimizer isn't normally run on them, so it doesn't matter that
InstructionLoadsFromReg and similar functions don't work on them, but with
-dDEBUG_INSTRUCTIONREGISTERDEPENDENCIES it is much more convenient for
debugging purposes to have correct data for them, because you can enter
instructions manually and see how these functions behave)
git-svn-id: trunk@36065 -
adds instruction register usage info to the assembly output (only register
reads for now, but register writes will also be added later). Useful for
debugging InstructionLoadsFromReg and other similar functions.
git-svn-id: trunk@35967 -
* updated TAOptObj.RegUsedAfterInstruction with the arm implementation and removed the arm specific implementation
* RegLoadedWithNewValue and InstructionLoadsFromReg are now a methods of TAoptBase
* moved RegEndOfLife to TAOptObj
* during this refactoring, fixed also TCpuAsmOptimizer.RegLoadedWithNewValue for arm regarding post/preindexed
memory references: those modify the register but do not load it with a new value in the sense of RegLoadedWithNewValue
git-svn-id: trunk@33000 -
- Renamed IsJumpToLabel() to IsJumpToLabelUncond() to avoid confusions.
- Added IsJumpToLabel() to check for any jump to a label.
- Added comments.
git-svn-id: trunk@32114 -