X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegAlloc%2FLinear%2FState.hs;fp=compiler%2FnativeGen%2FRegAlloc%2FLinear%2FState.hs;h=b9f70498448c9e5a54a56dd36d67d30fefe5633e;hb=b04a210e26ca57242fd052f2aa91011a80b76299;hp=94a8f7b52e7590125f5bd905446911d8a3b92966;hpb=77ed23d51b968505b3ad8541c075657ae94f0ea3;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegAlloc/Linear/State.hs b/compiler/nativeGen/RegAlloc/Linear/State.hs index 94a8f7b..b9f7049 100644 --- a/compiler/nativeGen/RegAlloc/Linear/State.hs +++ b/compiler/nativeGen/RegAlloc/Linear/State.hs @@ -34,11 +34,8 @@ import RegAlloc.Linear.StackMap import RegAlloc.Linear.Base import RegAlloc.Linear.FreeRegs import RegAlloc.Liveness - - -import Instrs -import Regs -import RegAllocInfo +import Instruction +import Reg import Unique import UniqSupply @@ -85,14 +82,19 @@ makeRAStats state { ra_spillInstrs = binSpillReasons (ra_spills state) } -spillR :: Reg -> Unique -> RegM (Instr, Int) +spillR :: Instruction instr + => Reg -> Unique -> RegM (instr, Int) + spillR reg temp = RegM $ \ s@RA_State{ra_delta=delta, ra_stack=stack} -> let (stack',slot) = getStackSlotFor stack temp instr = mkSpillInstr reg delta slot in (# s{ra_stack=stack'}, (instr,slot) #) -loadR :: Reg -> Int -> RegM Instr + +loadR :: Instruction instr + => Reg -> Int -> RegM instr + loadR reg slot = RegM $ \ s@RA_State{ra_delta=delta} -> (# s, mkLoadInstr reg delta slot #)