X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegAlloc%2FLinear%2FState.hs;h=b9f70498448c9e5a54a56dd36d67d30fefe5633e;hb=de29a9f02449359b70402f763ac7590673774124;hp=428b0caec9ec63f46fb85296db9b50fae3570da6;hpb=cbc96da034482b769889c109f6cc822f42b12027;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegAlloc/Linear/State.hs b/compiler/nativeGen/RegAlloc/Linear/State.hs index 428b0ca..b9f7049 100644 --- a/compiler/nativeGen/RegAlloc/Linear/State.hs +++ b/compiler/nativeGen/RegAlloc/Linear/State.hs @@ -33,12 +33,9 @@ import RegAlloc.Linear.Stats import RegAlloc.Linear.StackMap import RegAlloc.Linear.Base import RegAlloc.Linear.FreeRegs - - -import MachInstrs -import MachRegs -import RegAllocInfo -import RegLiveness +import RegAlloc.Liveness +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 #)