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 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

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

NameDescription
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

NameDescription
canCreatePoisonReturns true if Reg can create poison from non-poison operands.
canCreateUndefOrPoisonReturns true if Reg can create undef or poison from safe operands.
canReplaceRegCheck if DstReg can be replaced with SrcReg depending on the register constraints.
constrainOperandRegClassConstrain a register operand to a given target register class.
constrainOperandRegClassConstrain a register operand for a given instruction description.
constrainRegToClassTry to constrain Reg to the specified register class.
extractPartsVersion which handles irregular splits.
extractPartsSplit a wide generic register into bitwise blocks of type Ty.
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.
getConstantFPVRegValReturn the ConstantFP defining VReg, or nullptr if it is not a G_FCONSTANT.
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 for an incoming physical argument register.
getIConstantFromRegVReg is defined by a G_CONSTANT, return the corresponding value.
getIConstantSplatSExtValReturn the scalar sign-extended integral splat value of Reg if possible.
getIConstantSplatValReturn the scalar integral splat value of Reg if possible.
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.
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.
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_DeferredRegMatches a register equal to a value bound earlier in the same expression.
MIPatternMatch::m_RegBinds the matched register to R.
MIPatternMatch::m_SpecificRegMatches a register only if it equals RequestedReg.
MIPatternMatch::matchConstantMatch Reg as a sign-extended int64 integer constant.
MIPatternMatch::matchConstantMatch Reg as an APInt integer constant.
MIPatternMatch::matchConstantTry to match Reg as an integer constant of type ConstT.
MIPatternMatch::matchConstantSplatMatch Reg as an APInt constant splat.
MIPatternMatch::matchConstantSplatTry to match Reg as an integer constant splat of type ConstT.
MIPatternMatch::matchConstantSplatMatch Reg as a sign-extended int64 constant splat.