diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ortho/mcode/ortho_code-x86-emits.adb | 2 | ||||
-rw-r--r-- | src/ortho/mcode/ortho_code-x86-insns.adb | 22 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/ortho/mcode/ortho_code-x86-emits.adb b/src/ortho/mcode/ortho_code-x86-emits.adb index 725dfd80b..b33a5d019 100644 --- a/src/ortho/mcode/ortho_code-x86-emits.adb +++ b/src/ortho/mcode/ortho_code-x86-emits.adb @@ -2739,6 +2739,8 @@ package body Ortho_Code.X86.Emits is and then Op_Reg in Regs_R64 then Emit_Tst (Op_Reg, Sz_8); + elsif Reg in Regs_R64 and then Op_Reg in Regs_R64 then + Emit_Move (Operand, Sz_Ptr, Reg); else Error_Emit ("emit_insn: move/b2", Stmt); end if; diff --git a/src/ortho/mcode/ortho_code-x86-insns.adb b/src/ortho/mcode/ortho_code-x86-insns.adb index 9d990c465..a9d59c557 100644 --- a/src/ortho/mcode/ortho_code-x86-insns.adb +++ b/src/ortho/mcode/ortho_code-x86-insns.adb @@ -2316,7 +2316,6 @@ package body Ortho_Code.X86.Insns is Left : O_Enode; Right : O_Enode; - P_Reg : O_Reg; Num : O_Inum; Prev_Stack_Offset : Uns32; @@ -2374,12 +2373,21 @@ package body Ortho_Code.X86.Insns is Left := Gen_Call (Stmt, R_None, Num); -- Gen_Call already link the statement. Discard the result. when OE_Ret => - Left := Get_Expr_Operand (Stmt); - P_Reg := Get_Return_Register (Get_Expr_Mode (Stmt)); - Left := Gen_Insn (Left, P_Reg, Num); - Set_Expr_Operand (Stmt, Left); - Link_Stmt (Stmt); - Free_Insn_Regs (Left); + declare + R_Reg : O_Reg; + P_Reg : O_Reg; + begin + Left := Get_Expr_Operand (Stmt); + P_Reg := Get_Return_Register (Get_Expr_Mode (Stmt)); + Left := Gen_Insn (Left, P_Reg, Num); + Free_Insn_Regs (Left); + R_Reg := Get_Expr_Reg (Left); + if R_Reg /= P_Reg then + Left := Insert_Move (Left, P_Reg); + end if; + Set_Expr_Operand (Stmt, Left); + Link_Stmt (Stmt); + end; when OE_Case => Left := Gen_Insn (Get_Expr_Operand (Stmt), Get_Reg_Any (Stmt), Num); |