X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegAlloc%2FLinear%2FBase.hs;h=ebd31076e3c4151f3242c6860241a23620a6408d;hb=a12e845684c10955bc594cdb20d1f13fae14873d;hp=95c99653a88f5d4afb40f0965d0422d83511b484;hpb=cbc96da034482b769889c109f6cc822f42b12027;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegAlloc/Linear/Base.hs b/compiler/nativeGen/RegAlloc/Linear/Base.hs index 95c9965..ebd3107 100644 --- a/compiler/nativeGen/RegAlloc/Linear/Base.hs +++ b/compiler/nativeGen/RegAlloc/Linear/Base.hs @@ -3,7 +3,9 @@ module RegAlloc.Linear.Base ( BlockAssignment, + Loc(..), + regsOfLoc, -- for stats SpillReason(..), @@ -20,7 +22,7 @@ import RegAlloc.Linear.FreeRegs import RegAlloc.Linear.StackMap import RegLiveness -import MachRegs +import Regs import Outputable import Unique @@ -65,6 +67,13 @@ instance Outputable Loc where ppr l = text (show l) +-- | Get the reg numbers stored in this Loc. +regsOfLoc :: Loc -> [RegNo] +regsOfLoc (InReg r) = [r] +regsOfLoc (InBoth r _) = [r] +regsOfLoc (InMem _) = [] + + -- | Reasons why instructions might be inserted by the spiller. -- Used when generating stats for -ddrop-asm-stats. -- @@ -96,9 +105,10 @@ data RegAllocStats data RA_State = RA_State + { -- | the current mapping from basic blocks to -- the register assignments at the beginning of that block. - { ra_blockassig :: BlockAssignment + ra_blockassig :: BlockAssignment -- | free machine registers , ra_freeregs :: {-#UNPACK#-}!FreeRegs