mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 20:09:18 +02:00
Added LdrbAnd2Ldrb Peephole optimizer for arm
Changes the following code: ldrb dst1, [REF] and dst2, dst1, #255 # dealloc dst1 to ldrb dst2, [REF] git-svn-id: trunk@24672 -
This commit is contained in:
parent
10b3ce1ba5
commit
8c32802fcf
@ -670,6 +670,30 @@ Implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
Change
|
||||||
|
|
||||||
|
ldrb dst1, [REF]
|
||||||
|
and dst2, dst1, #255
|
||||||
|
|
||||||
|
into
|
||||||
|
|
||||||
|
ldrb dst2, [ref]
|
||||||
|
}
|
||||||
|
if (taicpu(p).oppostfix=PF_B) and
|
||||||
|
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
|
||||||
|
MatchInstruction(hp1, A_AND, [taicpu(p).condition], [PF_NONE]) and
|
||||||
|
(taicpu(hp1).oper[1]^.reg = taicpu(p).oper[0]^.reg) and
|
||||||
|
(taicpu(hp1).oper[2]^.typ = top_const) and
|
||||||
|
(taicpu(hp1).oper[2]^.val = $FF) and
|
||||||
|
not(RegUsedBetween(taicpu(hp1).oper[0]^.reg, p, hp1)) and
|
||||||
|
RegEndOfLife(taicpu(p).oper[0]^.reg, taicpu(hp1)) then
|
||||||
|
begin
|
||||||
|
DebugMsg('Peephole LdrbAnd2Ldrb done', p);
|
||||||
|
taicpu(p).oper[0]^.reg := taicpu(hp1).oper[0]^.reg;
|
||||||
|
asml.remove(hp1);
|
||||||
|
hp1.free;
|
||||||
|
end;
|
||||||
LookForPostindexedPattern(taicpu(p));
|
LookForPostindexedPattern(taicpu(p));
|
||||||
{ Remove superfluous mov after ldr
|
{ Remove superfluous mov after ldr
|
||||||
changes
|
changes
|
||||||
|
Loading…
Reference in New Issue
Block a user