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

Safe Haskell | Ignore
Language | GHC2021

GHC.Cmm.Reg

Contents

- Cmm Registers
- Local registers
- Global registers

Synopsis

- data CmmReg
  - = CmmLocal !LocalReg
  - | CmmGlobal GlobalRegUse
- cmmRegType :: CmmReg -> CmmType
- cmmRegWidth :: CmmReg -> Width
- data LocalReg = LocalReg !Unique !CmmType
- localRegType :: LocalReg -> CmmType
- data GlobalReg
  - = VanillaReg !Int
  - | FloatReg !Int
  - | DoubleReg !Int
  - | LongReg !Int
  - | XmmReg !Int
  - | YmmReg !Int
  - | ZmmReg !Int
  - | Sp
  - | SpLim
  - | Hp
  - | HpLim
  - | CCCS
  - | CurrentTSO
  - | CurrentNursery
  - | HpAlloc
  - | EagerBlackholeInfo
  - | GCEnter1
  - | GCFun
  - | BaseReg
  - | MachSp
  - | UnwindReturnReg
  - | PicBaseReg
- isArgReg :: GlobalReg -> Bool
- globalRegSpillType :: Platform -> GlobalReg -> CmmType
- pprGlobalReg :: IsLine doc => GlobalReg -> doc
- spReg :: Platform -> CmmReg
- hpReg :: Platform -> CmmReg
- spLimReg :: Platform -> CmmReg
- hpLimReg :: Platform -> CmmReg
- nodeReg :: Platform -> CmmReg
- currentTSOReg :: Platform -> CmmReg
- currentNurseryReg :: Platform -> CmmReg
- hpAllocReg :: Platform -> CmmReg
- cccsReg :: Platform -> CmmReg
- node :: GlobalReg
- baseReg :: Platform -> CmmReg
- data GlobalRegUse = GlobalRegUse {
  - globalRegUse_reg :: !GlobalReg
  - globalRegUse_type :: !CmmType
  }
- pprGlobalRegUse :: IsLine doc => GlobalRegUse -> doc
- data GlobalArgRegs
  - = GP_ARG_REGS
  - | SCALAR_ARG_REGS
  - | V16_ARG_REGS
  - | V32_ARG_REGS
  - | V64_ARG_REGS

# Cmm Registers

data CmmReg #

Constructors

CmmLocal !LocalReg |
CmmGlobal GlobalRegUse |

#### Instances

Instances details

Show CmmReg # |
Instance details Defined in GHC.Cmm.Reg Methods showsPrec :: Int -> CmmReg -> ShowS # show :: CmmReg -> String # showList :: [CmmReg] -> ShowS #
Outputable CmmReg # |
Instance details Defined in GHC.Cmm.Reg Methods ppr :: CmmReg -> SDoc #
Eq CmmReg # |
Instance details Defined in GHC.Cmm.Reg Methods (==) :: CmmReg -> CmmReg -> Bool # (/=) :: CmmReg -> CmmReg -> Bool #
Ord CmmReg # |
Instance details Defined in GHC.Cmm.Reg Methods compare :: CmmReg -> CmmReg -> Ordering # (<) :: CmmReg -> CmmReg -> Bool # (<=) :: CmmReg -> CmmReg -> Bool # (>) :: CmmReg -> CmmReg -> Bool # (>=) :: CmmReg -> CmmReg -> Bool # max :: CmmReg -> CmmReg -> CmmReg # min :: CmmReg -> CmmReg -> CmmReg #
DefinerOfRegs GlobalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsDefd :: Platform -> (b -> GlobalReg -> b) -> b -> CmmReg -> b #
DefinerOfRegs GlobalRegUse CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsDefd :: Platform -> (b -> GlobalRegUse -> b) -> b -> CmmReg -> b #
DefinerOfRegs LocalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsDefd :: Platform -> (b -> LocalReg -> b) -> b -> CmmReg -> b #
UserOfRegs GlobalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsUsed :: Platform -> (b -> GlobalReg -> b) -> b -> CmmReg -> b #
UserOfRegs GlobalRegUse CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsUsed :: Platform -> (b -> GlobalRegUse -> b) -> b -> CmmReg -> b #
UserOfRegs LocalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsUsed :: Platform -> (b -> LocalReg -> b) -> b -> CmmReg -> b #

cmmRegType :: CmmReg -> CmmType #

cmmRegWidth :: CmmReg -> Width #

# Local registers

data LocalReg #

Constructors

LocalReg !Unique !CmmType | Parameters: 1. Identifier 2. Type

#### Instances

Instances details

Show LocalReg # |
Instance details Defined in GHC.Cmm.Reg Methods showsPrec :: Int -> LocalReg -> ShowS # show :: LocalReg -> String # showList :: [LocalReg] -> ShowS #
Uniquable LocalReg # |
Instance details Defined in GHC.Cmm.Reg Methods getUnique :: LocalReg -> Unique #
Outputable LocalReg # |
Instance details Defined in GHC.Cmm.Reg Methods ppr :: LocalReg -> SDoc #
Eq LocalReg # |
Instance details Defined in GHC.Cmm.Reg Methods (==) :: LocalReg -> LocalReg -> Bool # (/=) :: LocalReg -> LocalReg -> Bool #
Ord LocalReg # |
Instance details Defined in GHC.Cmm.Reg Methods compare :: LocalReg -> LocalReg -> Ordering # (<) :: LocalReg -> LocalReg -> Bool # (<=) :: LocalReg -> LocalReg -> Bool # (>) :: LocalReg -> LocalReg -> Bool # (>=) :: LocalReg -> LocalReg -> Bool # max :: LocalReg -> LocalReg -> LocalReg # min :: LocalReg -> LocalReg -> LocalReg #
DefinerOfRegs LocalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsDefd :: Platform -> (b -> LocalReg -> b) -> b -> CmmReg -> b #
UserOfRegs LocalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsUsed :: Platform -> (b -> LocalReg -> b) -> b -> CmmReg -> b #
DefinerOfRegs LocalReg (CmmNode e x) # |
Instance details Defined in GHC.Cmm.Node Methods foldRegsDefd :: Platform -> (b -> LocalReg -> b) -> b -> CmmNode e x -> b #
UserOfRegs LocalReg (CmmNode e x) # |
Instance details Defined in GHC.Cmm.Node Methods foldRegsUsed :: Platform -> (b -> LocalReg -> b) -> b -> CmmNode e x -> b #

localRegType :: LocalReg -> CmmType #

# Global registers

data GlobalReg #

An abstract global register for the STG machine.

See also `GlobalRegUse`, which denotes a usage of a register at a particular type (e.g. using a 32-bit wide register to store an 8-bit wide value), as per Note [GlobalReg vs GlobalRegUse].

Constructors

VanillaReg !Int |
FloatReg !Int |
DoubleReg !Int |
LongReg !Int |
XmmReg !Int |
YmmReg !Int |
ZmmReg !Int |
Sp | Stack ptr; points to last occupied stack location.
SpLim | Stack limit
Hp | Heap ptr; points to last occupied heap location.
HpLim | Heap limit register
CCCS | Current cost-centre stack
CurrentTSO | pointer to current thread's TSO
CurrentNursery | pointer to allocation area
HpAlloc | allocation count for heap check failure
EagerBlackholeInfo | address of stg_EAGER_BLACKHOLE_info
GCEnter1 | address of stg_gc_enter_1
GCFun | address of stg_gc_fun
BaseReg | Base offset for the register table, used for accessing registers which do not have real registers assigned to them. This register will only appear after we have expanded GlobalReg into memory accesses (where necessary) in the native code generator.
MachSp | The register used by the platform for the C stack pointer. This is a break in the STG abstraction used exclusively to setup stack unwinding information.
UnwindReturnReg | A dummy register used to indicate to the stack unwinder where a routine would return to.
PicBaseReg | Base Register for PIC (position-independent code) calculations. Only used inside the native code generator. Its exact meaning differs from platform to platform (see module PositionIndependentCode).

#### Instances

Instances details

Show GlobalReg # |
Instance details Defined in GHC.Cmm.Reg Methods showsPrec :: Int -> GlobalReg -> ShowS # show :: GlobalReg -> String # showList :: [GlobalReg] -> ShowS #
Outputable GlobalReg # |
Instance details Defined in GHC.Cmm.Reg Methods ppr :: GlobalReg -> SDoc #
Eq GlobalReg # |
Instance details Defined in GHC.Cmm.Reg Methods (==) :: GlobalReg -> GlobalReg -> Bool # (/=) :: GlobalReg -> GlobalReg -> Bool #
Ord GlobalReg # |
Instance details Defined in GHC.Cmm.Reg Methods compare :: GlobalReg -> GlobalReg -> Ordering # (<) :: GlobalReg -> GlobalReg -> Bool # (<=) :: GlobalReg -> GlobalReg -> Bool # (>) :: GlobalReg -> GlobalReg -> Bool # (>=) :: GlobalReg -> GlobalReg -> Bool # max :: GlobalReg -> GlobalReg -> GlobalReg # min :: GlobalReg -> GlobalReg -> GlobalReg #
DefinerOfRegs GlobalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsDefd :: Platform -> (b -> GlobalReg -> b) -> b -> CmmReg -> b #
UserOfRegs GlobalReg CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsUsed :: Platform -> (b -> GlobalReg -> b) -> b -> CmmReg -> b #
OutputableP env GlobalReg # |
Instance details Defined in GHC.Cmm.Reg Methods pdoc :: env -> GlobalReg -> SDoc #

isArgReg :: GlobalReg -> Bool #

globalRegSpillType :: Platform -> GlobalReg -> CmmType #

pprGlobalReg :: IsLine doc => GlobalReg -> doc #

spReg :: Platform -> CmmReg #

hpReg :: Platform -> CmmReg #

spLimReg :: Platform -> CmmReg #

hpLimReg :: Platform -> CmmReg #

nodeReg :: Platform -> CmmReg #

