Browse Source

+ optimize LDS/STS into IN/OUT, resolves issue #27884

git-svn-id: trunk@30649 -
florian 10 years ago
parent
commit
987b66636d
1 changed files with 24 additions and 0 deletions
  1. 24 0
      compiler/avr/aoptcpu.pas

+ 24 - 0
compiler/avr/aoptcpu.pas

@@ -129,6 +129,30 @@ Implementation
                       result:=true;
                     end;
                 end;
+              A_STS:
+                if (taicpu(p).oper[0]^.ref^.symbol=nil) and
+                  (taicpu(p).oper[0]^.ref^.relsymbol=nil) and
+                  (getsupreg(taicpu(p).oper[0]^.ref^.base)=RS_NO) and
+                  (getsupreg(taicpu(p).oper[0]^.ref^.index)=RS_NO) and
+                  (taicpu(p).oper[0]^.ref^.addressmode=AM_UNCHANGED) and
+                  (taicpu(p).oper[0]^.ref^.offset>=32) and
+                  (taicpu(p).oper[0]^.ref^.offset<=95) then
+                  begin
+                    taicpu(p).opcode:=A_OUT;
+                    taicpu(p).loadconst(0,taicpu(p).oper[0]^.ref^.offset-32);
+                  end;
+              A_LDS:
+                if (taicpu(p).oper[1]^.ref^.symbol=nil) and
+                  (taicpu(p).oper[1]^.ref^.relsymbol=nil) and
+                  (getsupreg(taicpu(p).oper[1]^.ref^.base)=RS_NO) and
+                  (getsupreg(taicpu(p).oper[1]^.ref^.index)=RS_NO) and
+                  (taicpu(p).oper[1]^.ref^.addressmode=AM_UNCHANGED) and
+                  (taicpu(p).oper[1]^.ref^.offset>=32) and
+                  (taicpu(p).oper[1]^.ref^.offset<=95) then
+                  begin
+                    taicpu(p).opcode:=A_IN;
+                    taicpu(p).loadconst(1,taicpu(p).oper[1]^.ref^.offset-32);
+                  end;
               A_CLR:
                 begin
                   { turn the common