summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorNorman Ramsey <nr@eecs.harvard.edu>2007-09-06 16:19:48 +0000
committerNorman Ramsey <nr@eecs.harvard.edu>2007-09-06 16:19:48 +0000
commit16a2f6a8a381af31c23b6a41a851951da9bc1803 (patch)
tree1ba088d553a1b75cb113f40d35befb44301d790d /compiler/codeGen
parent5fccc8561f788bc94246a62f1fae63d29085ea63 (diff)
downloadhaskell-16a2f6a8a381af31c23b6a41a851951da9bc1803.tar.gz
massive changes to add a 'zipper' representation of C--
Changes too numerous to comment on, but here is some old history that I saved: Wed Aug 15 11:07:13 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * type synonyms made consistent with new Cmm types M ./compiler/nativeGen/MachInstrs.hs -2 +2 Mon Aug 20 19:22:14 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * pushing return info beyond cmm into codegen M ./compiler/codeGen/Bitmap.hs r3 M ./compiler/codeGen/CgBindery.lhs r3 M ./compiler/codeGen/CgCallConv.hs r3 M ./compiler/codeGen/CgCase.lhs r3 M ./compiler/codeGen/CgClosure.lhs r3 M ./compiler/codeGen/CgCon.lhs r3 M ./compiler/codeGen/CgExpr.lhs r3 M ./compiler/codeGen/CgForeignCall.hs -6 +7 r3 M ./compiler/codeGen/CgHeapery.lhs r3 M ./compiler/codeGen/CgHpc.hs +1 r3 M ./compiler/codeGen/CgInfoTbls.hs r3 M ./compiler/codeGen/CgLetNoEscape.lhs r3 M ./compiler/codeGen/CgMonad.lhs r3 M ./compiler/codeGen/CgParallel.hs r3 M ./compiler/codeGen/CgPrimOp.hs +3 r3 M ./compiler/codeGen/CgProf.hs r3 M ./compiler/codeGen/CgStackery.lhs r3 M ./compiler/codeGen/CgTailCall.lhs r3 M ./compiler/codeGen/CgTicky.hs r3 M ./compiler/codeGen/CgUtils.hs -1 +1 r3 M ./compiler/codeGen/ClosureInfo.lhs r3 M ./compiler/codeGen/CodeGen.lhs r3 M ./compiler/codeGen/SMRep.lhs r3 M ./compiler/nativeGen/AsmCodeGen.lhs -2 +2 r1 M ./compiler/nativeGen/MachCodeGen.hs -3 +3 r1 M ./compiler/nativeGen/MachInstrs.hs r1 M ./compiler/nativeGen/MachRegs.lhs r1 M ./compiler/nativeGen/NCGMonad.hs r1 M ./compiler/nativeGen/PositionIndependentCode.hs r1 M ./compiler/nativeGen/PprMach.hs r1 M ./compiler/nativeGen/RegAllocInfo.hs r1 M ./compiler/nativeGen/RegisterAlloc.hs r1 Mon Aug 20 20:54:41 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * put CmmReturnInfo into a CmmCall (and related types) M ./compiler/cmm/Cmm.hs -2 +1 r3 M ./compiler/cmm/CmmBrokenBlock.hs -13 +12 r1 M ./compiler/cmm/CmmCPS.hs -3 +3 M ./compiler/cmm/CmmCPSGen.hs -8 +6 r1 M ./compiler/cmm/CmmLint.hs -1 +1 M ./compiler/cmm/CmmLive.hs -1 +1 M ./compiler/cmm/CmmOpt.hs -3 +3 M ./compiler/cmm/CmmParse.y -6 +6 r3 M ./compiler/cmm/PprC.hs -3 +3 M ./compiler/cmm/PprCmm.hs -7 +4 r2 M ./compiler/codeGen/CgForeignCall.hs -7 +6 r2 M ./compiler/codeGen/CgHpc.hs -1 r1 M ./compiler/codeGen/CgPrimOp.hs -3 r1 M ./compiler/codeGen/CgUtils.hs -1 +1 r1 M ./compiler/nativeGen/AsmCodeGen.lhs -2 +2 M ./compiler/nativeGen/MachCodeGen.hs -3 +3 r1 Tue Aug 21 18:09:13 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * add call info in nativeGen M ./compiler/nativeGen/AsmCodeGen.lhs r1 M ./compiler/nativeGen/MachInstrs.hs r1 M ./compiler/nativeGen/MachRegs.lhs r1 M ./compiler/nativeGen/NCGMonad.hs r1 M ./compiler/nativeGen/PositionIndependentCode.hs r1 M ./compiler/nativeGen/PprMach.hs r1 M ./compiler/nativeGen/RegAllocInfo.hs r1 Wed Aug 22 16:41:58 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * ListGraph is now a newtype, not a synonym The resultant bookkeepping is unenviable, but the change greatly simplifies our ability to make Cmm things propertly Outputable for both list-graph and zipper-graph representations. M ./compiler/cmm/Cmm.hs -5 +3 M ./compiler/cmm/CmmCPS.hs -2 +2 M ./compiler/cmm/CmmCPSGen.hs -1 +1 M ./compiler/cmm/CmmContFlowOpt.hs -3 +3 M ./compiler/cmm/CmmCvt.hs -2 +2 M ./compiler/cmm/CmmInfo.hs -2 +3 M ./compiler/cmm/CmmLint.hs -1 +1 M ./compiler/cmm/CmmOpt.hs -2 +2 M ./compiler/cmm/PprC.hs -1 +1 M ./compiler/cmm/PprCmm.hs -5 +8 M ./compiler/cmm/PprCmmZ.hs -7 +1 M ./compiler/codeGen/CgMonad.lhs -1 +1 M ./compiler/nativeGen/AsmCodeGen.lhs -15 +15 M ./compiler/nativeGen/MachCodeGen.hs -2 +2 M ./compiler/nativeGen/PositionIndependentCode.hs -6 +6 M ./compiler/nativeGen/PprMach.hs -3 +2 M ./compiler/nativeGen/RegAllocColor.hs +1 M ./compiler/nativeGen/RegAllocLinear.hs -4 +5 M ./compiler/nativeGen/RegCoalesce.hs -6 +6 M ./compiler/nativeGen/RegLiveness.hs -12 +12 Thu Aug 23 13:44:49 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * diagnostic assistance in case fromJust fails M ./compiler/nativeGen/MachCodeGen.hs -2 +5 Thu Aug 23 14:07:28 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * give every block, even the first, a label With branch-chain elimination, the first block of a procedure might be the target of a branch. This actually happens to a dozen or more procedures in the run-time system. M ./compiler/nativeGen/PprMach.hs -8 +3 Fri Aug 24 17:27:04 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * clean up the code in PprMach M ./compiler/nativeGen/PprMach.hs -16 +14 Fri Aug 24 19:35:03 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * a bunch of impedance matching to get the compiler to build, plus * the plus is diagnostics for unreachable code, which required moving a lot of prettyprinting code M ./compiler/cmm/Cmm.hs -7 +5 M ./compiler/cmm/CmmCPSZ.hs -1 +1 M ./compiler/cmm/CmmCvt.hs -8 +8 M ./compiler/cmm/CmmParse.y -4 +3 M ./compiler/cmm/MkZipCfg.hs -19 +9 M ./compiler/cmm/PprCmmZ.hs -118 +4 M ./compiler/cmm/ZipCfg.hs -1 +13 M ./compiler/cmm/ZipCfgCmm.hs -10 +129 M ./compiler/main/HscMain.lhs -4 +4 M ./compiler/nativeGen/NCGMonad.hs -2 +2 M ./compiler/nativeGen/RegAllocInfo.hs -3 +3 Fri Aug 31 14:38:02 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * fix a warning about an import M ./compiler/nativeGen/RegAllocColor.hs -1 +1
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/CgCon.lhs3
-rw-r--r--compiler/codeGen/CgMonad.lhs10
-rw-r--r--compiler/codeGen/CgTailCall.lhs12
-rw-r--r--compiler/codeGen/CodeGen.lhs4
4 files changed, 22 insertions, 7 deletions
diff --git a/compiler/codeGen/CgCon.lhs b/compiler/codeGen/CgCon.lhs
index 5269e4ec41..bf4cf3d9e7 100644
--- a/compiler/codeGen/CgCon.lhs
+++ b/compiler/codeGen/CgCon.lhs
@@ -397,6 +397,9 @@ cgTyCon tycon
-- datatype closure table (for enumeration types)
-- to (say) PrelBase_$wTrue_closure, which is defined in code_stuff
-- Note that the closure pointers are tagged.
+
+ -- XXX comment says to put table after constructor decls, but
+ -- code appears to put it before --- NR 16 Aug 2007
; extra <-
if isEnumerationTyCon tycon then do
tbl <- getCmm (emitRODataLits (mkLocalClosureTableLabel
diff --git a/compiler/codeGen/CgMonad.lhs b/compiler/codeGen/CgMonad.lhs
index faa84c2174..7b2ee7dcab 100644
--- a/compiler/codeGen/CgMonad.lhs
+++ b/compiler/codeGen/CgMonad.lhs
@@ -80,9 +80,9 @@ import Id
import VarEnv
import OrdList
import Unique
-import Util
+import Util()
import UniqSupply
-import FastString
+import FastString()
import Outputable
import Control.Monad
@@ -241,6 +241,7 @@ flattenCgStmts id stmts =
where (block,blocks) = flatten stmts
(CgFork fork_id stmts : ss) ->
flatten (CgFork fork_id stmts : CgStmt stmt : ss)
+ (CgStmt {} : _) -> panic "CgStmt not seen as ordinary"
flatten (s:ss) =
case s of
@@ -711,7 +712,8 @@ labelC :: BlockId -> Code
labelC id = emitCgStmt (CgLabel id)
newLabelC :: FCode BlockId
-newLabelC = do { id <- newUnique; return (BlockId id) }
+newLabelC = do { us <- newUniqSupply
+ ; return $ initUs_ us (freshBlockId "LabelC") }
checkedAbsC :: CmmStmt -> Code
-- Emit code, eliminating no-ops
@@ -758,6 +760,8 @@ emitSimpleProc lbl code
getCmm :: Code -> FCode Cmm
-- Get all the CmmTops (there should be no stmts)
+-- Return a single Cmm which may be split from other Cmms by
+-- object splitting (at a later stage)
getCmm code
= do { state1 <- getState
; ((), state2) <- withState code (state1 { cgs_tops = nilOL })
diff --git a/compiler/codeGen/CgTailCall.lhs b/compiler/codeGen/CgTailCall.lhs
index 16369ab573..cd100e8f21 100644
--- a/compiler/codeGen/CgTailCall.lhs
+++ b/compiler/codeGen/CgTailCall.lhs
@@ -34,7 +34,6 @@ import CgUtils
import CgTicky
import ClosureInfo
import SMRep
-import MachOp
import Cmm
import CmmUtils
import CLabel
@@ -227,6 +226,7 @@ performTailCall fun_info arg_amodes pending_assts
where
--cond1 tag = cmmULtWord tag lowCons
-- More efficient than the above?
+{-
tag_expr = cmmGetClosureType (CmmReg nodeReg)
cond1 tag = cmmEqWord tag (CmmLit (mkIntCLit 0))
cond2 tag = cmmUGtWord tag highCons
@@ -234,11 +234,9 @@ performTailCall fun_info arg_amodes pending_assts
-- CONSTR
highCons = CmmLit (mkIntCLit 8)
-- CONSTR_NOCAF_STATIC (from ClosureType.h)
+-}
-untagCmmAssign (CmmAssign r cmmExpr) = CmmAssign r (cmmUntag cmmExpr)
-untagCmmAssign stmt = stmt
-
directCall sp lbl args extra_args assts = do
let
-- First chunk of args go in registers
@@ -475,3 +473,9 @@ adjustSpAndHp newRealSp
; setRealHp vHp
}
\end{code}
+
+Some things are unused.
+\begin{code}
+_unused :: FS.FastString
+_unused = undefined
+\end{code}
diff --git a/compiler/codeGen/CodeGen.lhs b/compiler/codeGen/CodeGen.lhs
index ee25300277..a53ff49621 100644
--- a/compiler/codeGen/CodeGen.lhs
+++ b/compiler/codeGen/CodeGen.lhs
@@ -70,6 +70,10 @@ codeGen :: DynFlags
-> HpcInfo
-> IO [Cmm] -- Output
+ -- N.B. returning '[Cmm]' and not 'Cmm' here makes it
+ -- possible for object splitting to split up the
+ -- pieces later.
+
codeGen dflags this_mod data_tycons imported_mods
cost_centre_info stg_binds hpc_info
= do