GHC.Cmm.Reg

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
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 Source #

Constructors

CmmLocal !LocalReg |
CmmGlobal GlobalRegUse |

#### Instances

Instances details

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

cmmRegType :: CmmReg -> CmmType Source #

cmmRegWidth :: CmmReg -> Width Source #

# Local registers

data LocalReg Source #

Constructors

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

#### Instances

Instances details

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

localRegType :: LocalReg -> CmmType Source #

# Global registers

data GlobalReg Source #

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

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

isArgReg :: GlobalReg -> Bool Source #

globalRegSpillType :: Platform -> GlobalReg -> CmmType Source #

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

spReg :: Platform -> CmmReg Source #

hpReg :: Platform -> CmmReg Source #

spLimReg :: Platform -> CmmReg Source #

hpLimReg :: Platform -> CmmReg Source #

nodeReg :: Platform -> CmmReg Source #

currentTSOReg :: Platform -> CmmReg Source #

currentNurseryReg :: Platform -> CmmReg Source #

hpAllocReg :: Platform -> CmmReg Source #

cccsReg :: Platform -> CmmReg Source #

node :: GlobalReg Source #

baseReg :: Platform -> CmmReg Source #

data GlobalRegUse Source #

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

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

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

data GlobalArgRegs Source #

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

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