浏览代码

+ introduced TAOptBase.RegistersInterfere (which might not always be equivalent to SuperRegistersEqual)

git-svn-id: trunk@45339 -
nickysn 5 年之前
父节点
当前提交
531cc0ab0d
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      compiler/aoptbase.pas

+ 13 - 0
compiler/aoptbase.pas

@@ -105,6 +105,9 @@ unit aoptbase;
         { compares reg1 and reg2 having the same type and being the same super registers
         { compares reg1 and reg2 having the same type and being the same super registers
           so the register size is neglected }
           so the register size is neglected }
         class function SuperRegistersEqual(reg1,reg2 : TRegister) : Boolean; static; {$ifdef USEINLINE}inline;{$endif}
         class function SuperRegistersEqual(reg1,reg2 : TRegister) : Boolean; static; {$ifdef USEINLINE}inline;{$endif}
+
+        { returns true if changing reg1 changes reg2 or vice versa }
+        class function RegistersInterfere(reg1,reg2 : TRegister) : Boolean; static; {$ifdef USEINLINE}inline;{$endif}
     end;
     end;
 
 
     function labelCanBeSkipped(p: tai_label): boolean; {$ifdef USEINLINE}inline;{$endif}
     function labelCanBeSkipped(p: tai_label): boolean; {$ifdef USEINLINE}inline;{$endif}
@@ -344,6 +347,16 @@ unit aoptbase;
 {$endif Z80}
 {$endif Z80}
   end;
   end;
 
 
+
+  class function TAOptBase.RegistersInterfere(reg1,reg2 : TRegister) : Boolean; static; {$ifdef USEINLINE}inline;{$endif}
+    begin
+{$ifdef Z80}
+      result:=registers_interfere(reg1,reg2);
+{$else Z80}
+      result:=SuperRegistersEqual(reg1,reg2);
+{$endif Z80}
+    end;
+
   { ******************* Processor dependent stuff *************************** }
   { ******************* Processor dependent stuff *************************** }
 
 
   Function TAOptBase.RegMaxSize(Reg: TRegister): TRegister;
   Function TAOptBase.RegMaxSize(Reg: TRegister): TRegister;