summaryrefslogtreecommitdiff
path: root/compiler/codeGen/CgUtils.hs
diff options
context:
space:
mode:
authorMichael D. Adams <t-madams@microsoft.com>2007-06-27 15:12:57 +0000
committerMichael D. Adams <t-madams@microsoft.com>2007-06-27 15:12:57 +0000
commitf96e9aa0444de0e673b3c4055c6e43299639bc5b (patch)
tree7bb999eafe8282492550cd835118a199bff05247 /compiler/codeGen/CgUtils.hs
parentaffbe8dae5d7eb350686b42ddbd4f3561b7bd0ec (diff)
downloadhaskell-f96e9aa0444de0e673b3c4055c6e43299639bc5b.tar.gz
First pass at implementing info tables for CPS
This is a fairly complete implementation, however two 'panic's have been placed in the critical path where the implementation is still a bit lacking so do not expect it to run quite yet. One call to panic is because we still need to create a GC block for procedures that don't have them yet. (cmm/CmmCPS.hs:continuationToProc) The other is due to the need to convert from a ContinuationInfo to a CmmInfo. (codeGen/CgInfoTbls.hs:emitClosureCodeAndInfoTable) (codeGen/CgInfoTbls.hs:emitReturnTarget)
Diffstat (limited to 'compiler/codeGen/CgUtils.hs')
-rw-r--r--compiler/codeGen/CgUtils.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs
index 26857d386c..13de2136f5 100644
--- a/compiler/codeGen/CgUtils.hs
+++ b/compiler/codeGen/CgUtils.hs
@@ -9,7 +9,9 @@
module CgUtils (
addIdReps,
cgLit,
- emitDataLits, emitRODataLits, emitIf, emitIfThenElse,
+ emitDataLits, mkDataLits,
+ emitRODataLits, mkRODataLits,
+ emitIf, emitIfThenElse,
emitRtsCall, emitRtsCallWithVols, emitRtsCallWithResult,
assignNonPtrTemp, newNonPtrTemp,
assignPtrTemp, newPtrTemp,
@@ -309,6 +311,11 @@ emitDataLits :: CLabel -> [CmmLit] -> Code
emitDataLits lbl lits
= emitData Data (CmmDataLabel lbl : map CmmStaticLit lits)
+mkDataLits :: CLabel -> [CmmLit] -> GenCmmTop CmmStatic info stmt
+-- Emit a data-segment data block
+mkDataLits lbl lits
+ = CmmData Data (CmmDataLabel lbl : map CmmStaticLit lits)
+
emitRODataLits :: CLabel -> [CmmLit] -> Code
-- Emit a read-only data block
emitRODataLits lbl lits
@@ -319,6 +326,15 @@ emitRODataLits lbl lits
needsRelocation (CmmLabelOff _ _) = True
needsRelocation _ = False
+mkRODataLits :: CLabel -> [CmmLit] -> GenCmmTop CmmStatic info stmt
+mkRODataLits lbl lits
+ = CmmData section (CmmDataLabel lbl : map CmmStaticLit lits)
+ where section | any needsRelocation lits = RelocatableReadOnlyData
+ | otherwise = ReadOnlyData
+ needsRelocation (CmmLabel _) = True
+ needsRelocation (CmmLabelOff _ _) = True
+ needsRelocation _ = False
+
mkStringCLit :: String -> FCode CmmLit
-- Make a global definition for the string,
-- and return its label