ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Platform.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
- regSingle :: RegNo -> Reg
- realRegSingle :: RegNo -> RealReg
- isRealReg :: Reg -> Bool
- takeRealReg :: Reg -> Maybe RealReg
- isVirtualReg :: Reg -> Bool
- takeVirtualReg :: Reg -> Maybe VirtualReg
- data VirtualReg
  - = VirtualRegI {
    - virtualRegUnique :: !Unique
    }
  - | VirtualRegHi {
    - virtualRegUnique :: !Unique
    }
  - | VirtualRegD {
    - virtualRegUnique :: !Unique
    }
  - | VirtualRegV128 {
    - virtualRegUnique :: !Unique
    }
- renameVirtualReg :: Unique -> VirtualReg -> VirtualReg
- classOfVirtualReg :: Arch -> VirtualReg -> RegClass
- getHiVirtualRegFromLo :: VirtualReg -> VirtualReg
- getHiVRegFromLo :: Reg -> Reg
- newtype RealReg = RealRegSingle RegNo
- regNosOfRealReg :: RealReg -> [RegNo]
- realRegsAlias :: RealReg -> RealReg -> Bool
- liftPatchFnToRegReg :: (VirtualReg -> RealReg) -> Reg -> Reg

# Documentation

type RegNo = Int Source #

An identifier for a primitive real machine register.

data Reg Source #

A register, either virtual or real

Constructors

RegVirtual !VirtualReg |
RegReal !RealReg |

#### Instances

Instances details

Show Reg Source # |
Instance details Defined in GHC.Platform.Reg Methods showsPrec :: Int -> Reg -> ShowS Source # show :: Reg -> String Source # showList :: [Reg] -> ShowS Source #
Uniquable Reg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: Reg -> Unique Source #
Outputable Reg Source # | Print a reg in a generic manner If you want the architecture specific names, then use the pprReg function from the appropriate Ppr module.
Instance details Defined in GHC.Platform.Reg Methods ppr :: Reg -> SDoc Source #
Eq Reg Source # |
Instance details Defined in GHC.Platform.Reg Methods (==) :: Reg -> Reg -> Bool Source # (/=) :: Reg -> Reg -> Bool Source #
Ord Reg Source # |
Instance details Defined in GHC.Platform.Reg Methods compare :: Reg -> Reg -> Ordering Source # (<) :: Reg -> Reg -> Bool Source # (<=) :: Reg -> Reg -> Bool Source # (>) :: Reg -> Reg -> Bool Source # (>=) :: Reg -> Reg -> Bool Source # max :: Reg -> Reg -> Reg Source # min :: Reg -> Reg -> Reg Source #

regSingle :: RegNo -> Reg Source #

realRegSingle :: RegNo -> RealReg Source #

isRealReg :: Reg -> Bool Source #

takeRealReg :: Reg -> Maybe RealReg Source #

isVirtualReg :: Reg -> Bool Source #

takeVirtualReg :: Reg -> Maybe VirtualReg Source #

data VirtualReg Source #

Constructors

VirtualRegI | Integer virtual register

Fields

- virtualRegUnique :: !Unique

VirtualRegHi | High part of 2-word virtual register

Fields

- virtualRegUnique :: !Unique

VirtualRegD | Double virtual register

Fields

- virtualRegUnique :: !Unique

VirtualRegV128 | 128-bit wide vector virtual register

Fields

- virtualRegUnique :: !Unique

#### Instances

Instances details

Show VirtualReg Source # |
Instance details Defined in GHC.Platform.Reg Methods showsPrec :: Int -> VirtualReg -> ShowS Source # show :: VirtualReg -> String Source # showList :: [VirtualReg] -> ShowS Source #
Uniquable VirtualReg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: VirtualReg -> Unique Source #
Outputable VirtualReg Source # |
Instance details Defined in GHC.Platform.Reg Methods ppr :: VirtualReg -> SDoc Source #
Eq VirtualReg Source # |
Instance details Defined in GHC.Platform.Reg Methods (==) :: VirtualReg -> VirtualReg -> Bool Source # (/=) :: VirtualReg -> VirtualReg -> Bool Source #
Ord VirtualReg Source # |

Instance details

Defined in GHC.Platform.Reg

Methods

compare :: VirtualReg -> VirtualReg -> Ordering Source #

(<) :: VirtualReg -> VirtualReg -> Bool Source #

(<=) :: VirtualReg -> VirtualReg -> Bool Source #

(>) :: VirtualReg -> VirtualReg -> Bool Source #

(>=) :: VirtualReg -> VirtualReg -> Bool Source #

max :: VirtualReg -> VirtualReg -> VirtualReg Source #

min :: VirtualReg -> VirtualReg -> VirtualReg Source #

renameVirtualReg :: Unique -> VirtualReg -> VirtualReg Source #

classOfVirtualReg :: Arch -> VirtualReg -> RegClass Source #

getHiVirtualRegFromLo :: VirtualReg -> VirtualReg Source #

getHiVRegFromLo :: Reg -> Reg Source #

newtype RealReg Source #

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.

Constructors

RealRegSingle RegNo |

#### Instances

Instances details

Show RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods showsPrec :: Int -> RealReg -> ShowS Source # show :: RealReg -> String Source # showList :: [RealReg] -> ShowS Source #
Uniquable RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: RealReg -> Unique Source #
Outputable RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods ppr :: RealReg -> SDoc Source #
Eq RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods (==) :: RealReg -> RealReg -> Bool Source # (/=) :: RealReg -> RealReg -> Bool Source #
Ord RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods compare :: RealReg -> RealReg -> Ordering Source # (<) :: RealReg -> RealReg -> Bool Source # (<=) :: RealReg -> RealReg -> Bool Source # (>) :: RealReg -> RealReg -> Bool Source # (>=) :: RealReg -> RealReg -> Bool Source # max :: RealReg -> RealReg -> RealReg Source # min :: RealReg -> RealReg -> RealReg Source #

regNosOfRealReg :: RealReg -> [RegNo] Source #

realRegsAlias :: RealReg -> RealReg -> Bool Source #

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

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