Add a debugTrace for the phases that we run
[ghc-hetmet.git] / compiler / main / DriverPhases.hs
index 4e7c05e..eb217ab 100644 (file)
@@ -35,7 +35,7 @@ module DriverPhases (
 
 #include "HsVersions.h"
 
-import Panic            ( panic )
+import Outputable
 import System.FilePath
 
 -----------------------------------------------------------------------------
@@ -82,6 +82,7 @@ data Phase
         | As
         | LlvmOpt       -- Run LLVM opt tool over llvm assembly
         | LlvmLlc       -- LLVM bitcode to native assembly
+        | LlvmMangle    -- Fix up TNTC by processing assembly produced by LLVM
         | CmmCpp        -- pre-process Cmm source
         | Cmm           -- parse & compile Cmm code
 
@@ -90,6 +91,9 @@ data Phase
         | StopLn        -- Stop, but linking will follow, so generate .o file
   deriving (Eq, Show)
 
+instance Outputable Phase where
+    ppr p = text (show p)
+
 anyHsc :: Phase
 anyHsc = Hsc (panic "anyHsc")
 
@@ -113,6 +117,7 @@ eqPhase SplitAs     SplitAs     = True
 eqPhase As          As          = True
 eqPhase LlvmOpt            LlvmOpt     = True
 eqPhase LlvmLlc            LlvmLlc     = True
+eqPhase LlvmMangle  LlvmMangle         = True
 eqPhase CmmCpp      CmmCpp      = True
 eqPhase Cmm         Cmm         = True
 eqPhase StopLn      StopLn      = True
@@ -138,7 +143,12 @@ nextPhase Mangle        = SplitMangle
 nextPhase SplitMangle   = As
 nextPhase As            = SplitAs
 nextPhase LlvmOpt       = LlvmLlc
+#if darwin_TARGET_OS
+nextPhase LlvmLlc       = LlvmMangle
+#else
 nextPhase LlvmLlc       = As
+#endif
+nextPhase LlvmMangle    = As
 nextPhase SplitAs       = StopLn
 nextPhase Ccpp          = As
 nextPhase Cc            = As
@@ -168,6 +178,7 @@ startPhase "s"        = As
 startPhase "S"        = As
 startPhase "ll"       = LlvmOpt
 startPhase "bc"       = LlvmLlc
+startPhase "lm_s"     = LlvmMangle
 startPhase "o"        = StopLn
 startPhase "cmm"      = CmmCpp
 startPhase "cmmcpp"   = Cmm
@@ -194,6 +205,7 @@ phaseInputExt SplitMangle         = "split_s"   -- not really generated
 phaseInputExt As                  = "s"
 phaseInputExt LlvmOpt             = "ll"
 phaseInputExt LlvmLlc             = "bc"
+phaseInputExt LlvmMangle          = "lm_s"
 phaseInputExt SplitAs             = "split_s"   -- not really generated
 phaseInputExt CmmCpp              = "cmm"
 phaseInputExt Cmm                 = "cmmcpp"