Used to store the register assignment on entry to a basic block. We use this to handle join points, where multiple branch instructions target a particular label. We have to insert fixup code to make the register assignments from the different sources match up.
Moduleghc-9.10.3GHC2021
GHC.CmmToAsm.Reg.Linear.Base
Put common type definitions here to break recursive module dependencies.
- 5 types
- 5 values
- Packageghc-9.10.3
- Exports10
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceBase.hs
Find the register mapping for a specific BlockId.
Lookup which register a virtual register was first assigned to.
An initial empty BlockAssignment
Add new register mappings for a specific block.
Where a vreg is currently stored A temporary can be marked as living in both a register and memory (InBoth), for example if it was recently loaded from a spill location. This makes it cheap to spill (no save instruction required), but we have to be careful to turn this into InReg if the value in the register is changed.
Get the reg numbers stored in this Loc.
Reasons why instructions might be inserted by the spiller. Used when generating stats for -ddrop-asm-stats.
Constructors
SpillAlloc !Uniquevreg was spilled to a slot so we could use its current hreg for another vreg
SpillClobber !Uniquevreg was moved because its hreg was clobbered
SpillLoad !Uniquevreg was loaded from a spill slot
SpillJoinRR !Uniquereg-reg move inserted during join to targets
SpillJoinRM !Uniquereg-mem move inserted during join to targets
Used to carry interesting stats out of the register allocator.
Constructors
RegAllocStatsra_spillInstrs :: UniqFM Unique [Int]ra_fixupList :: [(BlockId, BlockId, BlockId)](from,fixup,to) : We inserted fixup code between from and to
The register allocator state
Constructors
RA_Statera_blockassig :: BlockAssignment freeRegsthe current mapping from basic blocks to the register assignments at the beginning of that block.
ra_freeregs :: !freeRegsfree machine registers
ra_assig :: RegMap Locassignment of temps to locations
ra_delta :: Intcurrent stack delta
ra_stack :: StackMapfree stack slots for spilling
ra_us :: UniqSupplyunique supply for generating names for join point fixup blocks.
ra_spills :: [SpillReason]Record why things were spilled, for -ddrop-asm-stats. Just keep a list here instead of a map of regs -> reasons. We don't want to slow down the allocator if we're not going to emit the stats.
ra_config :: !NCGConfigNative code generator configuration
ra_fixups :: [(BlockId, BlockId, BlockId)](from,fixup,to) : We inserted fixup code between from and to