X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fmain%2FDriverPipeline.hs;h=aeac000b23a82117e53aac12a1eb6aec454c671b;hb=b29e277d3ac5026666b2d9ea93e2c4210b6e4f47;hp=03e3cf6c565dd51d64cd715db24ffe9d8d3e622a;hpb=24c0c8c2040e7050fd5306afc85378eb94a06bd2;p=ghc-hetmet.git diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 03e3cf6..aeac000 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -51,12 +51,11 @@ import SrcLoc import FastString import LlvmCodeGen ( llvmFixupAsm ) import MonadUtils +import Platform --- import Data.Either import Exception import Data.IORef ( readIORef ) import Distribution.System --- import GHC.Exts ( Int(..) ) import System.Directory import System.FilePath import System.IO @@ -1061,7 +1060,7 @@ runPhase cc_phase input_fn dflags -- than a double, which leads to unpredictable results. -- By default, we turn this off with -ffloat-store unless -- the user specified -fexcess-precision. - (if cTargetArch == I386 && + (if platformArch (targetPlatform dflags) == ArchX86 && not (dopt Opt_ExcessPrecision dflags) then [ "-ffloat-store" ] else []) ++ @@ -1104,7 +1103,7 @@ runPhase cc_phase input_fn dflags -- regardless of the ordering. -- -- This is a temporary hack. - ++ (if cTargetArch == Sparc + ++ (if platformArch (targetPlatform dflags) == ArchSPARC then ["-mcpu=v9"] else []) @@ -1182,7 +1181,7 @@ runPhase As input_fn dflags -- regardless of the ordering. -- -- This is a temporary hack. - ++ (if cTargetArch == Sparc + ++ (if platformArch (targetPlatform dflags) == ArchSPARC then [SysTools.Option "-mcpu=v9"] else []) @@ -1237,7 +1236,7 @@ runPhase SplitAs _input_fn dflags -- regardless of the ordering. -- -- This is a temporary hack. - (if cTargetArch == Sparc + (if platformArch (targetPlatform dflags) == ArchSPARC then [SysTools.Option "-mcpu=v9"] else []) ++ @@ -1307,22 +1306,18 @@ runPhase LlvmOpt input_fn dflags -- fix up some pretty big deficiencies in the code we generate llvmOpts = ["-mem2reg", "-O1", "-O2"] - ----------------------------------------------------------------------------- -- LlvmLlc phase runPhase LlvmLlc input_fn dflags = do let lc_opts = getOpts dflags opt_lc - let opt_lvl = max 0 (min 2 $ optLevel dflags) - let nphase = if cTargetOS == OSX - then LlvmMangle - else As - let rmodel | opt_PIC = "pic" + opt_lvl = max 0 (min 2 $ optLevel dflags) + rmodel | opt_PIC = "pic" | not opt_Static = "dynamic-no-pic" | otherwise = "static" - output_fn <- phaseOutputFilename nphase + output_fn <- phaseOutputFilename LlvmMangle io $ SysTools.runLlvmLlc dflags ([ SysTools.Option (llvmOpts !! opt_lvl), @@ -1331,13 +1326,13 @@ runPhase LlvmLlc input_fn dflags SysTools.Option "-o", SysTools.FileOption "" output_fn] ++ map SysTools.Option lc_opts) - return (nphase, output_fn) + return (LlvmMangle, output_fn) where + -- Bug in LLVM at O3 on OSX. llvmOpts = if cTargetOS == OSX then ["-O1", "-O2", "-O2"] else ["-O1", "-O2", "-O3"] - ----------------------------------------------------------------------------- -- LlvmMangle phase