forkProcess(): watch out for ThreadRelocated
[ghc-hetmet.git] / ghc / compiler / cmm / Cmm.hs
index cf76f45..13961c1 100644 (file)
@@ -30,6 +30,7 @@ import CLabel         ( CLabel )
 import ForeignCall     ( CCallConv )
 import Unique          ( Unique, Uniquable(..) )
 import FastString      ( FastString )
+import DATA_WORD       ( Word8 )
 
 -----------------------------------------------------------------------------
 --             Cmm, CmmTop, CmmBasicBlock
@@ -201,12 +202,22 @@ data CmmLit
   | CmmFloat  Rational MachRep
   | CmmLabel    CLabel                 -- Address of label
   | CmmLabelOff CLabel Int             -- Address of label + byte offset
+  
+        -- Due to limitations in the C backend, the following
+        -- MUST ONLY be used inside the info table indicated by label2
+        -- (label2 must be the info label), and label1 must be an
+        -- SRT, a slow entrypoint or a large bitmap (see the Mangler)
+        -- Don't use it at all unless tablesNextToCode.
+        -- It is also used inside the NCG during when generating
+        -- position-independent code. 
+  | CmmLabelDiffOff CLabel CLabel Int   -- label1 - label2 + offset
 
 cmmLitRep :: CmmLit -> MachRep
 cmmLitRep (CmmInt _ rep)    = rep
 cmmLitRep (CmmFloat _ rep)  = rep
 cmmLitRep (CmmLabel _)      = wordRep
 cmmLitRep (CmmLabelOff _ _) = wordRep
+cmmLitRep (CmmLabelDiffOff _ _ _) = wordRep
 
 -----------------------------------------------------------------------------
 -- A local label.
@@ -227,7 +238,9 @@ data Section
   = Text
   | Data
   | ReadOnlyData
+  | RelocatableReadOnlyData
   | UninitialisedData
+  | ReadOnlyData16     -- .rodata.cst16 on x86_64, 16-byte aligned
   | OtherSection String
 
 data CmmStatic
@@ -239,9 +252,8 @@ data CmmStatic
        -- align to next N-byte boundary (N must be a power of 2).
   | CmmDataLabel CLabel
        -- label the current position in this section.
-  | CmmString String
+  | CmmString [Word8]
        -- string of 8-bit values only, not zero terminated.
-       -- ToDo: might be more honest to use [Word8] here?
 
 -----------------------------------------------------------------------------
 --             Global STG registers
@@ -282,6 +294,11 @@ data GlobalReg
   -- (where necessary) in the native code generator.
   | BaseReg
 
+  -- Base Register for PIC (position-independent code) calculations
+  -- Only used inside the native code generator. It's exact meaning differs
+  -- from platform to platform (see module PositionIndependentCode).
+  | PicBaseReg
+
   deriving( Eq
 #ifdef DEBUG
        , Show