Commit 9224e48e authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Remove some CPP

parent e76fa699
...@@ -104,9 +104,9 @@ bHalfWord dflags = cmmBits (halfWordWidth dflags) ...@@ -104,9 +104,9 @@ bHalfWord dflags = cmmBits (halfWordWidth dflags)
gcWord :: DynFlags -> CmmType gcWord :: DynFlags -> CmmType
gcWord dflags = CmmType GcPtrCat (wordWidth dflags) gcWord dflags = CmmType GcPtrCat (wordWidth dflags)
cInt, cLong :: CmmType cInt, cLong :: DynFlags -> CmmType
cInt = cmmBits cIntWidth cInt dflags = cmmBits (cIntWidth dflags)
cLong = cmmBits cLongWidth cLong dflags = cmmBits (cLongWidth dflags)
------------ Predicates ---------------- ------------ Predicates ----------------
...@@ -178,18 +178,15 @@ halfWordMask dflags ...@@ -178,18 +178,15 @@ halfWordMask dflags
| otherwise = panic "MachOp.halfWordMask: Unknown word size" | otherwise = panic "MachOp.halfWordMask: Unknown word size"
-- cIntRep is the Width for a C-language 'int' -- cIntRep is the Width for a C-language 'int'
cIntWidth, cLongWidth :: Width cIntWidth, cLongWidth :: DynFlags -> Width
#if SIZEOF_INT == 4 cIntWidth dflags = case cINT_SIZE dflags of
cIntWidth = W32 4 -> W32
#elif SIZEOF_INT == 8 8 -> W64
cIntWidth = W64 s -> panic ("cIntWidth: Unknown cINT_SIZE: " ++ show s)
#endif cLongWidth dflags = case cLONG_SIZE dflags of
4 -> W32
#if SIZEOF_LONG == 4 8 -> W64
cLongWidth = W32 s -> panic ("cIntWidth: Unknown cLONG_SIZE: " ++ show s)
#elif SIZEOF_LONG == 8
cLongWidth = W64
#endif
widthInBits :: Width -> Int widthInBits :: Width -> Int
widthInBits W8 = 8 widthInBits W8 = 8
......
...@@ -307,8 +307,8 @@ ldvEnter cl_ptr = do ...@@ -307,8 +307,8 @@ ldvEnter cl_ptr = do
(stmtC (CmmStore ldv_wd new_ldv_wd)) (stmtC (CmmStore ldv_wd new_ldv_wd))
loadEra :: DynFlags -> CmmExpr loadEra :: DynFlags -> CmmExpr
loadEra dflags = CmmMachOp (MO_UU_Conv cIntWidth (wordWidth dflags)) loadEra dflags = CmmMachOp (MO_UU_Conv (cIntWidth dflags) (wordWidth dflags))
[CmmLoad (mkLblExpr (mkCmmDataLabel rtsPackageId $ fsLit("era"))) cInt] [CmmLoad (mkLblExpr (mkCmmDataLabel rtsPackageId $ fsLit("era"))) (cInt dflags)]
ldvWord :: DynFlags -> CmmExpr -> CmmExpr ldvWord :: DynFlags -> CmmExpr -> CmmExpr
-- Takes the address of a closure, and returns -- Takes the address of a closure, and returns
......
...@@ -302,9 +302,9 @@ tickyAllocHeap hp ...@@ -302,9 +302,9 @@ tickyAllocHeap hp
(CmmLit (cmmLabelOffB ticky_ctr (CmmLit (cmmLabelOffB ticky_ctr
(oFFSET_StgEntCounter_allocs dflags))) hp, (oFFSET_StgEntCounter_allocs dflags))) hp,
-- Bump ALLOC_HEAP_ctr -- Bump ALLOC_HEAP_ctr
addToMemLbl cLongWidth (mkCmmDataLabel rtsPackageId $ fsLit "ALLOC_HEAP_ctr") 1, addToMemLbl (cLongWidth dflags) (mkCmmDataLabel rtsPackageId $ fsLit "ALLOC_HEAP_ctr") 1,
-- Bump ALLOC_HEAP_tot -- Bump ALLOC_HEAP_tot
addToMemLbl cLongWidth (mkCmmDataLabel rtsPackageId $ fsLit "ALLOC_HEAP_tot") hp] } addToMemLbl (cLongWidth dflags) (mkCmmDataLabel rtsPackageId $ fsLit "ALLOC_HEAP_tot") hp] }
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Ticky utils -- Ticky utils
...@@ -323,7 +323,8 @@ bumpTickyCounter lbl = bumpTickyCounter' (cmmLabelOffB (mkCmmDataLabel rtsPackag ...@@ -323,7 +323,8 @@ bumpTickyCounter lbl = bumpTickyCounter' (cmmLabelOffB (mkCmmDataLabel rtsPackag
bumpTickyCounter' :: CmmLit -> Code bumpTickyCounter' :: CmmLit -> Code
-- krc: note that we're incrementing the _entry_count_ field of the ticky counter -- krc: note that we're incrementing the _entry_count_ field of the ticky counter
bumpTickyCounter' lhs = stmtC (addToMemLong (CmmLit lhs) 1) bumpTickyCounter' lhs = do dflags <- getDynFlags
stmtC (addToMemLong dflags (CmmLit lhs) 1)
bumpHistogram :: FastString -> Int -> Code bumpHistogram :: FastString -> Int -> Code
bumpHistogram _lbl _n bumpHistogram _lbl _n
...@@ -346,8 +347,8 @@ bumpHistogramE lbl n ...@@ -346,8 +347,8 @@ bumpHistogramE lbl n
-} -}
------------------------------------------------------------------ ------------------------------------------------------------------
addToMemLong :: CmmExpr -> Int -> CmmStmt addToMemLong :: DynFlags -> CmmExpr -> Int -> CmmStmt
addToMemLong = addToMem cLongWidth addToMemLong dflags = addToMem (cLongWidth dflags)
------------------------------------------------------------------ ------------------------------------------------------------------
-- Showing the "type category" for ticky-ticky profiling -- Showing the "type category" for ticky-ticky profiling
......
...@@ -369,8 +369,9 @@ ldvEnter cl_ptr = do ...@@ -369,8 +369,9 @@ ldvEnter cl_ptr = do
mkNop mkNop
loadEra :: DynFlags -> CmmExpr loadEra :: DynFlags -> CmmExpr
loadEra dflags = CmmMachOp (MO_UU_Conv cIntWidth (wordWidth dflags)) loadEra dflags = CmmMachOp (MO_UU_Conv (cIntWidth dflags) (wordWidth dflags))
[CmmLoad (mkLblExpr (mkCmmDataLabel rtsPackageId (fsLit "era"))) cInt] [CmmLoad (mkLblExpr (mkCmmDataLabel rtsPackageId (fsLit "era")))
(cInt dflags)]
ldvWord :: DynFlags -> CmmExpr -> CmmExpr ldvWord :: DynFlags -> CmmExpr -> CmmExpr
-- Takes the address of a closure, and returns -- Takes the address of a closure, and returns
......
...@@ -325,9 +325,9 @@ tickyAllocHeap hp ...@@ -325,9 +325,9 @@ tickyAllocHeap hp
(CmmLit (cmmLabelOffB ticky_ctr (CmmLit (cmmLabelOffB ticky_ctr
(oFFSET_StgEntCounter_allocs dflags))) hp, (oFFSET_StgEntCounter_allocs dflags))) hp,
-- Bump ALLOC_HEAP_ctr -- Bump ALLOC_HEAP_ctr
addToMemLbl cLong (mkCmmDataLabel rtsPackageId (fsLit "ALLOC_HEAP_ctr")) 1, addToMemLbl (cLong dflags) (mkCmmDataLabel rtsPackageId (fsLit "ALLOC_HEAP_ctr")) 1,
-- Bump ALLOC_HEAP_tot -- Bump ALLOC_HEAP_tot
addToMemLbl cLong (mkCmmDataLabel rtsPackageId (fsLit "ALLOC_HEAP_tot")) hp] } addToMemLbl (cLong dflags) (mkCmmDataLabel rtsPackageId (fsLit "ALLOC_HEAP_tot")) hp] }
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Ticky utils -- Ticky utils
...@@ -343,7 +343,8 @@ bumpTickyCounter lbl = bumpTickyCounter' (cmmLabelOffB (mkCmmDataLabel rtsPackag ...@@ -343,7 +343,8 @@ bumpTickyCounter lbl = bumpTickyCounter' (cmmLabelOffB (mkCmmDataLabel rtsPackag
bumpTickyCounter' :: CmmLit -> FCode () bumpTickyCounter' :: CmmLit -> FCode ()
-- krc: note that we're incrementing the _entry_count_ field of the ticky counter -- krc: note that we're incrementing the _entry_count_ field of the ticky counter
bumpTickyCounter' lhs = emit (addToMem cLong (CmmLit lhs) 1) bumpTickyCounter' lhs = do dflags <- getDynFlags
emit (addToMem (cLong dflags) (CmmLit lhs) 1)
bumpHistogram :: FastString -> Int -> FCode () bumpHistogram :: FastString -> Int -> FCode ()
bumpHistogram _lbl _n bumpHistogram _lbl _n
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment