summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/SPARC/CodeGen.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-07-16 20:53:21 +0100
committerIan Lynagh <igloo@earth.li>2012-07-16 22:40:37 +0100
commitcdf946e45024f76ce4f22462f511a0490fef1dff (patch)
tree993709cdc4a579e34b056cfb31826cd2b358f340 /compiler/nativeGen/SPARC/CodeGen.hs
parent5d0fce85fd5c885343196142b15b8a8d2928d3fe (diff)
downloadhaskell-cdf946e45024f76ce4f22462f511a0490fef1dff.tar.gz
Make -fPIC a dynamic flag
Hopefully I've kept the logic the same, and we now generate warnings if the user does -fno-PIC but we ignore them (e.g. because they're on OS X amd64).
Diffstat (limited to 'compiler/nativeGen/SPARC/CodeGen.hs')
-rw-r--r--compiler/nativeGen/SPARC/CodeGen.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs
index e0656db9db..840918281f 100644
--- a/compiler/nativeGen/SPARC/CodeGen.hs
+++ b/compiler/nativeGen/SPARC/CodeGen.hs
@@ -48,7 +48,6 @@ import CPrim
import BasicTypes
import DynFlags
import FastString
-import StaticFlags ( opt_PIC )
import OrdList
import Outputable
import Platform
@@ -135,7 +134,8 @@ stmtToInstrs stmt = case stmt of
CmmBranch id -> genBranch id
CmmCondBranch arg id -> genCondJump id arg
- CmmSwitch arg ids -> genSwitch arg ids
+ CmmSwitch arg ids -> do dflags <- getDynFlags
+ genSwitch dflags arg ids
CmmJump arg _ -> genJump arg
CmmReturn
@@ -289,9 +289,9 @@ genCondJump bid bool = do
-- -----------------------------------------------------------------------------
-- Generating a table-branch
-genSwitch :: CmmExpr -> [Maybe BlockId] -> NatM InstrBlock
-genSwitch expr ids
- | opt_PIC
+genSwitch :: DynFlags -> CmmExpr -> [Maybe BlockId] -> NatM InstrBlock
+genSwitch dflags expr ids
+ | dopt Opt_PIC dflags
= error "MachCodeGen: sparc genSwitch PIC not finished\n"
| otherwise
@@ -317,11 +317,12 @@ genSwitch expr ids
, JMP_TBL (AddrRegImm dst (ImmInt 0)) ids label
, NOP ]
-generateJumpTableForInstr :: Instr -> Maybe (NatCmmDecl CmmStatics Instr)
-generateJumpTableForInstr (JMP_TBL _ ids label) =
+generateJumpTableForInstr :: DynFlags -> Instr
+ -> Maybe (NatCmmDecl CmmStatics Instr)
+generateJumpTableForInstr _ (JMP_TBL _ ids label) =
let jumpTable = map jumpTableEntry ids
in Just (CmmData ReadOnlyData (Statics label jumpTable))
-generateJumpTableForInstr _ = Nothing
+generateJumpTableForInstr _ _ = Nothing