* 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 -
This commit is contained in:
florian 2012-06-07 18:20:35 +00:00
parent 9636202165
commit 5b02a7cb9b

View File

@ -190,10 +190,13 @@ Implementation
begin
AllUsedRegs[getregtype(reg)].Update(tai(p.Next));
RegUsedAfterInstruction :=
(AllUsedRegs[getregtype(reg)].IsUsed(reg)) and
(not(getNextInstruction(p,p)) or
instructionLoadsFromReg(reg,p) or
not(regLoadedWithNewValue(reg,p)));
AllUsedRegs[getregtype(reg)].IsUsed(reg) and
not(regLoadedWithNewValue(reg,p)) and
(
not(GetNextInstruction(p,p)) or
instructionLoadsFromReg(reg,p) or
not(regLoadedWithNewValue(reg,p))
);
end;
procedure TCpuAsmOptimizer.RemoveSuperfluousMove(const p: tai; movp: tai; const optimizer: string);