From 66e97549b994355665ed7e609aaca28c7a2bfd9e Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 17 Apr 2015 20:14:18 +0000 Subject: [PATCH] * replace jmp by rjmp if possible, resolves issue #27885 git-svn-id: trunk@30632 - --- compiler/avr/aasmcpu.pas | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/compiler/avr/aasmcpu.pas b/compiler/avr/aasmcpu.pas index 9abb8e64b1..fd5fca42ce 100644 --- a/compiler/avr/aasmcpu.pas +++ b/compiler/avr/aasmcpu.pas @@ -449,7 +449,17 @@ implementation taicpu(curtai).oper[0]^.ref^.symbol:=l; taicpu(curtai).condition:=inverse_cond(taicpu(curtai).condition); again:=true; + end + { replace JMP by RJMP? } + else if (curtai.typ=ait_instruction) and + (taicpu(curtai).opcode=A_JMP) and + (taicpu(curtai).InsOffset-taicpu(curtai).oper[0]^.ref^.symbol.offset<=2048) and + (taicpu(curtai).InsOffset-taicpu(curtai).oper[0]^.ref^.symbol.offset>=-2047) then + begin + taicpu(curtai).opcode:=A_RJMP; + again:=true; end; + curtai:=tai(curtai.next); end; end;