import AbsCStixGen ( genCodeAbstractC )
import AbsCSyn ( AbstractC, MagicId )
import AsmRegAlloc ( runRegAllocate )
-import OrdList ( OrdList )
+import OrdList ( OrdList, flattenOrdList )
import PrimOp ( commutableOp, PrimOp(..) )
-import RegAllocInfo ( mkMRegsState, MRegsState )
-import Stix ( StixTree(..), StixReg(..), pprStixTrees )
-import PrimRep ( isFloatingRep )
+import RegAllocInfo ( mkMRegsState, MRegsState, findReservedRegs )
+import Stix ( StixTree(..), StixReg(..),
+ pprStixTrees, CodeSegment(..) )
+import PrimRep ( isFloatingRep, PrimRep(..) )
import UniqSupply ( returnUs, thenUs, mapUs, initUs,
initUs_, UniqSM, UniqSupply )
import UniqFM ( UniqFM, emptyUFM, addToUFM, lookupUFM )
static_instrss :: [[Instr]]
static_instrss = map fp_kludge (scheduleMachCode dynamic_codes)
- docs = map (vcat . map pprInstr) static_instrss
+ docs = map (vcat . map pprInstr) static_instrss
+
+ -- for debugging only
+ docs_prealloc = map (vcat . map pprInstr . flattenOrdList)
+ dynamic_codes
+ text_prealloc = vcat (intersperse (char ' ' $$ char ' ') docs_prealloc)
in
+ -- trace (showSDoc text_prealloc) (
returnUs (vcat (intersperse (char ' '
$$ text "# ___stg_split_marker"
$$ char ' ')
docs))
+ -- )
\end{code}
Top level code generator for a chunk of stix code:
scheduleMachCode :: [InstrList] -> [[Instr]]
scheduleMachCode
- = map (runRegAllocate freeRegsState reservedRegs)
+ = map (runRegAllocate freeRegsState findReservedRegs)
where
freeRegsState = mkMRegsState (extractMappedRegNos freeRegs)
\end{code}