Przeglądaj źródła

* Xtensa: set is_jmp flag so branch optimization works

git-svn-id: trunk@46960 -
florian 4 lat temu
rodzic
commit
112f8a41ad
2 zmienionych plików z 12 dodań i 2 usunięć
  1. 7 2
      compiler/aoptobj.pas
  2. 5 0
      compiler/xtensa/cgcpu.pas

+ 7 - 2
compiler/aoptobj.pas

@@ -464,8 +464,8 @@ Unit AoptObj;
 
     function JumpTargetOp(ai: taicpu): poper; inline;
       begin
-{$if defined(MIPS) or defined(riscv64) or defined(riscv32)}
-        { MIPS or RiscV branches can have 1,2 or 3 operands, target label is the last one. }
+{$if defined(MIPS) or defined(riscv64) or defined(riscv32) or defined(xtensa)}
+        { MIPS, Xtensa or RiscV branches can have 1,2 or 3 operands, target label is the last one. }
         result:=ai.oper[ai.ops-1];
 {$elseif defined(SPARC64)}
         if ai.ops=2 then
@@ -1644,6 +1644,11 @@ Unit AoptObj;
         p.loadreg(0, NR_X0);
         p.ops:=2;
 {$endif}
+{$ifdef xtensa}
+        p.opcode := aopt_uncondjmp;
+        p.loadoper(0, p.oper[p.ops-1]^);
+        p.ops:=1;
+{$endif}
 {$endif not avr}
 {$ifdef mips}
         { MIPS conditional jump instructions also conntain register

+ 5 - 0
compiler/xtensa/cgcpu.pas

@@ -621,6 +621,7 @@ implementation
           begin
             instr:=taicpu.op_reg_sym(A_B,f.register,l);
             instr.condition:=flags_to_cond(f.flag);
+            instr.is_jmp:=true;
             list.concat(instr);
           end
         else
@@ -905,6 +906,7 @@ implementation
             end;     
             instr:=taicpu.op_reg_sym(A_B,reg,l);
             instr.condition:=op;
+            instr.is_jmp:=true;
             list.concat(instr);
           end
         else if is_b4const(a) and
@@ -921,6 +923,7 @@ implementation
 
             instr:=taicpu.op_reg_const_sym(A_B,reg,a,l);
             instr.condition:=op;
+            instr.is_jmp:=true;
             list.concat(instr);
           end
         else if is_b4constu(a) and
@@ -935,6 +938,7 @@ implementation
 
             instr:=taicpu.op_reg_const_sym(A_B,reg,a,l);
             instr.condition:=op;
+            instr.is_jmp:=true;
             list.concat(instr);
           end
         else
@@ -958,6 +962,7 @@ implementation
 
         instr:=taicpu.op_reg_reg_sym(A_B,reg2,reg1,l);
         instr.condition:=TOpCmp2AsmCond[cmp_op];
+        instr.is_jmp:=true;
         list.concat(instr);
       end;