diff options
Diffstat (limited to 'compiler/nativeGen')
| -rw-r--r-- | compiler/nativeGen/AsmCodeGen.lhs | 72 | ||||
| -rw-r--r-- | compiler/nativeGen/Instruction.hs | 8 | ||||
| -rw-r--r-- | compiler/nativeGen/PIC.hs | 12 | ||||
| -rw-r--r-- | compiler/nativeGen/PPC/CodeGen.hs | 8 | ||||
| -rw-r--r-- | compiler/nativeGen/PPC/Ppr.hs | 12 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/Coalesce.hs | 6 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/Main.hs | 8 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/Spill.hs | 8 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | 10 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/SpillCost.hs | 2 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/Stats.hs | 18 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Linear/Main.hs | 4 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Linear/Stats.hs | 4 | ||||
| -rw-r--r-- | compiler/nativeGen/RegAlloc/Liveness.hs | 44 | ||||
| -rw-r--r-- | compiler/nativeGen/SPARC/CodeGen.hs | 8 | ||||
| -rw-r--r-- | compiler/nativeGen/SPARC/CodeGen/Expand.hs | 2 | ||||
| -rw-r--r-- | compiler/nativeGen/SPARC/Ppr.hs | 12 | ||||
| -rw-r--r-- | compiler/nativeGen/X86/CodeGen.hs | 10 | ||||
| -rw-r--r-- | compiler/nativeGen/X86/Ppr.hs | 12 |
19 files changed, 130 insertions, 130 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs index aabe39af85..09963c4f7a 100644 --- a/compiler/nativeGen/AsmCodeGen.lhs +++ b/compiler/nativeGen/AsmCodeGen.lhs @@ -133,22 +133,22 @@ The machine-dependent bits break down as follows: -- Top-level of the native codegen data NcgImpl statics instr jumpDest = NcgImpl { - cmmTopCodeGen :: RawCmmTop -> NatM [NatCmmTop statics instr], - generateJumpTableForInstr :: instr -> Maybe (NatCmmTop statics instr), + cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl statics instr], + generateJumpTableForInstr :: instr -> Maybe (NatCmmDecl statics instr), getJumpDestBlockId :: jumpDest -> Maybe BlockId, canShortcut :: instr -> Maybe jumpDest, shortcutStatics :: (BlockId -> Maybe jumpDest) -> statics -> statics, shortcutJump :: (BlockId -> Maybe jumpDest) -> instr -> instr, - pprNatCmmTop :: Platform -> NatCmmTop statics instr -> Doc, + pprNatCmmDecl :: Platform -> NatCmmDecl statics instr -> Doc, maxSpillSlots :: Int, allocatableRegs :: [RealReg], - ncg_x86fp_kludge :: [NatCmmTop statics instr] -> [NatCmmTop statics instr], - ncgExpandTop :: [NatCmmTop statics instr] -> [NatCmmTop statics instr], + ncg_x86fp_kludge :: [NatCmmDecl statics instr] -> [NatCmmDecl statics instr], + ncgExpandTop :: [NatCmmDecl statics instr] -> [NatCmmDecl statics instr], ncgMakeFarBranches :: [NatBasicBlock instr] -> [NatBasicBlock instr] } -------------------- -nativeCodeGen :: DynFlags -> Handle -> UniqSupply -> [RawCmmPgm] -> IO () +nativeCodeGen :: DynFlags -> Handle -> UniqSupply -> [RawCmmGroup] -> IO () nativeCodeGen dflags h us cmms = let nCG' :: (Outputable statics, PlatformOutputable instr, Instruction instr) => NcgImpl statics instr jumpDest -> IO () nCG' ncgImpl = nativeCodeGen' dflags ncgImpl h us cmms @@ -159,7 +159,7 @@ nativeCodeGen dflags h us cmms ,canShortcut = X86.Instr.canShortcut ,shortcutStatics = X86.Instr.shortcutStatics ,shortcutJump = X86.Instr.shortcutJump - ,pprNatCmmTop = X86.Ppr.pprNatCmmTop + ,pprNatCmmDecl = X86.Ppr.pprNatCmmDecl ,maxSpillSlots = X86.Instr.maxSpillSlots ,allocatableRegs = X86.Regs.allocatableRegs ,ncg_x86fp_kludge = id @@ -177,7 +177,7 @@ nativeCodeGen dflags h us cmms ,canShortcut = PPC.RegInfo.canShortcut ,shortcutStatics = PPC.RegInfo.shortcutStatics ,shortcutJump = PPC.RegInfo.shortcutJump - ,pprNatCmmTop = PPC.Ppr.pprNatCmmTop + ,pprNatCmmDecl = PPC.Ppr.pprNatCmmDecl ,maxSpillSlots = PPC.Instr.maxSpillSlots ,allocatableRegs = PPC.Regs.allocatableRegs ,ncg_x86fp_kludge = id @@ -192,7 +192,7 @@ nativeCodeGen dflags h us cmms ,canShortcut = SPARC.ShortcutJump.canShortcut ,shortcutStatics = SPARC.ShortcutJump.shortcutStatics ,shortcutJump = SPARC.ShortcutJump.shortcutJump - ,pprNatCmmTop = SPARC.Ppr.pprNatCmmTop + ,pprNatCmmDecl = SPARC.Ppr.pprNatCmmDecl ,maxSpillSlots = SPARC.Instr.maxSpillSlots ,allocatableRegs = SPARC.Regs.allocatableRegs ,ncg_x86fp_kludge = id @@ -209,7 +209,7 @@ nativeCodeGen dflags h us cmms nativeCodeGen' :: (Outputable statics, PlatformOutputable instr, Instruction instr) => DynFlags -> NcgImpl statics instr jumpDest - -> Handle -> UniqSupply -> [RawCmmPgm] -> IO () + -> Handle -> UniqSupply -> [RawCmmGroup] -> IO () nativeCodeGen' dflags ncgImpl h us cmms = do let platform = targetPlatform dflags @@ -227,7 +227,7 @@ nativeCodeGen' dflags ncgImpl h us cmms -- dump native code dumpIfSet_dyn dflags Opt_D_dump_asm "Asm code" - (vcat $ map (docToSDoc . pprNatCmmTop ncgImpl platform) $ concat native) + (vcat $ map (docToSDoc . pprNatCmmDecl ncgImpl platform) $ concat native) -- dump global NCG stats for graph coloring allocator (case concat $ catMaybes colorStats of @@ -278,14 +278,14 @@ cmmNativeGens :: (Outputable statics, PlatformOutputable instr, Instruction inst -> NcgImpl statics instr jumpDest -> BufHandle -> UniqSupply - -> [RawCmmTop] + -> [RawCmmDecl] -> [[CLabel]] - -> [ ([NatCmmTop statics instr], + -> [ ([NatCmmDecl statics instr], Maybe [Color.RegAllocStats statics instr], Maybe [Linear.RegAllocStats]) ] -> Int -> IO ( [[CLabel]], - [([NatCmmTop statics instr], + [([NatCmmDecl statics instr], Maybe [Color.RegAllocStats statics instr], Maybe [Linear.RegAllocStats])] ) @@ -298,7 +298,7 @@ cmmNativeGens dflags ncgImpl h us (cmm : cmms) impAcc profAcc count <- cmmNativeGen dflags ncgImpl us cmm count Pretty.bufLeftRender h - $ {-# SCC "pprNativeCode" #-} Pretty.vcat $ map (pprNatCmmTop ncgImpl (targetPlatform dflags)) native + $ {-# SCC "pprNativeCode" #-} Pretty.vcat $ map (pprNatCmmDecl ncgImpl (targetPlatform dflags)) native -- carefully evaluate this strictly. Binding it with 'let' -- and then using 'seq' doesn't work, because the let @@ -332,10 +332,10 @@ cmmNativeGen => DynFlags -> NcgImpl statics instr jumpDest -> UniqSupply - -> RawCmmTop -- ^ the cmm to generate code for + -> RawCmmDecl -- ^ the cmm to generate code for -> Int -- ^ sequence number of this top thing -> IO ( UniqSupply - , [NatCmmTop statics instr] -- native code + , [NatCmmDecl statics instr] -- native code , [CLabel] -- things imported by this cmm , Maybe [Color.RegAllocStats statics instr] -- stats for the coloring register allocator , Maybe [Linear.RegAllocStats]) -- stats for the linear register allocators @@ -356,7 +356,7 @@ cmmNativeGen dflags ncgImpl us cmm count dumpIfSet_dyn dflags Opt_D_dump_opt_cmm "Optimised Cmm" - (pprCmmPgm platform [opt_cmm]) + (pprCmmGroup platform [opt_cmm]) -- generate native code from cmm let ((native, lastMinuteImports), usGen) = @@ -365,7 +365,7 @@ cmmNativeGen dflags ncgImpl us cmm count dumpIfSet_dyn dflags Opt_D_dump_asm_native "Native code" - (vcat $ map (docToSDoc . pprNatCmmTop ncgImpl platform) native) + (vcat $ map (docToSDoc . pprNatCmmDecl ncgImpl platform) native) -- tag instructions with register liveness information let (withLiveness, usLive) = @@ -403,7 +403,7 @@ cmmNativeGen dflags ncgImpl us cmm count -- dump out what happened during register allocation dumpIfSet_dyn dflags Opt_D_dump_asm_regalloc "Registers allocated" - (vcat $ map (docToSDoc . pprNatCmmTop ncgImpl platform) alloced) + (vcat $ map (docToSDoc . pprNatCmmDecl ncgImpl platform) alloced) dumpIfSet_dyn dflags Opt_D_dump_asm_regalloc_stages "Build/spill stages" @@ -434,7 +434,7 @@ cmmNativeGen dflags ncgImpl us cmm count dumpIfSet_dyn dflags Opt_D_dump_asm_regalloc "Registers allocated" - (vcat $ map (docToSDoc . pprNatCmmTop ncgImpl platform) alloced) + (vcat $ map (docToSDoc . pprNatCmmDecl ncgImpl platform) alloced) let mPprStats = if dopt Opt_D_dump_asm_stats dflags @@ -478,7 +478,7 @@ cmmNativeGen dflags ncgImpl us cmm count dumpIfSet_dyn dflags Opt_D_dump_asm_expanded "Synthetic instructions expanded" - (vcat $ map (docToSDoc . pprNatCmmTop ncgImpl platform) expanded) + (vcat $ map (docToSDoc . pprNatCmmDecl ncgImpl platform) expanded) return ( usAlloc , expanded @@ -487,7 +487,7 @@ cmmNativeGen dflags ncgImpl us cmm count , ppr_raStatsLinear) -x86fp_kludge :: NatCmmTop (Alignment, CmmStatics) X86.Instr.Instr -> NatCmmTop (Alignment, CmmStatics) X86.Instr.Instr +x86fp_kludge :: NatCmmDecl (Alignment, CmmStatics) X86.Instr.Instr -> NatCmmDecl (Alignment, CmmStatics) X86.Instr.Instr x86fp_kludge top@(CmmData _ _) = top x86fp_kludge (CmmProc info lbl (ListGraph code)) = CmmProc info lbl (ListGraph $ X86.Instr.i386_insert_ffrees code) @@ -502,7 +502,7 @@ makeImportsDoc dflags imports #if HAVE_SUBSECTIONS_VIA_SYMBOLS -- On recent versions of Darwin, the linker supports -- dead-stripping of code and data on a per-symbol basis. - -- There's a hack to make this work in PprMach.pprNatCmmTop. + -- There's a hack to make this work in PprMach.pprNatCmmDecl. Pretty.$$ Pretty.text ".subsections_via_symbols" #endif #if HAVE_GNU_NONEXEC_STACK @@ -560,7 +560,7 @@ makeImportsDoc dflags imports sequenceTop :: Instruction instr - => NcgImpl statics instr jumpDest -> NatCmmTop statics instr -> NatCmmTop statics instr + => NcgImpl statics instr jumpDest -> NatCmmDecl statics instr -> NatCmmDecl statics instr sequenceTop _ top@(CmmData _ _) = top sequenceTop ncgImpl (CmmProc info lbl (ListGraph blocks)) = @@ -675,7 +675,7 @@ makeFarBranches blocks -- table instructions. generateJumpTables :: NcgImpl statics instr jumpDest - -> [NatCmmTop statics instr] -> [NatCmmTop statics instr] + -> [NatCmmDecl statics instr] -> [NatCmmDecl statics instr] generateJumpTables ncgImpl xs = concatMap f xs where f p@(CmmProc _ _ (ListGraph xs)) = p : concatMap g xs f p = [p] @@ -687,8 +687,8 @@ generateJumpTables ncgImpl xs = concatMap f xs shortcutBranches :: DynFlags -> NcgImpl statics instr jumpDest - -> [NatCmmTop statics instr] - -> [NatCmmTop statics instr] + -> [NatCmmDecl statics instr] + -> [NatCmmDecl statics instr] shortcutBranches dflags ncgImpl tops | optLevel dflags < 1 = tops -- only with -O or higher @@ -698,8 +698,8 @@ shortcutBranches dflags ncgImpl tops mapping = foldr plusUFM emptyUFM mappings build_mapping :: NcgImpl statics instr jumpDest - -> GenCmmTop d t (ListGraph instr) - -> (GenCmmTop d t (ListGraph instr), UniqFM jumpDest) + -> GenCmmDecl d t (ListGraph instr) + -> (GenCmmDecl d t (ListGraph instr), UniqFM jumpDest) build_mapping _ top@(CmmData _ _) = (top, emptyUFM) build_mapping _ (CmmProc info lbl (ListGraph [])) = (CmmProc info lbl (ListGraph []), emptyUFM) @@ -729,8 +729,8 @@ build_mapping ncgImpl (CmmProc info lbl (ListGraph (head:blocks))) apply_mapping :: NcgImpl statics instr jumpDest -> UniqFM jumpDest - -> GenCmmTop statics h (ListGraph instr) - -> GenCmmTop statics h (ListGraph instr) + -> GenCmmDecl statics h (ListGraph instr) + -> GenCmmDecl statics h (ListGraph instr) apply_mapping ncgImpl ufm (CmmData sec statics) = CmmData sec (shortcutStatics ncgImpl (lookupUFM ufm) statics) apply_mapping ncgImpl ufm (CmmProc info lbl (ListGraph blocks)) @@ -763,10 +763,10 @@ apply_mapping ncgImpl ufm (CmmProc info lbl (ListGraph blocks)) genMachCode :: DynFlags - -> (RawCmmTop -> NatM [NatCmmTop statics instr]) - -> RawCmmTop + -> (RawCmmDecl -> NatM [NatCmmDecl statics instr]) + -> RawCmmDecl -> UniqSM - ( [NatCmmTop statics instr] + ( [NatCmmDecl statics instr] , [CLabel]) genMachCode dflags cmmTopCodeGen cmm_top @@ -807,7 +807,7 @@ Ideas for other things we could do (put these in Hoopl please!): temp assignments, and certain assigns to mem...) -} -cmmToCmm :: DynFlags -> RawCmmTop -> (RawCmmTop, [CLabel]) +cmmToCmm :: DynFlags -> RawCmmDecl -> (RawCmmDecl, [CLabel]) cmmToCmm _ top@(CmmData _ _) = (top, []) cmmToCmm dflags (CmmProc info lbl (ListGraph blocks)) = runCmmOpt dflags $ do blocks' <- mapM cmmBlockConFold (cmmMiniInline (cmmEliminateDeadBlocks blocks)) diff --git a/compiler/nativeGen/Instruction.hs b/compiler/nativeGen/Instruction.hs index 31827b9088..0d4161f843 100644 --- a/compiler/nativeGen/Instruction.hs +++ b/compiler/nativeGen/Instruction.hs @@ -3,7 +3,7 @@ module Instruction ( RegUsage(..), noUsage, NatCmm, - NatCmmTop, + NatCmmDecl, NatBasicBlock, Instruction(..) ) @@ -37,13 +37,13 @@ noUsage = RU [] [] -- Our flavours of the Cmm types -- Type synonyms for Cmm populated with native code type NatCmm instr - = GenCmmPgm + = GenCmmGroup CmmStatics (Maybe CmmStatics) (ListGraph instr) -type NatCmmTop statics instr - = GenCmmTop +type NatCmmDecl statics instr + = GenCmmDecl statics (Maybe CmmStatics) (ListGraph instr) diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs index 7f59fd6fc9..439f36d4b3 100644 --- a/compiler/nativeGen/PIC.hs +++ b/compiler/nativeGen/PIC.hs @@ -373,7 +373,7 @@ picRelative :: Arch -> OS -> CLabel -> CmmLit -- Darwin, but not x86_64: -- The PIC base register points to the PIC base label at the beginning --- of the current CmmTop. We just have to use a label difference to +-- of the current CmmDecl. We just have to use a label difference to -- get the offset. -- We have already made sure that all labels that are not from the current -- module are accessed indirectly ('as' can't calculate differences between @@ -681,7 +681,7 @@ pprImportedSymbol _ _ _ -- PIC base register. It adds the appropriate instructions to the -- top of the CmmProc. --- It is assumed that the first NatCmmTop in the input list is a Proc +-- It is assumed that the first NatCmmDecl in the input list is a Proc -- and the rest are CmmDatas. -- Darwin is simple: just fetch the address of a local label. @@ -709,8 +709,8 @@ pprImportedSymbol _ _ _ initializePicBase_ppc :: Arch -> OS -> Reg - -> [NatCmmTop CmmStatics PPC.Instr] - -> NatM [NatCmmTop CmmStatics PPC.Instr] + -> [NatCmmDecl CmmStatics PPC.Instr] + -> NatM [NatCmmDecl CmmStatics PPC.Instr] initializePicBase_ppc ArchPPC os picReg (CmmProc info lab (ListGraph blocks) : statics) @@ -761,8 +761,8 @@ initializePicBase_ppc _ _ _ _ initializePicBase_x86 :: Arch -> OS -> Reg - -> [NatCmmTop (Alignment, CmmStatics) X86.Instr] - -> NatM [NatCmmTop (Alignment, CmmStatics) X86.Instr] + -> [NatCmmDecl (Alignment, CmmStatics) X86.Instr] + -> NatM [NatCmmDecl (Alignment, CmmStatics) X86.Instr] initializePicBase_x86 ArchX86 os picReg (CmmProc info lab (ListGraph blocks) : statics) diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index b1936fe124..359a63392c 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -67,8 +67,8 @@ import FastString -- order. cmmTopCodeGen - :: RawCmmTop - -> NatM [NatCmmTop CmmStatics Instr] + :: RawCmmDecl + -> NatM [NatCmmDecl CmmStatics Instr] cmmTopCodeGen (CmmProc info lab (ListGraph blocks)) = do (nat_blocks,statics) <- mapAndUnzipM basicBlockCodeGen blocks @@ -87,7 +87,7 @@ cmmTopCodeGen (CmmData sec dat) = do basicBlockCodeGen :: CmmBasicBlock -> NatM ( [NatBasicBlock Instr] - , [NatCmmTop CmmStatics Instr]) + , [NatCmmDecl CmmStatics Instr]) basicBlockCodeGen (BasicBlock id stmts) = do instrs <- stmtsToInstrs stmts @@ -1184,7 +1184,7 @@ genSwitch expr ids ] return code -generateJumpTableForInstr :: Instr -> Maybe (NatCmmTop CmmStatics Instr) +generateJumpTableForInstr :: Instr -> Maybe (NatCmmDecl CmmStatics Instr) generateJumpTableForInstr (BCTR ids (Just lbl)) = let jumpTable | opt_PIC = map jumpTableEntryRel ids diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 54056c9e4d..4c73a329b5 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -7,7 +7,7 @@ ----------------------------------------------------------------------------- module PPC.Ppr ( - pprNatCmmTop, + pprNatCmmDecl, pprBasicBlock, pprSectionHeader, pprData, @@ -50,20 +50,20 @@ import Data.Bits -- ----------------------------------------------------------------------------- -- Printing this stuff out -pprNatCmmTop :: Platform -> NatCmmTop CmmStatics Instr -> Doc -pprNatCmmTop _ (CmmData section dats) = +pprNatCmmDecl :: Platform -> NatCmmDecl CmmStatics Instr -> Doc +pprNatCmmDecl _ (CmmData section dats) = pprSectionHeader section $$ pprDatas dats -- special case for split markers: -pprNatCmmTop _ (CmmProc Nothing lbl (ListGraph [])) = pprLabel lbl +pprNatCmmDecl _ (CmmProc Nothing lbl (ListGraph [])) = pprLabel lbl -- special case for code without an info table: -pprNatCmmTop platform (CmmProc Nothing lbl (ListGraph blocks)) = +pprNatCmmDecl platform (CmmProc Nothing lbl (ListGraph blocks)) = pprSectionHeader Text $$ pprLabel lbl $$ -- blocks guaranteed not null, so label needed vcat (map (pprBasicBlock platform) blocks) -pprNatCmmTop platform (CmmProc (Just (Statics info_lbl info)) _entry_lbl (ListGraph blocks)) = +pprNatCmmDecl platform (CmmProc (Just (Statics info_lbl info)) _entry_lbl (ListGraph blocks)) = pprSectionHeader Text $$ ( #if HAVE_SUBSECTIONS_VIA_SYMBOLS diff --git a/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs b/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs index a499e1d562..41901bb9da 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs @@ -27,8 +27,8 @@ import Data.List -- the same and the move instruction safely erased. regCoalesce :: Instruction instr - => [LiveCmmTop statics instr] - -> UniqSM [LiveCmmTop statics instr] + => [LiveCmmDecl statics instr] + -> UniqSM [LiveCmmDecl statics instr] regCoalesce code = do @@ -61,7 +61,7 @@ sinkReg fm r -- then we can rename the two regs to the same thing and eliminate the move. slurpJoinMovs :: Instruction instr - => LiveCmmTop statics instr + => LiveCmmDecl statics instr -> Bag (Reg, Reg) slurpJoinMovs live diff --git a/compiler/nativeGen/RegAlloc/Graph/Main.hs b/compiler/nativeGen/RegAlloc/Graph/Main.hs index 5321a34695..19497145f2 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Main.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Main.hs @@ -49,8 +49,8 @@ regAlloc => DynFlags -> UniqFM (UniqSet RealReg) -- ^ the registers we can use for allocation -> UniqSet Int -- ^ the set of available spill slots. - -> [LiveCmmTop statics instr] -- ^ code annotated with liveness information. - -> UniqSM ( [NatCmmTop statics instr], [RegAllocStats statics instr] ) + -> [LiveCmmDecl statics instr] -- ^ code annotated with liveness information. + -> UniqSM ( [NatCmmDecl statics instr], [RegAllocStats statics instr] ) -- ^ code with registers allocated and stats for each stage of -- allocation @@ -242,7 +242,7 @@ regAlloc_spin -- | Build a graph from the liveness and coalesce information in this code. buildGraph :: Instruction instr - => [LiveCmmTop statics instr] + => [LiveCmmDecl statics instr] -> UniqSM (Color.Graph VirtualReg RegClass RealReg) buildGraph code @@ -325,7 +325,7 @@ graphAddCoalesce _ _ patchRegsFromGraph :: (Outputable statics, PlatformOutputable instr, Instruction instr) => Platform -> Color.Graph VirtualReg RegClass RealReg - -> LiveCmmTop statics instr -> LiveCmmTop statics instr + -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr patchRegsFromGraph platform graph code = let diff --git a/compiler/nativeGen/RegAlloc/Graph/Spill.hs b/compiler/nativeGen/RegAlloc/Graph/Spill.hs index c4fb783688..e44a65daf5 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Spill.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Spill.hs @@ -41,11 +41,11 @@ import qualified Data.Set as Set -- regSpill :: Instruction instr - => [LiveCmmTop statics instr] -- ^ the code + => [LiveCmmDecl statics instr] -- ^ the code -> UniqSet Int -- ^ available stack slots -> UniqSet VirtualReg -- ^ the regs to spill -> UniqSM - ([LiveCmmTop statics instr] -- code with SPILL and RELOAD meta instructions added. + ([LiveCmmDecl statics instr] -- code with SPILL and RELOAD meta instructions added. , UniqSet Int -- left over slots , SpillStats ) -- stats about what happened during spilling @@ -81,8 +81,8 @@ regSpill code slotsFree regs regSpill_top :: Instruction instr => RegMap Int -- ^ map of vregs to slots they're being spilled to. - -> LiveCmmTop statics instr -- ^ the top level thing. - -> SpillM (LiveCmmTop statics instr) + -> LiveCmmDecl statics instr -- ^ the top level thing. + -> SpillM (LiveCmmDecl statics instr) regSpill_top regSlotMap cmm = case cmm of diff --git a/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs b/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs index da13eab045..94c274dfaf 100644 --- a/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs +++ b/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs @@ -55,7 +55,7 @@ type Slot = Int -- | Clean out unneeded spill\/reloads from this top level thing. cleanSpills :: Instruction instr - => Platform -> LiveCmmTop statics instr -> LiveCmmTop statics instr + => Platform -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr cleanSpills platform cmm = evalState (cleanSpin platform 0 cmm) initCleanS @@ -65,8 +65,8 @@ cleanSpin :: Instruction instr => Platform -> Int - -> LiveCmmTop statics instr - -> CleanM (LiveCmmTop statics instr) + -> LiveCmmDecl statics instr + -> CleanM (LiveCmmDecl statics instr) {- cleanSpin _ spinCount code @@ -287,8 +287,8 @@ cleanReload _ _ _ _ -- cleanTopBackward :: Instruction instr - => LiveCmmTop statics instr - -> CleanM (LiveCmmTop statics instr) + => LiveCmmDecl statics instr + -> CleanM (LiveCmmDecl statics instr) cleanTopBackward cmm = case cmm of diff --git a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs index 3ea150a3df..e11532e15f 100644 --- a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs +++ b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs @@ -65,7 +65,7 @@ plusSpillCostRecord (r1, a1, b1, c1) (r2, a2, b2, c2) -- slurpSpillCostInfo :: (PlatformOutputable instr, Instruction instr) => Platform - -> LiveCmmTop statics instr + -> LiveCmmDecl statics instr -> SpillCostInfo slurpSpillCostInfo platform cmm diff --git a/compiler/nativeGen/RegAlloc/Graph/Stats.hs b/compiler/nativeGen/RegAlloc/Graph/Stats.hs index 15ec6e7f87..2d783f82ec 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Stats.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Stats.hs @@ -40,29 +40,29 @@ data RegAllocStats statics instr -- initial graph = RegAllocStatsStart - { raLiveCmm :: [LiveCmmTop statics instr] -- ^ initial code, with liveness + { raLiveCmm :: [LiveCmmDecl statics instr] -- ^ initial code, with liveness , raGraph :: Color.Graph VirtualReg RegClass RealReg -- ^ the initial, uncolored graph , raSpillCosts :: SpillCostInfo } -- ^ information to help choose which regs to spill -- a spill stage | RegAllocStatsSpill - { raCode :: [LiveCmmTop statics instr] -- ^ the code we tried to allocate registers for + { raCode :: [LiveCmmDecl statics instr] -- ^ the code we tried to allocate registers for , raGraph :: Color.Graph VirtualReg RegClass RealReg -- ^ the partially colored graph , raCoalesced :: UniqFM VirtualReg -- ^ the regs that were coaleced , raSpillStats :: SpillStats -- ^ spiller stats , raSpillCosts :: SpillCostInfo -- ^ number of instrs each reg lives for - , raSpilled :: [LiveCmmTop statics instr] } -- ^ code with spill instructions added + , raSpilled :: [LiveCmmDecl statics instr] } -- ^ code with spill instructions added -- a successful coloring | RegAllocStatsColored - { raCode :: [LiveCmmTop statics instr] -- ^ the code we tried to allocate registers for + { raCode :: [LiveCmmDecl statics instr] -- ^ the code we tried to allocate registers for , raGraph :: Color.Graph VirtualReg RegClass RealReg -- ^ the uncolored graph , raGraphColored :: Color.Graph VirtualReg RegClass RealReg -- ^ the coalesced and colored graph , raCoalesced :: UniqFM VirtualReg -- ^ the regs that were coaleced - , raCodeCoalesced :: [LiveCmmTop statics instr] -- ^ code with coalescings applied - , raPatched :: [LiveCmmTop statics instr] -- ^ code with vregs replaced by hregs - , raSpillClean :: [LiveCmmTop statics instr] -- ^ code with unneeded spill\/reloads cleaned out - , raFinal :: [NatCmmTop statics instr] -- ^ final code + , raCodeCoalesced :: [LiveCmmDecl statics instr] -- ^ code with coalescings applied + , raPatched :: [LiveCmmDecl statics instr] -- ^ code with vregs replaced by hregs + , raSpillClean :: [LiveCmmDecl statics instr] -- ^ code with unneeded spill\/reloads cleaned out + , raFinal :: [NatCmmDecl statics instr] -- ^ final code , raSRMs :: (Int, Int, Int) } -- ^ spill\/reload\/reg-reg moves present in this code instance (Outputable statics, PlatformOutputable instr) => PlatformOutputable (RegAllocStats statics instr) where @@ -256,7 +256,7 @@ pprStatsLifeConflict stats graph -- Lets us see how well the register allocator has done. countSRMs :: Instruction instr - => LiveCmmTop statics instr -> (Int, Int, Int) + => LiveCmmDecl statics instr -> (Int, Int, Int) countSRMs cmm = execState (mapBlockTopM countSRM_block cmm) (0, 0, 0) diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs index f1af6a5e39..fc0bde44a0 100644 --- a/compiler/nativeGen/RegAlloc/Linear/Main.hs +++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs @@ -129,8 +129,8 @@ import Control.Monad regAlloc :: (PlatformOutputable instr, Instruction instr) => DynFlags - -> LiveCmmTop statics instr - -> UniqSM (NatCmmTop statics instr, Maybe RegAllocStats) + -> LiveCmmDecl statics instr + -> UniqSM (NatCmmDecl statics instr, Maybe RegAllocStats) regAlloc _ (CmmData sec d) = return diff --git a/compiler/nativeGen/RegAlloc/Linear/Stats.hs b/compiler/nativeGen/RegAlloc/Linear/Stats.hs index 0c059eac27..21664b12ba 100644 --- a/compiler/nativeGen/RegAlloc/Linear/Stats.hs +++ b/compiler/nativeGen/RegAlloc/Linear/Stats.hs @@ -37,7 +37,7 @@ binSpillReasons reasons -- | Count reg-reg moves remaining in this code. countRegRegMovesNat :: Instruction instr - => NatCmmTop statics instr -> Int + => NatCmmDecl statics instr -> Int countRegRegMovesNat cmm = execState (mapGenBlockTopM countBlock cmm) 0 @@ -58,7 +58,7 @@ countRegRegMovesNat cmm -- | Pretty print some RegAllocStats pprStats :: Instruction instr - => [NatCmmTop statics instr] -> [RegAllocStats] -> SDoc + => [NatCmmDecl statics instr] -> [RegAllocStats] -> SDoc pprStats code statss = let -- sum up all the instrs inserted by the spiller diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs index 2b7975dcb4..a5e8579f47 100644 --- a/compiler/nativeGen/RegAlloc/Liveness.hs +++ b/compiler/nativeGen/RegAlloc/Liveness.hs @@ -11,7 +11,7 @@ module RegAlloc.Liveness ( RegSet, RegMap, emptyRegMap, BlockMap, emptyBlockMap, - LiveCmmTop, + LiveCmmDecl, InstrSR (..), LiveInstr (..), Liveness (..), @@ -67,8 +67,8 @@ type BlockMap a = BlockEnv a -- | A top level thing which carries liveness information. -type LiveCmmTop statics instr - = GenCmmTop +type LiveCmmDecl statics instr + = GenCmmDecl statics LiveInfo [SCC (LiveBasicBlock instr)] @@ -226,7 +226,7 @@ instance Outputable LiveInfo where -- mapBlockTop :: (LiveBasicBlock instr -> LiveBasicBlock instr) - -> LiveCmmTop statics instr -> LiveCmmTop statics instr + -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr mapBlockTop f cmm = evalState (mapBlockTopM (\x -> return $ f x) cmm) () @@ -237,7 +237,7 @@ mapBlockTop f cmm mapBlockTopM :: Monad m => (LiveBasicBlock instr -> m (LiveBasicBlock instr)) - -> LiveCmmTop statics instr -> m (LiveCmmTop statics instr) + -> LiveCmmDecl statics instr -> m (LiveCmmDecl statics instr) mapBlockTopM _ cmm@(CmmData{}) = return cmm @@ -259,7 +259,7 @@ mapSCCM f (CyclicSCC xs) -- map a function across all the basic blocks in this code mapGenBlockTop :: (GenBasicBlock i -> GenBasicBlock i) - -> (GenCmmTop d h (ListGraph i) -> GenCmmTop d h (ListGraph i)) + -> (GenCmmDecl d h (ListGraph i) -> GenCmmDecl d h (ListGraph i)) mapGenBlockTop f cmm = evalState (mapGenBlockTopM (\x -> return $ f x) cmm) () @@ -269,7 +269,7 @@ mapGenBlockTop f cmm mapGenBlockTopM :: Monad m => (GenBasicBlock i -> m (GenBasicBlock i)) - -> (GenCmmTop d h (ListGraph i) -> m (GenCmmTop d h (ListGraph i))) + -> (GenCmmDecl d h (ListGraph i) -> m (GenCmmDecl d h (ListGraph i))) mapGenBlockTopM _ cmm@(CmmData{}) = return cmm @@ -285,7 +285,7 @@ mapGenBlockTopM f (CmmProc header label (ListGraph blocks)) -- slurpConflicts :: Instruction instr - => LiveCmmTop statics instr + => LiveCmmDecl statics instr -> (Bag (UniqSet Reg), Bag (Reg, Reg)) slurpConflicts live @@ -360,7 +360,7 @@ slurpConflicts live -- slurpReloadCoalesce :: forall statics instr. Instruction instr - => LiveCmmTop statics instr + => LiveCmmDecl statics instr -> Bag (Reg, Reg) slurpReloadCoalesce live @@ -368,7 +368,7 @@ slurpReloadCoalesce live where slurpCmm :: Bag (Reg, Reg) - -> GenCmmTop t t1 [SCC (LiveBasicBlock instr)] + -> GenCmmDecl t t1 [SCC (LiveBasicBlock instr)] -> Bag (Reg, Reg) slurpCmm cs CmmData{} = cs slurpCmm cs (CmmProc _ _ sccs) @@ -458,12 +458,12 @@ slurpReloadCoalesce live Just r2 -> r1 == r2 ] --- | Strip away liveness information, yielding NatCmmTop +-- | Strip away liveness information, yielding NatCmmDecl stripLive :: (Outputable statics, PlatformOutputable instr, Instruction instr) => Platform - -> LiveCmmTop statics instr - -> NatCmmTop statics instr + -> LiveCmmDecl statics instr + -> NatCmmDecl statics instr stripLive platform live = stripCmm live @@ -528,8 +528,8 @@ stripLiveBlock platform (BasicBlock i lis) eraseDeltasLive :: Instruction instr - => LiveCmmTop statics instr - -> LiveCmmTop statics instr + => LiveCmmDecl statics instr + -> LiveCmmDecl statics instr eraseDeltasLive cmm = mapBlockTop eraseBlock cmm @@ -546,7 +546,7 @@ eraseDeltasLive cmm patchEraseLive :: Instruction instr => (Reg -> Reg) - -> LiveCmmTop statics instr -> LiveCmmTop statics instr + -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr patchEraseLive patchF cmm = patchCmm cmm @@ -619,12 +619,12 @@ patchRegsLiveInstr patchF li -------------------------------------------------------------------------------- --- | Convert a NatCmmTop to a LiveCmmTop, with empty liveness information +-- | Convert a NatCmmDecl to a LiveCmmDecl, with empty liveness information natCmmTopToLive :: Instruction instr - => NatCmmTop statics instr - -> LiveCmmTop statics instr + => NatCmmDecl statics instr + -> LiveCmmDecl statics instr natCmmTopToLive (CmmData i d) = CmmData i d @@ -662,8 +662,8 @@ sccBlocks blocks = stronglyConnCompFromEdgedVertices graph regLiveness :: (PlatformOutputable instr, Instruction instr) => Platform - -> LiveCmmTop statics instr - -> UniqSM (LiveCmmTop statics instr) + -> LiveCmmDecl statics instr + -> UniqSM (LiveCmmDecl statics instr) regLiveness _ (CmmData i d) = returnUs $ CmmData i d @@ -724,7 +724,7 @@ checkIsReverseDependent sccs' -- | If we've compute liveness info for this code already we have to reverse -- the SCCs in each top to get them back to the right order so we can do it again. -reverseBlocksInTops :: LiveCmmTop statics instr -> LiveCmmTop statics instr +reverseBlocksInTops :: LiveCmmDecl statics instr -> LiveCmmDecl statics instr reverseBlocksInTops top = case top of CmmData{} -> top diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs index 6f454a3733..acdf41c2bd 100644 --- a/compiler/nativeGen/SPARC/CodeGen.hs +++ b/compiler/nativeGen/SPARC/CodeGen.hs @@ -51,8 +51,8 @@ import Unique import Control.Monad ( mapAndUnzipM ) -- | Top level code generation -cmmTopCodeGen :: RawCmmTop - -> NatM [NatCmmTop CmmStatics Instr] +cmmTopCodeGen :: RawCmmDecl + -> NatM [NatCmmDecl CmmStatics Instr] cmmTopCodeGen (CmmProc info lab (ListGraph blocks)) = do @@ -77,7 +77,7 @@ cmmTopCodeGen (CmmData sec dat) = do basicBlockCodeGen :: Platform -> CmmBasicBlock -> NatM ( [NatBasicBlock Instr] - , [NatCmmTop CmmStatics Instr]) + , [NatCmmDecl CmmStatics Instr]) basicBlockCodeGen platform cmm@(BasicBlock id stmts) = do instrs <- stmtsToInstrs stmts @@ -315,7 +315,7 @@ genSwitch expr ids , JMP_TBL (AddrRegImm dst (ImmInt 0)) ids label , NOP ] -generateJumpTableForInstr :: Instr -> Maybe (NatCmmTop CmmStatics Instr) +generateJumpTableForInstr :: Instr -> Maybe (NatCmmDecl CmmStatics Instr) generateJumpTableForInstr (JMP_TBL _ ids label) = let jumpTable = map jumpTableEntry ids in Just (CmmData ReadOnlyData (Statics label jumpTable)) diff --git a/compiler/nativeGen/SPARC/CodeGen/Expand.hs b/compiler/nativeGen/SPARC/CodeGen/Expand.hs index 3e49f5c025..f65cbaa01a 100644 --- a/compiler/nativeGen/SPARC/CodeGen/Expand.hs +++ b/compiler/nativeGen/SPARC/CodeGen/Expand.hs @@ -21,7 +21,7 @@ import Outputable import OrdList -- | Expand out synthetic instructions in this top level thing -expandTop :: NatCmmTop CmmStatics Instr -> NatCmmTop CmmStatics Instr +expandTop :: NatCmmDecl CmmStatics Instr -> NatCmmDecl CmmStatics Instr expandTop top@(CmmData{}) = top diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs index bf3fd3c303..e9859fe297 100644 --- a/compiler/nativeGen/SPARC/Ppr.hs +++ b/compiler/nativeGen/SPARC/Ppr.hs @@ -7,7 +7,7 @@ ----------------------------------------------------------------------------- module SPARC.Ppr ( - pprNatCmmTop, + pprNatCmmDecl, pprBasicBlock, pprSectionHeader, pprData, @@ -48,20 +48,20 @@ import Data.Word -- ----------------------------------------------------------------------------- -- Printing this stuff out -pprNatCmmTop :: Platform -> NatCmmTop CmmStatics Instr -> Doc -pprNatCmmTop _ (CmmData section dats) = +pprNatCmmDecl :: Platform -> NatCmmDecl CmmStatics Instr -> Doc +pprNatCmmDecl _ (CmmData section dats) = pprSectionHeader section $$ pprDatas dats -- special case for split markers: -pprNatCmmTop _ (CmmProc Nothing lbl (ListGraph [])) = pprLabel lbl +pprNatCmmDecl _ (CmmProc Nothing lbl (ListGraph [])) = pprLabel lbl -- special case for code without info table: -pprNatCmmTop _ (CmmProc Nothing lbl (ListGraph blocks)) = +pprNatCmmDecl _ (CmmProc Nothing lbl (ListGraph blocks)) = pprSectionHeader Text $$ pprLabel lbl $$ -- blocks guaranteed not null, so label needed vcat (map pprBasicBlock blocks) -pprNatCmmTop _ (CmmProc (Just (Statics info_lbl info)) _entry_lbl (ListGraph blocks)) = +pprNatCmmDecl _ (CmmProc (Just (Statics info_lbl info)) _entry_lbl (ListGraph blocks)) = pprSectionHeader Text $$ ( #if HAVE_SUBSECTIONS_VIA_SYMBOLS diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index b929c5eb2e..5474905f9b 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -85,8 +85,8 @@ if_sse2 sse2 x87 = do if b then sse2 else x87 cmmTopCodeGen - :: RawCmmTop - -> NatM [NatCmmTop (Alignment, CmmStatics) Instr] + :: RawCmmDecl + -> NatM [NatCmmDecl (Alignment, CmmStatics) Instr] cmmTopCodeGen (CmmProc info lab (ListGraph blocks)) = do (nat_blocks,statics) <- mapAndUnzipM basicBlockCodeGen blocks @@ -107,7 +107,7 @@ cmmTopCodeGen (CmmData sec dat) = do basicBlockCodeGen :: CmmBasicBlock -> NatM ( [NatBasicBlock Instr] - , [NatCmmTop (Alignment, CmmStatics) Instr]) + , [NatCmmDecl (Alignment, CmmStatics) Instr]) basicBlockCodeGen (BasicBlock id stmts) = do instrs <- stmtsToInstrs stmts @@ -2080,11 +2080,11 @@ genSwitch expr ids -- in return code -generateJumpTableForInstr :: Instr -> Maybe (NatCmmTop (Alignment, CmmStatics) Instr) +generateJumpTableForInstr :: Instr -> Maybe (NatCmmDecl (Alignment, CmmStatics) Instr) generateJumpTableForInstr (JMP_TBL _ ids section lbl) = Just (createJumpTable ids section lbl) generateJumpTableForInstr _ = Nothing -createJumpTable :: [Maybe BlockId] -> Section -> CLabel -> GenCmmTop (Alignment, CmmStatics) h g +createJumpTable :: [Maybe BlockId] -> Section -> CLabel -> GenCmmDecl (Alignment, CmmStatics) h g createJumpTable ids section lbl = let jumpTable | opt_PIC = diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 9ac33f2598..8c12e29b1a 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -7,7 +7,7 @@ ----------------------------------------------------------------------------- module X86.Ppr ( - pprNatCmmTop, + pprNatCmmDecl, pprBasicBlock, pprSectionHeader, pprData, @@ -50,21 +50,21 @@ import Data.Bits -- ----------------------------------------------------------------------------- -- Printing this stuff out -pprNatCmmTop :: Platform -> NatCmmTop (Alignment, CmmStatics) Instr -> Doc -pprNatCmmTop platform (CmmData section dats) = +pprNatCmmDecl :: Platform -> NatCmmDecl (Alignment, CmmStatics) Instr -> Doc +pprNatCmmDecl platform (CmmData section dats) = pprSectionHeader section $$ pprDatas platform dats -- special case for split markers: -pprNatCmmTop platform (CmmProc Nothing lbl (ListGraph [])) = pprLabel platform lbl +pprNatCmmDecl platform (CmmProc Nothing lbl (ListGraph [])) = pprLabel platform lbl -- special case for code without info table: -pprNatCmmTop platform (CmmProc Nothing lbl (ListGraph blocks)) = +pprNatCmmDecl platform (CmmProc Nothing lbl (ListGraph blocks)) = pprSectionHeader Text $$ pprLabel platform lbl $$ -- blocks guaranteed not null, so label needed vcat (map (pprBasicBlock platform) blocks) $$ pprSizeDecl platform lbl -pprNatCmmTop platform (CmmProc (Just (Statics info_lbl info)) _entry_lbl (ListGraph blocks)) = +pprNatCmmDecl platform (CmmProc (Just (Statics info_lbl info)) _entry_lbl (ListGraph blocks)) = pprSectionHeader Text $$ ( #if HAVE_SUBSECTIONS_VIA_SYMBOLS |
