LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::Register Class Reference

Wrapper class representing virtual and physical registers. More...

#include "llvm/CodeGen/Register.h"

Public Member Functions

constexpr Register (unsigned Val=0)
 
constexpr Register (MCRegister Val)
 
constexpr bool isStack () const
 Return true if this is a stack slot.
 
constexpr bool isVirtual () const
 Return true if the specified register number is in the virtual register namespace.
 
constexpr bool isPhysical () const
 Return true if the specified register number is in the physical register namespace.
 
unsigned virtRegIndex () const
 Convert a virtual register number to a 0-based index.
 
constexpr operator unsigned () const
 
constexpr unsigned id () const
 
constexpr operator MCRegister () const
 
MCRegister asMCReg () const
 Utility to check-convert this value to a MCRegister.
 
constexpr bool isValid () const
 
constexpr bool operator== (const Register &Other) const
 Comparisons between register objects.
 
constexpr bool operator!= (const Register &Other) const
 
constexpr bool operator== (const MCRegister &Other) const
 
constexpr bool operator!= (const MCRegister &Other) const
 
constexpr bool operator== (unsigned Other) const
 Comparisons against register constants.
 
constexpr bool operator!= (unsigned Other) const
 
constexpr bool operator== (int Other) const
 
constexpr bool operator!= (int Other) const
 
constexpr bool operator== (MCPhysReg Other) const
 
constexpr bool operator!= (MCPhysReg Other) const
 

Static Public Member Functions

static constexpr bool isStackSlot (unsigned Reg)
 isStackSlot - Sometimes it is useful to be able to store a non-negative frame index in a variable that normally holds a register.
 
static int stackSlot2Index (Register Reg)
 Compute the frame index from a register value representing a stack slot.
 
static Register index2StackSlot (int FI)
 Convert a non-negative frame index to a stack slot register value.
 
static constexpr bool isPhysicalRegister (unsigned Reg)
 Return true if the specified register number is in the physical register namespace.
 
static constexpr bool isVirtualRegister (unsigned Reg)
 Return true if the specified register number is in the virtual register namespace.
 
static unsigned virtReg2Index (Register Reg)
 Convert a virtual register number to a 0-based index.
 
static Register index2VirtReg (unsigned Index)
 Convert a 0-based index to a virtual register number.
 

Detailed Description

Wrapper class representing virtual and physical registers.

Should be passed by value.

Definition at line 19 of file Register.h.

Constructor & Destructor Documentation

◆ Register() [1/2]

constexpr llvm::Register::Register ( unsigned  Val = 0)
inlineconstexpr

Definition at line 23 of file Register.h.

◆ Register() [2/2]

constexpr llvm::Register::Register ( MCRegister  Val)
inlineconstexpr

Definition at line 24 of file Register.h.

Member Function Documentation

◆ asMCReg()

MCRegister llvm::Register::asMCReg ( ) const
inline

◆ id()

constexpr unsigned llvm::Register::id ( ) const
inlineconstexpr

◆ index2StackSlot()

static Register llvm::Register::index2StackSlot ( int  FI)
inlinestatic

Convert a non-negative frame index to a stack slot register value.

Definition at line 58 of file Register.h.

References assert(), and llvm::MCRegister::FirstStackSlot.

Referenced by llvm::LiveStacks::getOrCreateInterval(), and llvm::rdf::PhysicalRegisterInfo::getRegMaskId().

◆ index2VirtReg()

static Register llvm::Register::index2VirtReg ( unsigned  Index)
inlinestatic

◆ isPhysical()

constexpr bool llvm::Register::isPhysical ( ) const
inlineconstexpr

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

Definition at line 95 of file Register.h.

References isPhysicalRegister().

