Browse Source

+ RCallReg2RJmp optimization

git-svn-id: trunk@38318 -
florian 7 years ago
parent
commit
5b16a84de1
1 changed files with 14 additions and 0 deletions
  1. 14 0
      compiler/avr/aoptcpu.pas

+ 14 - 0
compiler/avr/aoptcpu.pas

@@ -701,6 +701,20 @@ Implementation
                        asml.Remove(hp1);
                        hp1.Free;
 
+                       result:=true;
+                    end;
+                A_RCALL:
+                  if (cs_opt_level4 in current_settings.optimizerswitches) and
+                    GetNextInstruction(p,hp1) and
+                    MatchInstruction(hp1,A_RET) then
+                    begin
+                       DebugMsg('Peephole RCallReg2RJmp performed', p);
+
+                       taicpu(p).opcode:=A_RJMP;
+
+                       asml.Remove(hp1);
+                       hp1.Free;
+
                        result:=true;
                     end;
                 A_MOV: