From f9c1512a1da2e52f88dc6fde57920fefa37fc0eb Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 29 Jun 2006 11:58:37 +0000 Subject: [PATCH] add MO_WriteBarrier to CallishMachOps This will let us express write barriers in C-- --- compiler/cmm/MachOp.hs | 1 + compiler/cmm/PprC.hs | 1 + compiler/nativeGen/MachCodeGen.hs | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/compiler/cmm/MachOp.hs b/compiler/cmm/MachOp.hs index 5bbff6d..a77a7b1 100644 --- a/compiler/cmm/MachOp.hs +++ b/compiler/cmm/MachOp.hs @@ -385,6 +385,7 @@ data CallishMachOp | MO_F32_Log | MO_F32_Exp | MO_F32_Sqrt + | MO_WriteBarrier deriving (Eq, Show) pprCallishMachOp :: CallishMachOp -> SDoc diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index a8d3066..5c60b8a 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -547,6 +547,7 @@ pprCallishMachOp_for_C mop MO_F32_Log -> ptext SLIT("logf") MO_F32_Exp -> ptext SLIT("expf") MO_F32_Sqrt -> ptext SLIT("sqrtf") + MO_WriteBarrier -> ptext SLIT("write_barrier") -- --------------------------------------------------------------------- -- Useful #defines diff --git a/compiler/nativeGen/MachCodeGen.hs b/compiler/nativeGen/MachCodeGen.hs index 0d8aa4e..18cb086 100644 --- a/compiler/nativeGen/MachCodeGen.hs +++ b/compiler/nativeGen/MachCodeGen.hs @@ -2909,6 +2909,10 @@ genCCall fn cconv result_regs args #if i386_TARGET_ARCH +genCCall (CmmPrim MO_WriteBarrier) _ _ _ = return nilOL + -- write barrier compiles to no code on x86/x86-64; + -- we keep it this long in order to prevent earlier optimisations. + -- we only cope with a single result for foreign calls genCCall (CmmPrim op) [(r,_)] args vols = do case op of @@ -3119,6 +3123,10 @@ outOfLineFloatOp mop res args vols #if x86_64_TARGET_ARCH +genCCall (CmmPrim MO_WriteBarrier) _ _ _ = return nilOL + -- write barrier compiles to no code on x86/x86-64; + -- we keep it this long in order to prevent earlier optimisations. + genCCall (CmmPrim op) [(r,_)] args vols = outOfLineFloatOp op r args vols -- 1.7.10.4