Referenced by llvm::DwarfExpression::addMachineReg(), llvm::MachineInstr::addRegisterDead(), llvm::MachineInstr::addRegisterKilled(), llvm::AnalyzePhysRegInBundle(), canFoldCopy(), llvm::canReplaceReg(), llvm::X86InstrInfo::classifyLEAReg(), collectRegDefs(), llvm::TargetInstrInfo::commuteInstructionImpl(), llvm::TargetRegisterClass::contains(), llvm::X86InstrInfo::describeLoadedValue(), llvm::GIMatchTableExecutor::executeMatchTable(), llvm::MachineInstr::findRegisterDefOperandIdx(), llvm::CoalescerPair::flip(), llvm::SIInstrInfo::foldImmediate(), llvm::X86InstrInfo::foldMemoryOperandImpl(), foldVGPRCopyIntoRegSequence(), llvm::BitTracker::MachineEvaluator::getCell(), llvm::AArch64RegisterBankInfo::getInstrMapping(), llvm::SIInstrInfo::getInstructionUniformity(), getMopState(), llvm::HexagonInstrInfo::getOperandLatency(), llvm::ARMBaseRegisterInfo::getRegAllocationHints(), llvm::TargetRegisterInfo::getRegAllocationHints(), llvm::BitTracker::MachineEvaluator::getRegBitWidth(), llvm::getRegState(), llvm::X86InstrInfo::getUndefRegClearance(), INITIALIZE_PASS(), llvm::CoalescerPair::isCoalescable(), isIdenticalOp(), isLibCallInTailPosition(), isLocalCopy(), llvm::SITargetLowering::legalizeTargetIndependentNode(), llvm::ARMBaseInstrInfo::loadRegFromStackSlot(), llvm::Thumb1InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), loadRegPairFromStackSlot(), MIIsInTerminatorSequence(), llvm::SIInstrInfo::moveToVALUImpl(), llvm::SIInstrInfo::optimizeCompareInstr(), llvm::X86InstrInfo::optimizeCompareInstr(), llvm::PeelSingleBlockLoop(), llvm::MachineOperand::print(), llvm::HexagonFrameLowering::processFunctionBeforeFrameFinalized(), llvm::TargetRegisterInfo::regsOverlap(), llvm::MachineRegisterInfo::replaceRegWith(), selectCopy(), storeRegPairToStackSlot(), llvm::Thumb1InstrInfo::storeRegToStackSlot(), llvm::MachineInstr::substituteRegister(), and llvm::SIInstrInfo::verifyInstruction().

◆ isPhysicalRegister()

static constexpr bool llvm::Register::isPhysicalRegister ( unsigned  Reg)
inlinestaticconstexpr

◆ isStack()

constexpr bool llvm::Register::isStack ( ) const
inlineconstexpr

Return true if this is a stack slot.

Definition at line 49 of file Register.h.

References llvm::MCRegister::isStackSlot().

◆ isStackSlot()

static constexpr bool llvm::Register::isStackSlot ( unsigned  Reg)
inlinestaticconstexpr

isStackSlot - Sometimes it is useful to be able to store a non-negative frame index in a variable that normally holds a register.

isStackSlot() returns true if Reg is in the range used for stack slots.

FIXME: remove in favor of member.

Definition at line 44 of file Register.h.

References llvm::MCRegister::isStackSlot().

Referenced by llvm::rdf::RegisterRef::isMaskId(), and llvm::printReg().

◆ isValid()

constexpr bool llvm::Register::isValid ( ) const
inlineconstexpr

Definition at line 116 of file Register.h.

References llvm::MCRegister::NoRegister.

