Переглянути джерело

* replace jmp by rjmp if possible, resolves issue #27885

git-svn-id: trunk@30632 -
florian 10 роки тому
батько
коміт
66e97549b9
1 змінених файлів з 10 додано та 0 видалено
  1. 10 0
      compiler/avr/aasmcpu.pas

+ 10 - 0
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;