currentTSOReg :: Platform -> CmmReg #

currentNurseryReg :: Platform -> CmmReg #

hpAllocReg :: Platform -> CmmReg #

cccsReg :: Platform -> CmmReg #

node :: GlobalReg #

baseReg :: Platform -> CmmReg #

data GlobalRegUse #

A use of a global register at a particular type.

While a `GlobalReg` identifies a global register in the STG machine, a `GlobalRegUse` also contains information about the type we are storing in the register.

See Note [GlobalReg vs GlobalRegUse] for more information.

Constructors

GlobalRegUse |

Fields

- globalRegUse_reg :: !GlobalReg

  The underlying `GlobalReg`

- globalRegUse_type :: !CmmType

  The `CmmType` at which we are using the `GlobalReg`.

  Its width must be less than the width of the `GlobalReg`:

      typeWidth ty <= typeWidth (globalRegSpillType platform reg)

#### Instances

Instances details

Show GlobalRegUse # |
Instance details Defined in GHC.Cmm.Reg Methods showsPrec :: Int -> GlobalRegUse -> ShowS # show :: GlobalRegUse -> String # showList :: [GlobalRegUse] -> ShowS #
Outputable GlobalRegUse # |
Instance details Defined in GHC.Cmm.Reg Methods ppr :: GlobalRegUse -> SDoc #
Eq GlobalRegUse # |
Instance details Defined in GHC.Cmm.Reg Methods (==) :: GlobalRegUse -> GlobalRegUse -> Bool # (/=) :: GlobalRegUse -> GlobalRegUse -> Bool #
Ord GlobalRegUse # |
Instance details Defined in GHC.Cmm.Reg Methods compare :: GlobalRegUse -> GlobalRegUse -> Ordering # (<) :: GlobalRegUse -> GlobalRegUse -> Bool # (<=) :: GlobalRegUse -> GlobalRegUse -> Bool # (>) :: GlobalRegUse -> GlobalRegUse -> Bool # (>=) :: GlobalRegUse -> GlobalRegUse -> Bool # max :: GlobalRegUse -> GlobalRegUse -> GlobalRegUse # min :: GlobalRegUse -> GlobalRegUse -> GlobalRegUse #
DefinerOfRegs GlobalRegUse CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsDefd :: Platform -> (b -> GlobalRegUse -> b) -> b -> CmmReg -> b #
UserOfRegs GlobalRegUse CmmReg # |
Instance details Defined in GHC.Cmm.Expr Methods foldRegsUsed :: Platform -> (b -> GlobalRegUse -> b) -> b -> CmmReg -> b #
DefinerOfRegs GlobalRegUse (CmmNode e x) # |
Instance details Defined in GHC.Cmm.Node Methods foldRegsDefd :: Platform -> (b -> GlobalRegUse -> b) -> b -> CmmNode e x -> b #
UserOfRegs GlobalRegUse (CmmNode e x) # |
Instance details Defined in GHC.Cmm.Node Methods foldRegsUsed :: Platform -> (b -> GlobalRegUse -> b) -> b -> CmmNode e x -> b #

pprGlobalRegUse :: IsLine doc => GlobalRegUse -> doc #

data GlobalArgRegs #

Global registers used for argument passing.

See Note [realArgRegsCover] in GHC.Cmm.CallConv.

Constructors

GP_ARG_REGS | General-purpose (integer) argument-passing registers.
SCALAR_ARG_REGS | Scalar (integer & floating-point) argument-passing registers.
V16_ARG_REGS | 16 byte vector argument-passing registers, together with integer & floating-point argument-passing scalar registers.
V32_ARG_REGS | 32 byte vector argument-passing registers, together with integer & floating-point argument-passing scalar registers.
V64_ARG_REGS | 64 byte vector argument-passing registers, together with integer & floating-point argument-passing scalar registers.

#### Instances

Instances details

Show GlobalArgRegs # |
Instance details Defined in GHC.Cmm.Reg Methods showsPrec :: Int -> GlobalArgRegs -> ShowS # show :: GlobalArgRegs -> String # showList :: [GlobalArgRegs] -> ShowS #
Eq GlobalArgRegs # |
Instance details Defined in GHC.Cmm.Reg Methods (==) :: GlobalArgRegs -> GlobalArgRegs -> Bool # (/=) :: GlobalArgRegs -> GlobalArgRegs -> Bool #
Ord GlobalArgRegs # |

Instance details

Defined in GHC.Cmm.Reg

Methods

compare :: GlobalArgRegs -> GlobalArgRegs -> Ordering #

(<) :: GlobalArgRegs -> GlobalArgRegs -> Bool #

(<=) :: GlobalArgRegs -> GlobalArgRegs -> Bool #

(>) :: GlobalArgRegs -> GlobalArgRegs -> Bool #

(>=) :: GlobalArgRegs -> GlobalArgRegs -> Bool #

max :: GlobalArgRegs -> GlobalArgRegs -> GlobalArgRegs #

min :: GlobalArgRegs -> GlobalArgRegs -> GlobalArgRegs #