summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-08-24 11:42:21 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-08-28 09:16:44 +0100
commitc0849d8c4dbdabc657860d383474ee1e638b7c5f (patch)
treedcb1fc18d399611fc23f7bf3f177c0c91161ab8e /compiler/nativeGen
parent1d36d88a681575176d026d7002e40d0ce5c45281 (diff)
downloadhaskell-c0849d8c4dbdabc657860d383474ee1e638b7c5f.tar.gz
Fix -fPIC with the new code generator
The CmmBlocks inside CmmExprs were not getting the PIC treatment
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/AsmCodeGen.lhs6
-rw-r--r--compiler/nativeGen/PPC/Regs.hs2
-rw-r--r--compiler/nativeGen/SPARC/Imm.hs4
-rw-r--r--compiler/nativeGen/X86/Regs.hs2
4 files changed, 7 insertions, 7 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs
index e510070c01..65fc4e339c 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -980,6 +980,12 @@ cmmExprNative referenceKind expr = do
-> do args' <- mapM (cmmExprNative DataReference) args
return $ CmmMachOp mop args'
+ CmmLit (CmmBlock id)
+ -> cmmExprNative referenceKind (CmmLit (CmmLabel (infoTblLbl id)))
+ -- we must convert block Ids to CLabels here, because we
+ -- might have to do the PIC transformation. Hence we must
+ -- not modify BlockIds beyond this point.
+
CmmLit (CmmLabel lbl)
-> do
cmmMakeDynamicReference dflags addImportCmmOpt referenceKind lbl
diff --git a/compiler/nativeGen/PPC/Regs.hs b/compiler/nativeGen/PPC/Regs.hs
index 4d06268a6c..b86df54b1e 100644
--- a/compiler/nativeGen/PPC/Regs.hs
+++ b/compiler/nativeGen/PPC/Regs.hs
@@ -54,7 +54,6 @@ import Reg
import RegClass
import Size
-import BlockId
import OldCmm
import CLabel ( CLabel )
import Unique
@@ -166,7 +165,6 @@ litToImm (CmmLabelDiffOff l1 l2 off)
= ImmConstantSum
(ImmConstantDiff (ImmCLbl l1) (ImmCLbl l2))
(ImmInt off)
-litToImm (CmmBlock id) = ImmCLbl (infoTblLbl id)
litToImm _ = panic "PPC.Regs.litToImm: no match"
diff --git a/compiler/nativeGen/SPARC/Imm.hs b/compiler/nativeGen/SPARC/Imm.hs
index eacc905122..fe64738f7b 100644
--- a/compiler/nativeGen/SPARC/Imm.hs
+++ b/compiler/nativeGen/SPARC/Imm.hs
@@ -17,7 +17,6 @@ where
import OldCmm
import CLabel
-import BlockId
import Outputable
@@ -71,7 +70,6 @@ litToImm lit
(ImmConstantDiff (ImmCLbl l1) (ImmCLbl l2))
(ImmInt off)
- CmmBlock id -> ImmCLbl (infoTblLbl id)
- _ -> panic "SPARC.Regs.litToImm: no match"
+ _ -> panic "SPARC.Regs.litToImm: no match"
diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs
index 15f20a2a58..a53c4fcbf7 100644
--- a/compiler/nativeGen/X86/Regs.hs
+++ b/compiler/nativeGen/X86/Regs.hs
@@ -67,7 +67,6 @@ where
import Reg
import RegClass
-import BlockId
import OldCmm
import CmmCallConv
import CLabel ( CLabel )
@@ -166,7 +165,6 @@ litToImm (CmmLabelDiffOff l1 l2 off)
= ImmConstantSum
(ImmConstantDiff (ImmCLbl l1) (ImmCLbl l2))
(ImmInt off)
-litToImm (CmmBlock id) = ImmCLbl (infoTblLbl id)
litToImm _ = panic "X86.Regs.litToImm: no match"
-- addressing modes ------------------------------------------------------------