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

Static Public Member Functions

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

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.

Referenced by index2StackSlot().

◆ 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

Utility to check-convert this value to a MCRegister.

The caller is expected to have already validated that this Register is, indeed, physical.

Definition at line 120 of file Register.h.

References assert(), llvm::MCRegister::isPhysicalRegister(), and llvm::MCRegister::NoRegister.

Referenced by llvm::TargetRegisterClass::contains(), copyHint(), llvm::BitTracker::MachineEvaluator::getRegBitWidth(), isCopyFeedingInvariantStore(), isNopCopy(), llvm::TargetRegisterInfo::regsOverlap(), and updatePhysDepsDownwards().

◆ id()

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

◆ 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(), llvm::MCRegister::FirstStackSlot, and Register().

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

◆ index2VirtReg()

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

◆ isPhysical()

bool llvm::Register::isPhysical ( ) const
inline

◆ isPhysicalRegister()

static bool llvm::Register::isPhysicalRegister ( unsigned  Reg)
inlinestatic

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

Definition at line 65 of file Register.h.

References llvm::MCRegister::isPhysicalRegister().

Referenced by llvm::ARMBaseInstrInfo::AddDReg(), llvm::MachineBasicBlock::addLiveIn(), llvm::DwarfExpression::addMachineReg(), llvm::MachineInstr::addRegisterDead(), llvm::MachineInstr::addRegisterDefined(), llvm::MachineInstr::addRegisterKilled(), llvm::ScheduleDAGInstrs::addSchedBarrierDeps(), AddSubReg(), llvm::LiveRangeEdit::allUsesAvailableAt(), llvm::AnalyzePhysRegInBundle(), llvm::HexagonSubtarget::CallMutation::apply(), llvm::VirtRegMap::assignVirt2Phys(), llvm::biasPhysReg(), llvm::ARMBaseInstrInfo::breakPartialRegDependency(), llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::calculateDbgEntityHistory(), canCompareBeNewValueJump(), canFoldCopy(), canFoldIntoSelect(), llvm::PPCInstrInfo::canInsertSelect(), llvm::MachineInstr::clearRegisterKills(), llvm::TargetInstrInfo::commuteInstructionImpl(), llvm::constrainSelectedInstRegOperands(), llvm::SelectionDAGBuilder::CopyValueToVirtualRegister(), llvm::X86InstrInfo::describeLoadedValue(), llvm::InstructionSelector::executeMatchTable(), llvm::HexagonBlockRanges::expandToSubRegs(), llvm::finalizeBundle(), findHoistingInsertPosAndDeps(), llvm::MachineInstr::findRegisterDefOperandIdx(), llvm::CoalescerPair::flip(), llvm::AArch64InstrInfo::foldMemoryOperandImpl(), llvm::RegScavenger::forward(), llvm::rdf::PhysicalRegisterInfo::getAliasSet(), getDataDeps(), llvm::AArch64RegisterBankInfo::getInstrMapping(), llvm::M68kRegisterInfo::getMaximalPhysRegClass(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::RegisterBankInfo::getMinimalPhysRegClass(), llvm::TargetRegisterInfo::getMinimalPhysRegClassLLT(), llvm::HexagonInstrInfo::getOperandLatency(), llvm::SystemZRegisterInfo::getRegAllocationHints(), llvm::RegisterBankInfo::getRegBank(), getRegisterName(), llvm::getRegState(), llvm::RegisterBankInfo::getSizeInBits(), llvm::X86InstrInfo::getUndefRegClearance(), llvm::VirtRegMap::hasKnownPreference(), INITIALIZE_PASS(), llvm::rdf::CopyPropagation::interpretAsCopy(), interpretValues(), llvm::TargetRegisterInfo::isCalleeSavedPhysReg(), llvm::PPCRegisterInfo::isCallerPreservedPhysReg(), llvm::MachineRegisterInfo::isConstantPhysReg(), llvm::HexagonInstrInfo::isDependent(), isEvenReg(), isIdenticalOp(), isLocalCopy(), llvm::MachineLoop::isLoopInvariant(), isPhysical(), llvm::MachineOperand::isRenamable(), isSafeToMove(), llvm::isTriviallyDead(), llvm::SMSchedule::isValidSchedule(), llvm::AMDGPULegalizerInfo::loadInputValue(), llvm::Thumb1InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::ARMBaseInstrInfo::loadRegFromStackSlot(), loadRegPairFromStackSlot(), llvm::ARMCallLowering::lowerCall(), llvm::rdf::DataFlowGraph::makeRegRef(), MIIsInTerminatorSequence(), llvm::phys_regs_and_masks(), llvm::MachineOperand::print(), llvm::ARMAsmPrinter::printOperand(), llvm::recomputeLivenessFlags(), llvm::MachineRegisterInfo::replaceRegWith(), llvm::GenericScheduler::reschedulePhysReg(), llvm::rdf::Liveness::resetKills(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::MachineOperand::setIsRenamable(), llvm::CoalescerPair::setRegisters(), llvm::SystemZRegisterInfo::shouldCoalesce(), llvm::MachineBasicBlock::SplitCriticalEdge(), llvm::LivePhysRegs::stepForward(), storeRegPairToStackSlot(), llvm::Thumb1InstrInfo::storeRegToStackSlot(), llvm::MachineInstr::substituteRegister(), llvm::MachineOperand::substPhysReg(), unstackifyVRegsUsedInSplitBB(), UpdateOperandRegClass(), updatePhysDepsUpwards(), and llvm::DwarfCompileUnit::updateSubprogramScopeDIE().

◆ isStack()

bool llvm::Register::isStack ( ) const
inline

Return true if this is a stack slot.

Definition at line 49 of file Register.h.

References llvm::MCRegister::isStackSlot().

◆ isStackSlot()

static bool llvm::Register::isStackSlot ( unsigned  Reg)
inlinestatic

isStackSlot - Sometimes it is useful the 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::PhysicalRegisterInfo::isRegMaskId(), isVirtualRegister(), and llvm::printReg().

◆ isValid()

bool llvm::Register::isValid ( ) const
inline

◆ isVirtual()

bool llvm::Register::isVirtual ( ) const
inline

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::VirtRegMap::assignVirt2Phys(), llvm::VirtRegMap::assignVirt2StackSlot(), attemptDebugCopyProp(), llvm::X86InstrInfo::classifyLEAReg(), llvm::VirtRegMap::clearVirt(), llvm::GISelKnownBits::computeKnownBitsImpl(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), llvm::ThumbRegisterInfo::emitLoadConstPool(), llvm::SIInstrInfo::FoldImmediate(), llvm::SIInstrInfo::foldMemoryOperandImpl(), llvm::BitTracker::MachineEvaluator::getCell(), getCopyRegClasses(), getDefRegMask(), getLanesWithProperty(), llvm::VirtRegMap::getPhys(), llvm::MachineRegisterInfo::getRegAllocationHint(), llvm::MachineRegisterInfo::getRegAllocationHints(), llvm::TargetRegisterInfo::getRegAllocationHints(), llvm::BitTracker::MachineEvaluator::getRegBitWidth(), getRegSeqInit(), llvm::VirtRegMap::getShape(), llvm::MachineRegisterInfo::getSimpleHint(), llvm::VirtRegMap::getStackSlot(), getUsedRegMask(), llvm::getVRegSubRegDef(), llvm::VirtRegMap::hasPreferredPhys(), hasSameValue(), INITIALIZE_PASS(), isLibCallInTailPosition(), isVirtualRegisterOperand(), IsWritingToVCCR(), llvm::AMDGPULegalizerInfo::loadInputValue(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::TargetRegisterInfo::lookThruCopyLike(), llvm::TargetRegisterInfo::lookThruSingleUseCopyChain(), MatchingStackOffset(), llvm::BitTracker::RegisterCell::meet(), llvm::SIInstrInfo::moveToVALU(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::Thumb2InstrInfo::optimizeSelect(), llvm::PSetIterator::PSetIterator(), llvm::BitTracker::MachineEvaluator::putCell(), regIsPICBase(), llvm::MachineRegisterInfo::setRegAllocationHint(), llvm::MachineRegisterInfo::shouldTrackSubRegLiveness(), shrinkScalarLogicOp(), llvm::SIInstrInfo::storeRegToStackSlot(), tryChangeVGPRtoSGPRinCopy(), llvm::LegalizationArtifactCombiner::tryCombineInstruction(), tryToFoldACImm(), and llvm::SIInstrInfo::usesConstantBus().

◆ isVirtualRegister()

static bool llvm::Register::isVirtualRegister ( unsigned  Reg)
inlinestatic

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

Definition at line 71 of file Register.h.

References isStackSlot(), and llvm::MCRegister::VirtualRegFlag.

Referenced by llvm::RegsForValue::AddInlineAsmOperands(), llvm::LiveVariables::addNewBlock(), llvm::MachineRegisterInfo::addRegAllocationHint(), llvm::ScheduleDAGInstrs::addSchedBarrierDeps(), llvm::RegisterOperands::adjustLaneLiveness(), llvm::RegAllocBase::allocatePhysRegs(), llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::calculateDbgEntityHistory(), canCombine(), canFoldCopy(), canFoldIntoCSel(), CheckForPhysRegDependency(), llvm::ScheduleDAGMILive::collectVRegUses(), llvm::PPCInstrInfo::combineRLWINM(), llvm::ScheduleDAGMILive::computeCyclicCriticalPath(), computeLiveOuts(), llvm::ScheduleDAGSDNodes::computeOperandLatency(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), llvm::LiveInterval::computeSubRangeUndefs(), llvm::constrainOperandRegClass(), llvm::ARMBaseInstrInfo::convertToThreeAddress(), copyHint(), llvm::WebAssemblyInstrInfo::copyPhysReg(), dominatesAllUsesOf(), llvm::WebAssemblyRegisterInfo::eliminateFrameIndex(), llvm::ARMBaseRegisterInfo::eliminateFrameIndex(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), emitThumbRegPlusImmInReg(), llvm::FastISel::fastEmitInst_extractsubreg(), findSurvivorBackwards(), llvm::PPCInstrInfo::fixupIsDeadOrKill(), llvm::AArch64InstrInfo::foldMemoryOperandImpl(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), genFusedMultiply(), genMaddR(), getCallTargetRegOpnd(), llvm::RegsForValue::getCopyFromRegs(), llvm::PPCInstrInfo::getFMAPatterns(), llvm::MachineInstrExpressionTrait::getHashValue(), getLiveRange(), llvm::MachineRegisterInfo::getMaxLaneMaskForVReg(), llvm::PPCInstrInfo::getOperandLatency(), llvm::ARMBaseInstrInfo::getPartialRegUpdateClearance(), llvm::PPCRegisterInfo::getRegAllocationHints(), llvm::MachineRegisterInfo::getType(), getVDefInterval(), llvm::VirtRegMap::hasKnownPreference(), hasOnlyLiveInOpers(), hasOnlyLiveOutUses(), llvm::TargetInstrInfo::hasReassociableOperands(), llvm::RegPressureTracker::initLiveThru(), llvm::WebAssembly::isChild(), isCopyFeedingInvariantStore(), isCVTAToLocalCombinationCandidate(), isFPR64(), llvm::MachineInstr::isIdenticalTo(), isInvariantStore(), isRematerializable(), llvm::PPCInstrInfo::isSignOrZeroExtended(), isVirtual(), llvm::Mips16InstrInfo::loadImmediate(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::AArch64InstrInfo::loadRegFromStackSlot(), MatchingStackOffset(), oneUseDominatesOtherUses(), llvm::AArch64InstrInfo::optimizeCondBranch(), llvm::SMSchedule::orderDependence(), llvm::MachineOperand::print(), llvm::printReg(), llvm::printVRegOrUnit(), llvm::ARMBaseInstrInfo::produceSameValue(), propagateLocalCopies(), llvm::TargetInstrInfo::reassociateOps(), llvm::RegPressureTracker::recede(), llvm::WebAssemblyAsmPrinter::regToString(), removeCopies(), llvm::LiveVariables::removeVirtualRegistersKilled(), rescheduleCanonically(), llvm::rewriteT2FrameIndex(), llvm::InstructionSelect::runOnMachineFunction(), llvm::SelectionDAGISel::runOnMachineFunction(), scavengeFrameVirtualRegsInBlock(), llvm::RegScavenger::scavengeRegister(), llvm::AVRDAGToDAGISel::SelectInlineAsmMemoryOperand(), llvm::CoalescerPair::setRegisters(), llvm::LiveIntervals::shrinkToUses(), llvm::MachineBasicBlock::SplitCriticalEdge(), llvm::stableHashValue(), llvm::Thumb2InstrInfo::storeRegToStackSlot(), llvm::AArch64InstrInfo::storeRegToStackSlot(), stripValuesNotDefiningMask(), llvm::LiveIntervals::HMEditor::updateAllRanges(), llvm::ScheduleDAGMILive::updatePressureDiffs(), llvm::ARMBaseRegisterInfo::updateRegAllocHint(), and virtReg2Index().

◆ operator MCRegister()

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

Definition at line 113 of file Register.h.

◆ operator unsigned()

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

Definition at line 107 of file Register.h.

◆ operator!=() [1/5]

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

Definition at line 132 of file Register.h.

References Other.

◆ operator!=() [2/5]

bool llvm::Register::operator!= ( const Register Other) const
inline

Definition at line 130 of file Register.h.

References Other.

◆ operator!=() [3/5]

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

Definition at line 141 of file Register.h.

References Other.

◆ operator!=() [4/5]

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

Definition at line 144 of file Register.h.

References Other.

◆ operator!=() [5/5]

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

Definition at line 139 of file Register.h.

References Other.

◆ operator==() [1/5]

bool llvm::Register::operator== ( const MCRegister Other) const
inline

Definition at line 131 of file Register.h.

References Other.

◆ operator==() [2/5]

bool llvm::Register::operator== ( const Register Other) const
inline

Comparisons between register objects.

Definition at line 129 of file Register.h.

References Other.

◆ operator==() [3/5]

bool llvm::Register::operator== ( int  Other) const
inline

Definition at line 140 of file Register.h.

References Other.

◆ operator==() [4/5]

bool llvm::Register::operator== ( MCPhysReg  Other) const
inline

Definition at line 143 of file Register.h.

References Other.

◆ operator==() [5/5]

bool llvm::Register::operator== ( unsigned  Other) const
inline

Comparisons against register constants.

E.g.

Definition at line 138 of file Register.h.

References 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(), llvm::MCRegister::FirstStackSlot, and int.

Referenced by llvm::rdf::PhysicalRegisterInfo::getMaskUnits(), llvm::rdf::PhysicalRegisterInfo::getRegMaskBits(), 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 103 of file Register.h.

References virtReg2Index().


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