- Handle jump optimizations on RISC-V

git-svn-id: trunk@43933 -
This commit is contained in:
Jeppe Johansen 2020-01-13 22:42:39 +00:00
parent 931d4dcfee
commit 7cfb87b325

View File

@ -1606,8 +1606,8 @@ Unit AoptObj;
procedure TAOptObj.MakeUnconditional(p: taicpu); procedure TAOptObj.MakeUnconditional(p: taicpu);
begin begin
{ TODO: If anyone can improve this particular optimisation to work on { TODO: If anyone can improve this particular optimisation to work on
AVR and RISC-V, please do (it's currently not called at all). [Kit] } AVR, please do (it's currently not called at all). [Kit] }
{$if not defined(avr) and not defined(riscv32) and not defined(riscv64)} {$if not defined(avr)}
{$if defined(powerpc) or defined(powerpc64)} {$if defined(powerpc) or defined(powerpc64)}
p.condition.cond := C_None; p.condition.cond := C_None;
p.condition.simple := True; p.condition.simple := True;
@ -1615,7 +1615,12 @@ Unit AoptObj;
p.condition := C_None; p.condition := C_None;
{$endif powerpc} {$endif powerpc}
p.opcode := aopt_uncondjmp; p.opcode := aopt_uncondjmp;
{$endif not avr and not riscv} {$ifdef RISCV}
p.loadoper(1, p.oper[p.ops-1]^);
p.loadreg(0, NR_X0);
p.ops:=2;
{$endif}
{$endif not avr}
end; end;
@ -2086,12 +2091,12 @@ Unit AoptObj;
Result := True; Result := True;
Exit; Exit;
{$if not defined(avr) and not defined(riscv32) and not defined(riscv64)} {$if not defined(avr)}
end end
else else
{ NOTE: There is currently no watertight, cross-platform way to create { NOTE: There is currently no watertight, cross-platform way to create
an unconditional jump without access to the cg object. If anyone can an unconditional jump without access to the cg object. If anyone can
improve this particular optimisation to work on AVR and RISC-V, improve this particular optimisation to work on AVR,
please do. [Kit] } please do. [Kit] }
begin begin
{ Since cond1 is a subset of inv(cond2), jmp<cond2> will always branch if { Since cond1 is a subset of inv(cond2), jmp<cond2> will always branch if