LLVM 20.0.0git
|
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. | |
Wrapper class representing virtual and physical registers.
Should be passed by value.
Definition at line 19 of file Register.h.
|
inlineconstexpr |
Definition at line 23 of file Register.h.
|
inlineconstexpr |
Definition at line 24 of file Register.h.
|
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 110 of file Register.h.
References assert(), llvm::MCRegister::isPhysicalRegister(), and llvm::MCRegister::NoRegister.
Referenced by llvm::TargetRegisterClass::contains(), llvm::VirtRegAuxInfo::copyHint(), llvm::BitTracker::MachineEvaluator::getRegBitWidth(), isCopyFeedingInvariantStore(), llvm::TargetRegisterInfo::regsOverlap(), and updatePhysDepsDownwards().
|
inlineconstexpr |
Definition at line 103 of file Register.h.
Referenced by llvm::VirtRegMap::assignVirt2Phys(), llvm::VirtRegMap::assignVirt2Shape(), llvm::VirtRegMap::assignVirt2StackSlot(), llvm::VirtRegMap::clearVirt(), llvm::DenseMapInfo< Register >::getHashValue(), llvm::ARMBankConflictHazardRecognizer::getHazardType(), getLibCallID(), getMaxPushPopReg(), llvm::VirtRegMap::getPhys(), llvm::VirtRegMap::getPreSplitReg(), llvm::MachineRegisterInfo::getRegAllocationHint(), llvm::VirtRegMap::getStackSlot(), llvm::VirtRegMap::isAssignedReg(), llvm::LoongArchAsmPrinter::PrintAsmOperand(), llvm::VirtRegMap::setIsSplitFromReg(), and llvm::PBQP::RegAlloc::GraphMetadata::setNodeIdForVReg().
|
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().
Convert a 0-based index to a virtual register number.
This is the inverse operation of VirtReg2IndexFunctor below.
Definition at line 84 of file Register.h.
References assert(), and llvm::MCRegister::VirtualRegFlag.
Referenced by addImplicitDefs(), llvm::LiveIntervals::addKillFlags(), llvm::LiveVariables::addNewBlock(), llvm::MachineRegisterInfo::addRegAllocationHint(), llvm::VirtRegAuxInfo::calculateSpillWeightsAndHints(), llvm::MachineRegisterInfo::clearVirtRegs(), llvm::DeadLaneDetector::computeSubRegisterLaneBitInfo(), llvm::MIRPrinter::convert(), llvm::MachineRegisterInfo::createIncompleteVirtualRegister(), llvm::SITargetLowering::finalizeLowering(), llvm::getLiveRegMap(), llvm::getLiveRegs(), llvm::SPIRV::ModuleAnalysisInfo::getOrCreateMBBRegister(), isSSA(), llvm::LiveIntervals::print(), llvm::LiveVariables::print(), llvm::VirtRegMap::print(), llvm::InstructionSelect::selectMachineFunction(), llvm::MachineRegisterInfo::setRegAllocationHint(), llvm::SIMachineFunctionInfo::usesAGPRs(), and llvm::MachineRegisterInfo::verifyUseLists().
|
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().
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(), AddSubReg(), llvm::VirtRegMap::assignVirt2Phys(), llvm::calculateDbgEntityHistory(), canCompareBeNewValueJump(), llvm::SelectionDAGBuilder::CopyValueToVirtualRegister(), llvm::M68kRegisterInfo::getMaximalPhysRegClass(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::TargetRegisterInfo::getMinimalPhysRegClassLLT(), llvm::X86RegisterInfo::getRegAllocationHints(), llvm::rdf::CopyPropagation::interpretAsCopy(), llvm::TargetRegisterInfo::isCalleeSavedPhysReg(), llvm::PPCRegisterInfo::isCallerPreservedPhysReg(), llvm::MachineRegisterInfo::isConstantPhysReg(), isEvenReg(), isPhysical(), llvm::rdf::RegisterRef::isRegId(), llvm::SMSchedule::isValidSchedule(), llvm::AMDGPULegalizerInfo::loadInputValue(), llvm::GenericScheduler::reschedulePhysReg(), llvm::MachineOperand::substPhysReg(), and llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
inlineconstexpr |
Return true if this is a stack slot.
Definition at line 49 of file Register.h.
References llvm::MCRegister::isStackSlot().
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().
|
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().
|
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().
Return true if the specified register number is in the virtual register namespace.
Definition at line 71 of file Register.h.
References llvm::MCRegister::VirtualRegFlag.
Referenced by llvm::RegsForValue::AddInlineAsmOperands(), canFoldIntoCSel(), CheckForPhysRegDependency(), llvm::ScheduleDAGSDNodes::computeOperandLatency(), llvm::WebAssemblyInstrInfo::copyPhysReg(), definedBySignExtendingOp(), definedByZeroExtendingOp(), dominatesAllUsesOf(), llvm::FastISel::fastEmitInst_extractsubreg(), llvm::AArch64InstrInfo::foldMemoryOperandImpl(), genMaddR(), llvm::RegsForValue::getCopyFromRegs(), getLiveRange(), isFPR64(), llvm::PPCInstrInfo::isSignOrZeroExtended(), llvm::rdf::RegisterRef::isUnitId(), isVirtual(), MatchingStackOffset(), llvm::printVRegOrUnit(), removeCopies(), and stripValuesNotDefiningMask().
|
inlineconstexpr |
Definition at line 105 of file Register.h.
|
inlineconstexpr |
Definition at line 101 of file Register.h.
|
inlineconstexpr |
Definition at line 128 of file Register.h.
References llvm::Other.
Definition at line 122 of file Register.h.
References llvm::Other.
|
inlineconstexpr |
Definition at line 139 of file Register.h.
References llvm::Other.
Definition at line 144 of file Register.h.
References llvm::Other.
Definition at line 137 of file Register.h.
References llvm::Other.
|
inlineconstexpr |
Definition at line 125 of file Register.h.
References llvm::Other.
Comparisons between register objects.
Definition at line 119 of file Register.h.
References llvm::Other.
|
inlineconstexpr |
Definition at line 138 of file Register.h.
References llvm::Other.
Definition at line 141 of file Register.h.
References llvm::Other.
Comparisons against register constants.
E.g.
Definition at line 136 of file Register.h.
References llvm::Other.
|
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().
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 77 of file Register.h.
References assert().
Referenced by llvm::SPIRVGeneralDuplicatesTracker::buildDepsGraph(), checkFrameBase(), emitOperand(), llvm::VReg2SUnit::getSparseSetIndex(), llvm::WebAssemblyFunctionInfo::getWAReg(), llvm::WebAssemblyFunctionInfo::isVRegStackified(), llvm::VirtReg2IndexFunctor::operator()(), llvm::SPIRVInstPrinter::printOperand(), llvm::printVRegOrUnit(), llvm::SelectionDAGISel::runOnMachineFunction(), scavengeFrameVirtualRegsInBlock(), llvm::WebAssemblyFunctionInfo::setWAReg(), llvm::WebAssemblyFunctionInfo::stackifyVReg(), llvm::DeadLaneDetector::transferUsedLanes(), llvm::WebAssemblyFunctionInfo::unstackifyVReg(), and virtRegIndex().
|
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().