From 561e57422c9189457e2c837a6329861dbc4231a5 Mon Sep 17 00:00:00 2001 From: "wolfgang.thaller@gmx.net" Date: Wed, 29 Nov 2006 01:34:29 +0000 Subject: [PATCH] x86_64 NCG: fix register usage for CALLs For varargs calls, CALL reads the %al register; record that fact for the benefit of the register allocator. (There was a previous attempt to do this, but it was broken.) --- compiler/nativeGen/MachCodeGen.hs | 2 +- compiler/nativeGen/RegAllocInfo.hs | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/compiler/nativeGen/MachCodeGen.hs b/compiler/nativeGen/MachCodeGen.hs index 9dbe316..769d17b 100644 --- a/compiler/nativeGen/MachCodeGen.hs +++ b/compiler/nativeGen/MachCodeGen.hs @@ -3164,7 +3164,7 @@ genCCall target dest_regs args vols = do let fp_regs_used = reverse (drop (length fregs) (reverse allFPArgRegs)) int_regs_used = reverse (drop (length aregs) (reverse allArgRegs)) - arg_regs = int_regs_used ++ fp_regs_used + arg_regs = [eax] ++ int_regs_used ++ fp_regs_used -- for annotating the call instruction with sse_regs = length fp_regs_used diff --git a/compiler/nativeGen/RegAllocInfo.hs b/compiler/nativeGen/RegAllocInfo.hs index 98c4e2d..df74218 100644 --- a/compiler/nativeGen/RegAllocInfo.hs +++ b/compiler/nativeGen/RegAllocInfo.hs @@ -224,12 +224,6 @@ regUsage instr = case instr of _other -> panic "regUsage: unrecognised instr" where -#if x86_64_TARGET_ARCH - -- call parameters: include %eax, because it is used - -- to pass the number of SSE reg arguments to varargs fns. - params = eax : allArgRegs ++ allFPArgRegs -#endif - -- 2 operand form; first operand Read; second Written usageRW :: Operand -> Operand -> RegUsage usageRW op (OpReg reg) = mkRU (use_R op) [reg] -- 1.7.10.4