Răsfoiți Sursa

* convert jmp into rjmp only of the target is not a function

git-svn-id: trunk@34936 -
florian 8 ani în urmă
părinte
comite
3eef641833
1 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 4 1
      compiler/avr/aasmcpu.pas

+ 4 - 1
compiler/avr/aasmcpu.pas

@@ -457,7 +457,10 @@ implementation
                         { replace JMP by RJMP? ...
                           ... but do not mess with asm block }
                         if not(inasmblock) 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
+                        (taicpu(curtai).InsOffset-taicpu(curtai).oper[0]^.ref^.symbol.offset>=-2047) and
+                        { jmps to function go outside the currently considered scope, so do not mess with them.
+                          Those are generated by the peephole optimizer from call/ret sequences }
+                        not(taicpu(curtai).oper[0]^.ref^.symbol.typ=AT_FUNCTION) then
                         begin
                           taicpu(curtai).opcode:=A_RJMP;
                           again:=true;