llvm::Register

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

Synopsis

Declared in <llvm/CodeGen/Register.h>

class Register;

Member Functions

NameDescription
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
isPhysical Return true if the specified register number is in the physical register namespace.
isStack Return true if this is a stack slot.
isValid
isVirtual Return true if the specified register number is in the virtual register namespace.
operator++ Operators to move from one register to another nearby register by adding an offset.
operator+= Addition assignment operator
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 Conversion to MCRegister
operator unsigned int Conversion to unsigned int
operator== Equality operators
operator!= Inequality operators

Static Member Functions

NameDescription
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
MaxFrameIndexBitwidth
StackSlotMask
StackSlotZero
VirtualRegFlag

Non-Member Functions

NameDescription
canCreatePoisonReturns true if Reg can create poison from non-poison operands.
canCreateUndefOrPoisonReturns true if Reg can create undef or poison from non-undef & non-poison operands. ConsiderFlagsAndMetadata controls whether poison producing flags and metadata on the instruction are considered. This can be used to see if the instruction could still introduce undef or poison even without poison generating flags and metadata which might be on the instruction.
canReplaceRegCheck if DstReg can be replaced with SrcReg depending on the register constraints.
constrainOperandRegClassConstrain the Register operand OpIdx, so that it is now constrained to the TargetRegisterClass passed as an argument (RegClass). If this fails, create a new virtual register in the correct class and insert a COPY before InsertPt if it is a use or after if it is a definition. In both cases, the function also updates the register of RegMo. The debug location of InsertPt is used for the new copy.
constrainOperandRegClassTry to constrain Reg so that it is usable by argument OpIdx of the provided MCInstrDesc II. If this fails, create a new virtual register in the correct class and insert a COPY before InsertPt if it is a use or after if it is a definition. In both cases, the function also updates the register of RegMo. This is equivalent to constrainOperandRegClass(..., RegClass, ...) with RegClass obtained from the MCInstrDesc. The debug location of InsertPt is used for the new copy.
constrainRegToClassTry to constrain Reg to the specified register class. If this fails, create a new virtual register in the correct class.
extractPartsVersion which handles irregular splits.
extractPartsHelper function to split a wide generic register into bitwise blocks with the given Type (which implies the number of blocks needed). The generic registers created are appended to Ops, starting at bit 0 of Reg.
extractVectorPartsVersion which handles irregular sub-vector splits.
fcmpImpliesClassCompute the possible floating-point classes that LHS could be based on fcmp Pred LHS, RHS.
getAnyConstantVRegValWithLookThroughIf 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.
getDefIgnoringCopiesFind the def instruction for Reg, folding away any trivial copies. May return nullptr if Reg is not a generic virtual register.
getDefSrcRegIgnoringCopiesFind the def instruction for Reg, and underlying value Register folding away any copies.
getFConstantSplatReturns a floating point scalar constant of a build vector splat if it exists. When AllowUndef == true some elements can be undef but not all.
getFConstantVRegValWithLookThroughIf VReg is defined by a statically evaluable chain of instructions rooted on a G_FCONSTANT returns its APFloat value and def register.
getFunctionLiveInPhysRegReturn a virtual register corresponding to the incoming argument register PhysReg. This register is expected to have class RC, and optional type RegTy. This assumes all references to the register will use the same type.
getIConstantFromRegVReg is defined by a G_CONSTANT, return the corresponding value.
getIConstantSplatSExtVal
getIConstantSplatVal
getIConstantVRegSExtValIf VReg is defined by a G_CONSTANT fits in int64_t returns it.
getIConstantVRegValIf VReg is defined by a G_CONSTANT, return the corresponding value.
getIConstantVRegValWithLookThroughIf VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT returns its APInt value and def register.
getOpcodeDefSee 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.
getSrcRegIgnoringCopiesFind the source register for Reg, folding away any trivial copies. It will be an output register of the instruction that getDefIgnoringCopies returns. May return an invalid register if Reg is not a generic virtual register.
isBuildVectorConstantSplatReturn 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.
isBuildVectorConstantSplatReturn 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.
isConstantOrConstantSplatVectorDetermines if Def defines a constant integer or a splat vector of constant integers.
isConstantOrConstantSplatVectorFPDetermines if Def defines a float constant integer or a splat vector of float constant integers.
isGuaranteedNotToBePoisonReturns true if Reg cannot be poison, but may be undef.
isGuaranteedNotToBeUndefReturns true if Reg cannot be undef, but may be poison.
isGuaranteedNotToBeUndefOrPoisonReturns true if Reg cannot be poison and undef.
isKnownToBeAPowerOfTwoTest if the given value is known to have exactly one bit set. This differs from computeKnownBits in that it doesn't necessarily determine which bit is set. When OrNegative is true, the value is also considered a power of two if its negation is a power of two (i.e. its absolute value is a power of two).
isPhysRegUsedAfterCheck if physical register Reg is used after MBI.
printRegPrints virtual and physical registers with or without a TRI instance.
printRegClassOrBankCreate Printable object to print register classes or register banks on a raw_ostream.
GISelAddressing::getPointerInfoReturns a BaseIndexOffset which describes the pointer in Ptr.
MIPatternMatch::m_DeferredRegSimilar to m_SpecificReg/Type, but the specific value to match originated from an earlier sub-pattern in the same mi_match expression. For example, we cannot match (add X, X) with m_GAdd(m_Reg(X), m_SpecificReg(X)) because X is not initialized at the time it's passed to m_SpecificReg. Instead, we can use m_GAdd(m_Reg(x), m_DeferredReg(X)).
MIPatternMatch::m_SpecificRegMatches a register only if it is equal to RequestedReg.