Referenced by addConstantsToTrack(), addOpsFromMDNode(), llvm::GISelAddressing::aliasIsKnownForLoadStore(), llvm::HexagonFrameLowering::assignCalleeSavedSpillSlots(), llvm::buildAtomicCompareExchangeInst(), llvm::buildBarrierInst(), llvm::SPIRVGlobalRegistry::buildConstantFP(), llvm::SPIRVGlobalRegistry::buildConstantInt(), llvm::SPIRVGlobalRegistry::buildConstantSampler(), llvm::buildMemSemanticsReg(), llvm::buildNDRange(), llvm::buildScopeReg(), llvm::X86InstrInfo::classifyLEAReg(), llvm::WebAssemblyDebugValueManager::cloneSink(), copySubReg(), llvm::SIRegisterInfo::eliminateFrameIndex(), llvm::X86FrameLowering::emitEpilogue(), llvm::HexagonDAGToDAGISel::emitFunctionEntryCode(), llvm::X86FrameLowering::emitPrologue(), generateAssignInstrs(), llvm::generateGroupInst(), llvm::SIInstrInfo::getAddNoCarry(), llvm::SPIRVGlobalRegistry::getOrCreateConstNullPtr(), llvm::SPIRVGlobalRegistry::getOrCreateOpTypeByOpcode(), llvm::SPIRVGlobalRegistry::getOrCreateOpTypeCoopMatr(), llvm::SPIRVGlobalRegistry::getOrCreateUndef(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::HexagonRegisterInfo::getReservedRegs(), getTestBitReg(), getTruncStoreByteOffset(), llvm::VirtRegMap::hasPreferredPhys(), INITIALIZE_PASS(), insertInlineAsmProcess(), isCandidate(), llvm::AMDGPULegalizerInfo::legalizeAddrSpaceCast(), llvm::AArch64InstrInfo::loadRegFromStackSlot(), llvm::SPIRVMCInstLower::lower(), llvm::SPIRVCallLowering::lowerCall(), llvm::PhiLoweringHelper::lowerPhis(), llvm::LegalizerHelper::lowerReadWriteRegister(), llvm::CombinerHelper::matchCombineAnyExtTrunc(), llvm::CombinerHelper::matchCombineExtOfExt(), llvm::CombinerHelper::matchHoistLogicOpWithSameOpcodeHands(), popRegsFromStack(), llvm::HexagonFrameLowering::processFunctionBeforeFrameFinalized(), and processNewInstrs().

◆ isVirtual()

constexpr bool llvm::Register::isVirtual ( ) const
inlineconstexpr

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

Definition at line 91 of file Register.h.

References isVirtualRegister().

Referenced by llvm::MachineRegisterInfo::addRegAllocationHint(), llvm::RegisterOperands::adjustLaneLiveness(), llvm::RegAllocBase::allocatePhysRegs(), llvm::VirtRegMap::assignVirt2Phys(), llvm::VirtRegMap::assignVirt2StackSlot(), attemptDebugCopyProp(), canCombine(), canCombineFPFusedMultiply(), canFoldCopy(), llvm::AArch64InstrInfo::canFoldIntoAddrMode(), llvm::X86InstrInfo::classifyLEAReg(), llvm::VirtRegMap::clearVirt(), cloneInstr(), llvm::PPCInstrInfo::combineRLWINM(), llvm::GISelKnownBits::computeKnownBitsImpl(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), llvm::VirtRegAuxInfo::copyHint(), llvm::ARMBaseRegisterInfo::eliminateFrameIndex(), llvm::WebAssemblyRegisterInfo::eliminateFrameIndex(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), llvm::ThumbRegisterInfo::emitLoadConstPool(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), emitThumbRegPlusImmInReg(), findRedundantFlagInstr(), llvm::SIInstrInfo::foldImmediate(), llvm::SystemZInstrInfo::foldImmediate(), llvm::AArch64InstrInfo::foldMemoryOperandImpl(), llvm::SIInstrInfo::foldMemoryOperandImpl(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), genFNegatedMAD(), genFusedMultiply(), genMaddR(), getCallTargetRegOpnd(), llvm::BitTracker::MachineEvaluator::getCell(), getCopyRegClasses(), getDefRegMask(), llvm::PPCInstrInfo::getFMAPatterns(), getFMULPatterns(), llvm::MachineInstrExpressionTrait::getHashValue(), getIndVarInfo(), llvm::AMDGPURegisterBankInfo::getInstrMapping(), getLanesWithProperty(), llvm::SIInstrInfo::getLiveRangeSplitOpcode(), llvm::VirtRegMap::getPhys(), llvm::MachineRegisterInfo::getRegAllocationHint(), llvm::PPCRegisterInfo::getRegAllocationHints(), llvm::TargetRegisterInfo::getRegAllocationHints(), llvm::MachineRegisterInfo::getRegAllocationHints(), llvm::BitTracker::MachineEvaluator::getRegBitWidth(), llvm::VirtRegMap::getShape(), llvm::MachineRegisterInfo::getSimpleHint(), llvm::VirtRegMap::getStackSlot(), llvm::getVRegSubRegDef(), hasAllNBitUsers(), llvm::VirtRegMap::hasPreferredPhys(), llvm::TargetInstrInfo::hasReassociableOperands(), llvm::RISCVInstrInfo::hasReassociableOperands(), hasSameValue(), INITIALIZE_PASS(), llvm::RegPressureTracker::initLiveThru(), isAGPRCopy(), isCopyFeedingInvariantStore(), llvm::MachineInstr::isIdenticalTo(), isLibCallInTailPosition(), llvm::TargetInstrInfo::isReallyTriviallyReMaterializable(), isSignExtendedW(), isTileRegDef(), isVirtualRegisterOperand(), IsWritingToVCCR(), llvm::SIInstrInfo::legalizeOperands(), llvm::AMDGPULegalizerInfo::loadInputValue(), llvm::AArch64InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::TargetRegisterInfo::lookThruCopyLike(), llvm::TargetRegisterInfo::lookThruSingleUseCopyChain(), MatchingStackOffset(), llvm::BitTracker::RegisterCell::meet(), llvm::SIInstrInfo::moveToVALUImpl(), oneUseDominatesOtherUses(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::AArch64InstrInfo::optimizeCondBranch(), llvm::Thumb2InstrInfo::optimizeSelect(), llvm::ARMBaseInstrInfo::produceSameValue(), llvm::PSetIterator::PSetIterator(), llvm::BitTracker::MachineEvaluator::putCell(), llvm::TargetInstrInfo::reassociateOps(), llvm::RegPressureTracker::recede(), regIsPICBase(), llvm::WebAssemblyAsmPrinter::regToString(), rescheduleCanonically(), resultDependsOnExec(), llvm::rewriteT2FrameIndex(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::InstructionSelect::selectMachineFunction(), llvm::MachineRegisterInfo::setRegAllocationHint(), llvm::MachineRegisterInfo::shouldTrackSubRegLiveness(), llvm::LiveIntervals::shrinkToUses(), spillRegPairs(), llvm::stableHashValue(), llvm::AArch64InstrInfo::storeRegToStackSlot(), llvm::Thumb2InstrInfo::storeRegToStackSlot(), llvm::SIInstrInfo::storeRegToStackSlot(), tryChangeVGPRtoSGPRinCopy(), llvm::LegalizationArtifactCombiner::tryCombineInstruction(), llvm::ARMBaseRegisterInfo::updateRegAllocHint(), llvm::SIInstrInfo::usesConstantBus(), llvm::SIInstrInfo::verifyInstruction(), and llvm::VirtRegAuxInfo::weightCalcHelper().

◆ isVirtualRegister()

static constexpr bool llvm::Register::isVirtualRegister ( unsigned  Reg)
inlinestaticconstexpr

◆ operator MCRegister()

constexpr llvm::Register::operator MCRegister ( ) const
inlineconstexpr

Definition at line 105 of file Register.h.

◆ operator unsigned()

constexpr llvm::Register::operator unsigned ( ) const
inlineconstexpr

Definition at line 101 of file Register.h.

◆ operator!=() [1/5]

constexpr bool llvm::Register::operator!= ( const MCRegister Other) const
inlineconstexpr

Definition at line 128 of file Register.h.

References llvm::Other.

◆ operator!=() [2/5]

constexpr bool llvm::Register::operator!= ( const Register Other) const
inlineconstexpr

Definition at line 122 of file Register.h.

References llvm::Other.

◆ operator!=() [3/5]

constexpr bool llvm::Register::operator!= ( int  Other) const
inlineconstexpr

Definition at line 139 of file Register.h.

References llvm::Other.

◆ operator!=() [4/5]

constexpr bool llvm::Register::operator!= ( MCPhysReg  Other) const
inlineconstexpr

Definition at line 144 of file Register.h.

References llvm::Other.

◆ operator!=() [5/5]

constexpr bool llvm::Register::operator!= ( unsigned  Other) const
inlineconstexpr

Definition at line 137 of file Register.h.

References llvm::Other.

◆ operator==() [1/5]

constexpr bool llvm::Register::operator== ( const MCRegister Other) const
inlineconstexpr

Definition at line 125 of file Register.h.

References llvm::Other.

◆ operator==() [2/5]

constexpr bool llvm::Register::operator== ( const Register Other) const
inlineconstexpr

Comparisons between register objects.

Definition at line 119 of file Register.h.

References llvm::Other.

◆ operator==() [3/5]

constexpr bool llvm::Register::operator== ( int  Other) const
inlineconstexpr

Definition at line 138 of file Register.h.

References llvm::Other.

◆ operator==() [4/5]

constexpr bool llvm::Register::operator== ( MCPhysReg  Other) const
inlineconstexpr

Definition at line 141 of file Register.h.

References llvm::Other.

◆ operator==() [5/5]

constexpr bool llvm::Register::operator== ( unsigned  Other) const
inlineconstexpr

Comparisons against register constants.

E.g.

Definition at line 136 of file Register.h.

References llvm::Other.

◆ stackSlot2Index()

static int llvm::Register::stackSlot2Index ( Register  Reg)
inlinestatic

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

Definition at line 52 of file Register.h.

References assert(), and llvm::MCRegister::FirstStackSlot.

Referenced by llvm::rdf::PhysicalRegisterInfo::getMaskUnits(), llvm::rdf::PhysicalRegisterInfo::getRegMaskBits(), llvm::rdf::PhysicalRegisterInfo::print(), and llvm::printReg().

◆ virtReg2Index()

static unsigned llvm::Register::virtReg2Index ( Register  Reg)
inlinestatic

◆ virtRegIndex()

unsigned llvm::Register::virtRegIndex ( ) const
inline

Convert a virtual register number to a 0-based index.

The first virtual register in a function will get the index 0.

Definition at line 99 of file Register.h.

References virtReg2Index().


The documentation for this class was generated from the following file: