Commit Graph

143 Commits

Author SHA1 Message Date
florian
03a30ff036 * patch by Nico Erfurth: Remove STRH and STRB from instructionLoadsFromReg
STRH and STRB are not handled as sperate instructions by the code
generator.

git-svn-id: trunk@21570 -
2012-06-09 17:26:06 +00:00
florian
7599de416d * patch by Nico Erfurth: Reworked MatchOperand in ARM Peephole Optimizers
Added top_ref comperator which uses RefsEqual.
Reworked the code for easier readability by using a case statement.

git-svn-id: trunk@21569 -
2012-06-09 17:25:32 +00:00
florian
6e8594a9af * patch by Nico Erfurth: Minor fix for FoldShiftProcess peephole optimizer on ARM
Use UpdateUsedRegs and drop the check for reloading of the register, as
this is done in RegUsedAfterInstruction now.

git-svn-id: trunk@21520 -
2012-06-07 18:21:46 +00:00
florian
5b02a7cb9b * patch by Nico Erfurth: Check for register reloading in RegUsedAfterInstruction on ARM
This slightly changes the semantics of RegUsedAfterInstruction.
We now check if the `current value` of the register will be used later.
It will do `the right thing` for all the normal use cases.

git-svn-id: trunk@21519 -
2012-06-07 18:20:35 +00:00
florian
8cae4c9f23 * patch by Nico Erfurth: Fix for MovStrMov Peephole optimizer on ARM
The loop checked for the wrong instruction for .opcode = A_STR. Making
the whole optimizer non functional but at least not destructive.

git-svn-id: trunk@21508 -
2012-06-06 19:44:20 +00:00
florian
83fb4c289d * patch by Nico Erfurth: Implement FoldShiftProcess Peephole optimizer for ARM
This optimizer folds shift/roll operations into following data
instructions.

It will change code like:

mov r0, r0, lsl #16
add r1, r0, r1

into

add r1, r1, r0, lsl #16

Source registers will be reordered when necessary, also SUB/SBC will be
replaced with RSB/RSC and vice versa when reordering is required.

It could be expanded to support more operations like LDR/STR.

git-svn-id: trunk@21507 -
2012-06-06 19:43:36 +00:00
florian
5393efb128 * patch by Nico Erfurth: Support A_MOV and A_MVN in RedundantMovProcess
This changes the ARM Peephole optimizer RedundantMovProcess to also
recognize and modify something like the following sequence.

mov r0, r1
mov r0, r0, lsl #8

this would be changed into

mov r0, r1, lsl #8

git-svn-id: trunk@21506 -
2012-06-06 19:43:05 +00:00
florian
3ae5fc8c04 * patch by Nico Erfurth: adds a check for SM_ASR to also support removal of unnecessary sign extension before STRH.
git-svn-id: trunk@21446 -
2012-05-31 20:24:48 +00:00
florian
4f273aa08d * patch by Nico Erfurth: Handle STR*/LDR* properly in ARM Peephole optimizers
git-svn-id: trunk@21444 -
2012-05-31 17:00:19 +00:00
florian
fbc77b74c2 * patch by Nico Erfurth to remove superfluouse moves
git-svn-id: trunk@21422 -
2012-05-28 21:58:06 +00:00
florian
c348b6f2cc * patch by Nico Erfurth:
- Support MLA and MUL in DataMov2Data
- SMLAL and UMLAL are also reading from oper[0]
- UMLAL, UMULL, SMLAL and SMULL are writing to oper[1]

git-svn-id: trunk@21421 -
2012-05-28 18:11:31 +00:00
florian
9e180fb318 * remove unneeded zero extensions from 16 to 32 Bit
git-svn-id: trunk@21404 -
2012-05-28 07:21:27 +00:00
florian
05a8783b1e * patch by Nico Erfurth:
Improve ARM-Peephole Optimizers

1.) Introduce a ARM-specific RegUsedAfterInstruction which analyzes
instructions and reg allocation information to see if a register is
really needed afterwards to decide if some special optimizations can be
done.

2.) Introduce "RemoveSuperfluousMove"
This tries to fold mov into a previous Data-Instruction (ADD, ORR, etc)
or LDR-Instruction.

3.) Introduce new Optimizer "DataMov2Data" and modify LdrMov2Ldr to use
RemoveSuperfluousMove

4.) Expand Ldr* and Str* Optimizers to also work on {Ldr,Str}{,b,h}

git-svn-id: trunk@21314 -
2012-05-17 08:31:44 +00:00
florian
748694a325 * fixes some issues with reg. allocation information
git-svn-id: trunk@21303 -
2012-05-15 18:06:41 +00:00
florian
2959d596f9 * patch by Nico Erfurth: Remove superfluous mov from MovStrMov sequences
git-svn-id: trunk@21067 -
2012-04-26 20:31:13 +00:00
florian
aa2a9dbf2e patches by Nico Erfurth to improve the arm peephole optimizer:
* Introduce MatchInstruction and MatchOperand

MatchInstruction allows to match an instruction by condition and
oppostfix. MatchOperand checks if an operand is a register and matches
another operand. In the future this could be overloaded with other
versions not only accepting TRegister.

* Optimize cmp,moveq,movne sequence on ARM

This patch implements an peephole optimizer for the following sequence:

  cmp   reg,const1
  movne reg,const2
  moveq reg,const1

* Small improvements to the ARM peephole optimizer

Most instructions in the ARM ISA have taicpu(p).oper[0]^.typ = top_reg
as the only option, so there is no need to check for it if we're
looking at those instructions.

* Remove redundant mov instructions on ARM

This is an addition to the ARM PeepHole Optimizer.
It folds code like this:

mov reg1, reg2
add reg1, reg1, (const|reg)

git-svn-id: trunk@21024 -
2012-04-24 18:25:19 +00:00
florian
c5445399c6 * take care also of reg. allocation information after the current instruction when moving it
git-svn-id: trunk@20709 -
2012-04-05 14:21:41 +00:00
florian
9867f34398 * the arm rescheduler has not only to move instructions but also associated register allocations
git-svn-id: trunk@20707 -
2012-04-04 21:21:52 +00:00
florian
38d3a081f6 * update of TODOs
git-svn-id: trunk@20513 -
2012-03-11 20:12:46 +00:00
florian
0fe22a358b + first version of ldr instruction scheduler on arm
git-svn-id: trunk@20512 -
2012-03-11 19:10:58 +00:00
florian
9c6e3d317a * reenabled ldr/ldr and ldr/str optimization
git-svn-id: trunk@20497 -
2012-03-10 17:09:42 +00:00
florian
b4907578b0 * temporarily disable LDR/LDR STR/LDR optimizations, let's see if this broke regression testing on fpcarm
git-svn-id: trunk@20473 -
2012-03-04 20:37:06 +00:00
florian
fdfb9a3fba * take care of conditions when doing ldr/str optimizations
git-svn-id: trunk@20428 -
2012-02-25 21:04:28 +00:00
florian
bb2df48aa9 - <op> ....; cmp ...,#0 cmps ... optimization deactivated
* optimize ldr/ldr if possible

git-svn-id: trunk@20416 -
2012-02-23 21:29:22 +00:00
florian
e2c9a8c6a1 * fold <arithmed. op> ...; cmp ...,#0into cmps on arm
* remove unnecessary ldr after str to the same memoy location, however, to do this optimization safely, we should add support for volatile variables

git-svn-id: trunk@20399 -
2012-02-22 20:16:06 +00:00
Jonas Maebe
852ae48cb7 * also use blx instead of bl for direct calls on ARMv5+, since the target
may be thumb(2) (mantis #19896)
  * don't conditionalize "blx <imm target>", because that's not a valid
    encoding

git-svn-id: trunk@18984 -
2011-09-05 20:33:15 +00:00
florian
515774b864 * merged armthum branch
-- Zusammenführen der Unterschiede zwischen Projektarchiv-URLs in ».«:
U    rtl/arm/setjump.inc
A    rtl/arm/thumb2.inc
U    rtl/arm/divide.inc
A    rtl/embedded/arm/stm32f103.pp
U    rtl/inc/system.inc
U    compiler/alpha/cgcpu.pas
U    compiler/sparc/cgcpu.pas
U    compiler/i386/cgcpu.pas
U    compiler/ncgld.pas
U    compiler/powerpc/cgcpu.pas
U    compiler/avr/cgcpu.pas
U    compiler/aggas.pas
U    compiler/powerpc64/cgcpu.pas
U    compiler/x86_64/cgcpu.pas
U    compiler/cgobj.pas
U    compiler/psystem.pas
U    compiler/aasmtai.pas
U    compiler/m68k/cgcpu.pas
U    compiler/ncgutil.pas
U    compiler/rautils.pas
U    compiler/arm/raarmgas.pas
U    compiler/arm/armatts.inc
U    compiler/arm/cgcpu.pas
U    compiler/arm/armins.dat
U    compiler/arm/rgcpu.pas
U    compiler/arm/cpubase.pas
U    compiler/arm/agarmgas.pas
U    compiler/arm/cpuinfo.pas
U    compiler/arm/armop.inc
U    compiler/arm/narmadd.pas
U    compiler/arm/aoptcpu.pas
U    compiler/arm/armatt.inc
U    compiler/arm/aasmcpu.pas
U    compiler/systems/t_embed.pas
U    compiler/psub.pas
U    compiler/options.pas

git-svn-id: trunk@13801 -
2009-10-04 09:03:44 +00:00
florian
91dcb722a2 + optimization of sequential ands
git-svn-id: trunk@12806 -
2009-02-27 12:59:08 +00:00
florian
66e015f48c * avoid shifter constant overflow on arm when optimizing two shifter operations into one
git-svn-id: trunk@11474 -
2008-07-28 15:51:58 +00:00
yury
2829f4e46f * Fixed arm optimizer bug (mantis #9209). No testsuite regressions with -O2.
* Removed unused local vars.
+ test.

git-svn-id: trunk@7970 -
2007-07-06 13:09:28 +00:00
florian
c5d8e53758 * last commit fixed
git-svn-id: trunk@6338 -
2007-02-04 18:50:22 +00:00
florian
3609ddc5dd * more MustBeLast fixes
* const insertation algorithm fixed

git-svn-id: trunk@6337 -
2007-02-04 18:45:43 +00:00
florian
8d33f640d4 * stop conditional optimization at mov pc,...
git-svn-id: trunk@6321 -
2007-02-03 17:40:32 +00:00
florian
d09295b686 * shift folding
git-svn-id: trunk@6312 -
2007-02-02 23:12:08 +00:00
florian
1e1f711663 * instructions being already conditional can't be marked as conditional again
git-svn-id: trunk@5394 -
2006-11-15 22:42:22 +00:00
florian
84f0b62f93 * cond. instruction optimization enabled
git-svn-id: trunk@5393 -
2006-11-15 21:59:29 +00:00
florian
4010d66c2c * arm cond. instruction support
git-svn-id: trunk@5387 -
2006-11-14 22:37:22 +00:00
florian
0308048768 * fixed compilation
git-svn-id: trunk@1418 -
2005-10-16 14:12:30 +00:00
Jonas Maebe
ab3bc45fa4 * cpu-specific overrides of optimizer methods now get called
+ first simple rlwinm optimization for ppc

git-svn-id: trunk@1320 -
2005-10-07 21:44:00 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
florian
2b67164568 * optimizer files fixed 2005-02-20 19:36:03 +00:00
florian
871fd8d2b8 * initial commit 2005-02-20 19:11:04 +00:00