From 03f468545597e3edbde86b903a88a1dc9da9b1e9 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 17 Dec 2021 21:24:41 +0100 Subject: [PATCH] + sanity checks in mips and sparc register allocator --- compiler/mips/rgcpu.pas | 4 ++-- compiler/sparcgen/rgcpu.pas | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/mips/rgcpu.pas b/compiler/mips/rgcpu.pas index 0e3db2f428..188bf49c59 100644 --- a/compiler/mips/rgcpu.pas +++ b/compiler/mips/rgcpu.pas @@ -150,7 +150,7 @@ implementation else InternalError(2013061003); 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 case instr.opcode of A_MOVE: instr.opcode:=A_LW; @@ -160,7 +160,7 @@ implementation InternalError(2013061004); 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 case instr.opcode of A_MOVE: instr.opcode:=A_SW; diff --git a/compiler/sparcgen/rgcpu.pas b/compiler/sparcgen/rgcpu.pas index 3ca20d21bb..272558c8ce 100644 --- a/compiler/sparcgen/rgcpu.pas +++ b/compiler/sparcgen/rgcpu.pas @@ -207,7 +207,7 @@ implementation (getregtype(instr.oper[1]^.reg)<>regtype) then exit; 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 if (regtype=R_INTREGISTER) then instr.opcode:=A_LD_R @@ -217,7 +217,7 @@ implementation instr.opcode:=A_LDDF; opidx:=0; 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 if (regtype=R_INTREGISTER) then instr.opcode:=A_ST_R