[project @ 2000-02-02 11:40:33 by sewardj]
[ghc-hetmet.git] / ghc / compiler / nativeGen / AsmCodeGen.lhs
index 7da3a0b..fe2fcbf 100644 (file)
@@ -19,11 +19,12 @@ import PprMach
 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 )
@@ -103,12 +104,19 @@ codeGen stixFinal
 
         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:
@@ -129,7 +137,7 @@ might be needed.
 scheduleMachCode :: [InstrList] -> [[Instr]]
 
 scheduleMachCode
-  = map (runRegAllocate freeRegsState reservedRegs)
+  = map (runRegAllocate freeRegsState findReservedRegs)
   where
     freeRegsState = mkMRegsState (extractMappedRegNos freeRegs)
 \end{code}