+-- This is used to determine the extension for the output from the
+-- current phase (if it generates a new file). The extension depends
+-- on the next phase in the pipeline.
+phaseInputExt (Unlit HsSrcFile) = "lhs"
+phaseInputExt (Unlit HsBootFile) = "lhs-boot"
+phaseInputExt (Unlit ExtCoreFile) = "lhcr"
+phaseInputExt (Cpp _) = "lpp" -- intermediate only
+phaseInputExt (HsPp _) = "hscpp" -- intermediate only
+phaseInputExt (Hsc _) = "hspp" -- intermediate only
+ -- NB: as things stand, phaseInputExt (Hsc x) must not evaluate x
+ -- because runPipeline uses the StopBefore phase to pick the
+ -- output filename. That could be fixed, but watch out.
+phaseInputExt HCc = "hc"
+phaseInputExt Cc = "c"
+phaseInputExt Mangle = "raw_s"
+phaseInputExt SplitMangle = "split_s" -- not really generated
+phaseInputExt As = "s"
+phaseInputExt SplitAs = "split_s" -- not really generated
+phaseInputExt CmmCpp = "cmm"
+phaseInputExt Cmm = "cmmcpp"
+phaseInputExt StopLn = "o"
+#ifdef ILX
+phaseInputExt Ilx2Il = "ilx"
+phaseInputExt Ilasm = "il"
+#endif
+
+haskellish_src_suffixes = haskellish_user_src_suffixes ++
+ [ "hspp", "hscpp", "hcr", "cmm" ]
+haskellish_suffixes = haskellish_src_suffixes ++ ["hc", "raw_s"]
+cish_suffixes = [ "c", "cpp", "C", "cc", "cxx", "s", "S" ]
+extcoreish_suffixes = [ "hcr" ]
+haskellish_user_src_suffixes = [ "hs", "lhs", "hs-boot", "lhs-boot" ] -- Will not be deleted as temp files
+
+-- Use the appropriate suffix for the system on which
+-- the GHC-compiled code will run