ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

Reg

Description

An architecture independent description of a register. This needs to stay architecture independent because it is used by NCGMonad and the register allocators, which are shared by all architectures.

Synopsis

- type RegNo = Int
- data Reg
  - = RegVirtual !VirtualReg
  - | RegReal !RealReg
- regPair :: RegNo -> RegNo -> Reg
- regSingle :: RegNo -> Reg
- isRealReg :: Reg -> Bool
- takeRealReg :: Reg -> Maybe RealReg
- isVirtualReg :: Reg -> Bool
- takeVirtualReg :: Reg -> Maybe VirtualReg
- data VirtualReg
  - = VirtualRegI !Unique
  - | VirtualRegHi !Unique
  - | VirtualRegF !Unique
  - | VirtualRegD !Unique
  - | VirtualRegSSE !Unique
- renameVirtualReg :: Unique -> VirtualReg -> VirtualReg
- classOfVirtualReg :: VirtualReg -> RegClass
- getHiVirtualRegFromLo :: VirtualReg -> VirtualReg
- getHiVRegFromLo :: Reg -> Reg
- data RealReg
  - = RealRegSingle !RegNo
  - | RealRegPair !RegNo !RegNo
- regNosOfRealReg :: RealReg -> [RegNo]
- realRegsAlias :: RealReg -> RealReg -> Bool
- liftPatchFnToRegReg :: (VirtualReg -> RealReg) -> Reg -> Reg

# Documentation

type RegNo = Int #

An identifier for a primitive real machine register.

data Reg #

A register, either virtual or real

Constructors

RegVirtual !VirtualReg |
RegReal !RealReg |

Instances

Eq Reg # |
Methods (==) :: Reg -> Reg -> Bool # (/=) :: Reg -> Reg -> Bool #
Ord Reg # |
Methods compare :: Reg -> Reg -> Ordering # (<) :: Reg -> Reg -> Bool # (<=) :: Reg -> Reg -> Bool # (>) :: Reg -> Reg -> Bool # (>=) :: Reg -> Reg -> Bool # max :: Reg -> Reg -> Reg # min :: Reg -> Reg -> Reg #
Outputable Reg # | Print a reg in a generic manner If you want the architecture specific names, then use the pprReg function from the appropriate Ppr module.
Methods ppr :: Reg -> SDoc # pprPrec :: Rational -> Reg -> SDoc #
Uniquable Reg # |
Methods getUnique :: Reg -> Unique #

regPair :: RegNo -> RegNo -> Reg #

regSingle :: RegNo -> Reg #

isRealReg :: Reg -> Bool #

takeRealReg :: Reg -> Maybe RealReg #

isVirtualReg :: Reg -> Bool #

takeVirtualReg :: Reg -> Maybe VirtualReg #

data VirtualReg #

Constructors

VirtualRegI !Unique |
VirtualRegHi !Unique |
VirtualRegF !Unique |
VirtualRegD !Unique |
VirtualRegSSE !Unique |

Instances

Eq VirtualReg # |
Methods (==) :: VirtualReg -> VirtualReg -> Bool # (/=) :: VirtualReg -> VirtualReg -> Bool #
Ord VirtualReg # |
Methods compare :: VirtualReg -> VirtualReg -> Ordering # (<) :: VirtualReg -> VirtualReg -> Bool # (<=) :: VirtualReg -> VirtualReg -> Bool # (>) :: VirtualReg -> VirtualReg -> Bool # (>=) :: VirtualReg -> VirtualReg -> Bool # max :: VirtualReg -> VirtualReg -> VirtualReg # min :: VirtualReg -> VirtualReg -> VirtualReg #
Show VirtualReg # |
Methods showsPrec :: Int -> VirtualReg -> ShowS Source # show :: VirtualReg -> String Source # showList :: [VirtualReg] -> ShowS Source #
Outputable VirtualReg # |
Methods ppr :: VirtualReg -> SDoc # pprPrec :: Rational -> VirtualReg -> SDoc #
Uniquable VirtualReg # |
Methods getUnique :: VirtualReg -> Unique #

renameVirtualReg :: Unique -> VirtualReg -> VirtualReg #

classOfVirtualReg :: VirtualReg -> RegClass #

getHiVirtualRegFromLo :: VirtualReg -> VirtualReg #

getHiVRegFromLo :: Reg -> Reg #

data RealReg #

RealRegs are machine regs which are available for allocation, in the usual way. We know what class they are, because that's part of the processor's architecture.

RealRegPairs are pairs of real registers that are allocated together to hold a larger value, such as with Double regs on SPARC.

Constructors

RealRegSingle !RegNo |
RealRegPair !RegNo !RegNo |

Instances

Eq RealReg # |
Methods (==) :: RealReg -> RealReg -> Bool # (/=) :: RealReg -> RealReg -> Bool #
Ord RealReg # |
Methods compare :: RealReg -> RealReg -> Ordering # (<) :: RealReg -> RealReg -> Bool # (<=) :: RealReg -> RealReg -> Bool # (>) :: RealReg -> RealReg -> Bool # (>=) :: RealReg -> RealReg -> Bool # max :: RealReg -> RealReg -> RealReg # min :: RealReg -> RealReg -> RealReg #
Show RealReg # |
Methods showsPrec :: Int -> RealReg -> ShowS Source # show :: RealReg -> String Source # showList :: [RealReg] -> ShowS Source #
Outputable RealReg # |
Methods ppr :: RealReg -> SDoc # pprPrec :: Rational -> RealReg -> SDoc #
Uniquable RealReg # |
Methods getUnique :: RealReg -> Unique #

regNosOfRealReg :: RealReg -> [RegNo] #

realRegsAlias :: RealReg -> RealReg -> Bool #

liftPatchFnToRegReg :: (VirtualReg -> RealReg) -> Reg -> Reg #

The patch function supplied by the allocator maps VirtualReg to RealReg regs, but sometimes we want to apply it to plain old Reg.