RegAlloc.Graph.Coalesce

ghc-8.6.3: The GHC API

Safe Haskell | None
Language | Haskell2010

RegAlloc.Graph.Coalesce

Description

Register coalescing.

Synopsis

- regCoalesce :: Instruction instr => [LiveCmmDecl statics instr] -> UniqSM [LiveCmmDecl statics instr]
- slurpJoinMovs :: Instruction instr => LiveCmmDecl statics instr -> Bag (Reg, Reg)

# Documentation

regCoalesce :: Instruction instr => [LiveCmmDecl statics instr] -> UniqSM [LiveCmmDecl statics instr] #

Do register coalescing on this top level thing

For Reg -> Reg moves, if the first reg dies at the same time the second reg is born then the mov only serves to join live ranges. The two regs can be renamed to be the same and the move instruction safely erased.

slurpJoinMovs :: Instruction instr => LiveCmmDecl statics instr -> Bag (Reg, Reg) #

Slurp out mov instructions that only serve to join live ranges.

During a mov, if the source reg dies and the destination reg is born then we can rename the two regs to the same thing and eliminate the move.