Wrapper class representing virtual and physical registers. Should be passed by value.

Synopsis

Declared in <llvm/CodeGen/Register.h>

class Register;

Member Functions

Name

Description

Register [constructor]

Constructors

asMCReg

Utility to check‐convert this value to a MCRegister. The caller is expected to have already validated that this Register is, indeed, physical.

id

Return the underlying unsigned register number.

isPhysical

Return true if the specified register number is in the physical register namespace.

isStack

Return true if this is a stack slot.

isValid

Return true if this is a real register (not MCRegister::NoRegister).

isVirtual

Return true if the specified register number is in the virtual register namespace.

operator++

Increment operators

operator+=

Advance this register number by RHS.

stackSlotIndex

Compute the frame index from a register value representing a stack slot.

virtRegIndex

Convert a virtual register number to a 0‐based index. The first virtual register in a function will get the index 0.

operator MCRegister

Convert this register to an MCRegister with the same number.

operator unsigned int

Convert this register to its underlying unsigned register number.

operator==

Equality operators

operator!=

Inequality operators

Static Member Functions

Name

Description

index2StackSlot

Convert a frame index to a stack slot register value.

index2VirtReg

Convert a 0‐based index to a virtual register number. This is the inverse operation of VirtReg2IndexFunctor below.

isPhysicalRegister

Return true if the specified register number is in the physical register namespace.

isVirtualRegister

Return true if the specified register number is in the virtual register namespace.

Static Data Members

Name

Description

MaxFrameIndexBitwidth

Bit width available for encoding a frame index in a stack‐slot value.

StackSlotMask

Mask for the frame‐index bits within a stack‐slot register value.

StackSlotZero

Lowest unsigned value in the stack‐slot register range.

VirtualRegFlag

High bit set on all virtual register numbers.

Non-Member Functions

Name

Description

canCreatePoison

Returns true if Reg can create poison from non‐poison operands.

canCreateUndefOrPoison

Returns true if Reg can create undef or poison from safe operands.

canReplaceReg

Check if DstReg can be replaced with SrcReg depending on the register constraints.

constrainOperandRegClass

Constrain a register operand to a given target register class.

constrainOperandRegClass

Constrain a register operand for a given instruction description.

constrainRegToClass

Try to constrain Reg to the specified register class.

extractParts

Version which handles irregular splits.

extractParts

Split a wide generic register into bitwise blocks of type Ty.

extractVectorParts

Version which handles irregular sub‐vector splits.

fcmpImpliesClass

Compute the possible floating‐point classes that LHS could be based on fcmp Pred LHS, RHS.

getAnyConstantVRegValWithLookThrough

If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT or G_FCONSTANT returns its value as APInt and def register.

getConstantFPVRegVal

Return the ConstantFP defining VReg, or nullptr if it is not a G_FCONSTANT.

getDefIgnoringCopies

Find the def instruction for Reg, folding away any trivial copies. May return nullptr if Reg is not a generic virtual register.

getDefSrcRegIgnoringCopies

Find the def instruction for Reg, and underlying value Register folding away any copies.

getFConstantSplat

Returns a floating point scalar constant of a build vector splat if it exists. When AllowUndef == true some elements can be undef but not all.

getFConstantVRegValWithLookThrough

If VReg is defined by a statically evaluable chain of instructions rooted on a G_FCONSTANT returns its APFloat value and def register.

getFunctionLiveInPhysReg

Return a virtual register for an incoming physical argument register.

getIConstantFromReg

VReg is defined by a G_CONSTANT, return the corresponding value.

getIConstantSplatSExtVal

Return the scalar sign‐extended integral splat value of Reg if possible.

getIConstantSplatVal

Return the scalar integral splat value of Reg if possible.

getIConstantVRegSExtVal

If VReg is defined by a G_CONSTANT fits in int64_t returns it.

getIConstantVRegVal

If VReg is defined by a G_CONSTANT, return the corresponding value.

getIConstantVRegValWithLookThrough

If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT returns its APInt value and def register.

getOpcodeDef

See if Reg is defined by an single def instruction of type T Also try to do trivial folding if it's a COPY with same types. Returns null otherwise.

getSrcRegIgnoringCopies

Find the source register for Reg, folding away any trivial copies.

isBuildVectorConstantSplat

Return true if the specified register is defined by G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all of the elements are SplatValue or undef.

isBuildVectorConstantSplat

Return true if the specified register is defined by G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all of the elements are SplatValue or undef.

isConstantOrConstantSplatVector

Determines if Def defines a constant integer or a splat vector of constant integers.

isConstantOrConstantSplatVectorFP

Determines if Def defines a float constant integer or a splat vector of float constant integers.

isGuaranteedNotToBePoison

Returns true if Reg cannot be poison, but may be undef.

isGuaranteedNotToBeUndef

Returns true if Reg cannot be undef, but may be poison.

isGuaranteedNotToBeUndefOrPoison

Returns true if Reg cannot be poison and undef.

isKnownToBeAPowerOfTwo

Test if the given value is known to have exactly one bit set.

isPhysRegUsedAfter

Check if physical register Reg is used after MBI.

printReg

Prints virtual and physical registers with or without a TRI instance.

printRegClassOrBank

Create Printable object to print register classes or register banks on a raw_ostream.

GISelAddressing::getPointerInfo

Returns a BaseIndexOffset which describes the pointer in Ptr.

MIPatternMatch::m_DeferredReg

Matches a register equal to a value bound earlier in the same expression.

MIPatternMatch::m_Reg

Binds the matched register to R.

MIPatternMatch::m_SpecificReg

Matches a register only if it equals RequestedReg.

MIPatternMatch::matchConstant

Match Reg as a sign‐extended int64 integer constant.

MIPatternMatch::matchConstant

Match Reg as an APInt integer constant.

MIPatternMatch::matchConstant

Try to match Reg as an integer constant of type ConstT.

MIPatternMatch::matchConstantSplat

Match Reg as an APInt constant splat.

MIPatternMatch::matchConstantSplat

Try to match Reg as an integer constant splat of type ConstT.

MIPatternMatch::matchConstantSplat

Match Reg as a sign‐extended int64 constant splat.

Created with MrDocs