瀏覽代碼

+ sanity checks in mips and sparc register allocator

florian 3 年之前
父節點
當前提交
03f4685455
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      compiler/mips/rgcpu.pas
  2. 2 2
      compiler/sparcgen/rgcpu.pas

+ 2 - 2
compiler/mips/rgcpu.pas

@@ -150,7 +150,7 @@ implementation
             else
             else
               InternalError(2013061003);
               InternalError(2013061003);
           end;
           end;
-        if get_alias(getsupreg(instr.oper[1]^.reg))=orgreg then
+        if (getregtype(instr.oper[1]^.reg)=regtype) and  (get_alias(getsupreg(instr.oper[1]^.reg))=orgreg) then
           begin
           begin
             case instr.opcode of
             case instr.opcode of
               A_MOVE:  instr.opcode:=A_LW;
               A_MOVE:  instr.opcode:=A_LW;
@@ -160,7 +160,7 @@ implementation
               InternalError(2013061004);
               InternalError(2013061004);
             end;
             end;
           end
           end
-        else if get_alias(getsupreg(instr.oper[0]^.reg))=orgreg then
+        else if (getregtype(instr.oper[0]^.reg)=regtype) and  (get_alias(getsupreg(instr.oper[0]^.reg))=orgreg) then
           begin
           begin
             case instr.opcode of
             case instr.opcode of
               A_MOVE:  instr.opcode:=A_SW;
               A_MOVE:  instr.opcode:=A_SW;

+ 2 - 2
compiler/sparcgen/rgcpu.pas

@@ -207,7 +207,7 @@ implementation
            (getregtype(instr.oper[1]^.reg)<>regtype) then
            (getregtype(instr.oper[1]^.reg)<>regtype) then
           exit;
           exit;
         opidx:=-1;
         opidx:=-1;
-        if get_alias(getsupreg(instr.oper[0]^.reg))=orgreg then
+        if (getregtype(instr.oper[0]^.reg)=regtype) and (get_alias(getsupreg(instr.oper[0]^.reg))=orgreg) then
           begin
           begin
             if (regtype=R_INTREGISTER) then
             if (regtype=R_INTREGISTER) then
               instr.opcode:=A_LD_R
               instr.opcode:=A_LD_R
@@ -217,7 +217,7 @@ implementation
               instr.opcode:=A_LDDF;
               instr.opcode:=A_LDDF;
             opidx:=0;
             opidx:=0;
           end
           end
-        else if get_alias(getsupreg(instr.oper[1]^.reg))=orgreg then
+        else if (getregtype(instr.oper[1]^.reg)=regtype) and (get_alias(getsupreg(instr.oper[1]^.reg))=orgreg) then
           begin
           begin
             if (regtype=R_INTREGISTER) then
             if (regtype=R_INTREGISTER) then
               instr.opcode:=A_ST_R
               instr.opcode:=A_ST_R