Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::MachineRegisterInfo Class Reference

MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc. More...

#include "llvm/CodeGen/MachineRegisterInfo.h"

Classes

class  defusechain_instr_iterator
 defusechain_iterator - This class provides iterator support for machine operands in the function that use or define a specific register. More...
class  defusechain_iterator
 reg_begin/reg_end - Provide iteration support to walk over all definitions and uses of a register within the MachineFunction that corresponds to this MachineRegisterInfo object. More...
class  Delegate
struct  VRegAttrs
 All attributes(register class or bank and low-level type) a virtual register can have. More...

Public Types

using reg_iterator = defusechain_iterator<true, true, false, true, false>
 reg_iterator/reg_begin/reg_end - Walk all defs and uses of the specified register.
using reg_instr_iterator
 reg_instr_iterator/reg_instr_begin/reg_instr_end - Walk all defs and uses of the specified register, stepping by MachineInstr.
using reg_bundle_iterator
 reg_bundle_iterator/reg_bundle_begin/reg_bundle_end - Walk all defs and uses of the specified register, stepping by bundle.
using reg_nodbg_iterator
 reg_nodbg_iterator/reg_nodbg_begin/reg_nodbg_end - Walk all defs and uses of the specified register, skipping those marked as Debug.
using reg_instr_nodbg_iterator
 reg_instr_nodbg_iterator/reg_instr_nodbg_begin/reg_instr_nodbg_end - Walk all defs and uses of the specified register, stepping by MachineInstr, skipping those marked as Debug.
using reg_bundle_nodbg_iterator
 reg_bundle_nodbg_iterator/reg_bundle_nodbg_begin/reg_bundle_nodbg_end - Walk all defs and uses of the specified register, stepping by bundle, skipping those marked as Debug.
using def_iterator = defusechain_iterator<false, true, false, true, false>
 def_iterator/def_begin/def_end - Walk all defs of the specified register.
using def_instr_iterator
 def_instr_iterator/def_instr_begin/def_instr_end - Walk all defs of the specified register, stepping by MachineInst.
using def_bundle_iterator
 def_bundle_iterator/def_bundle_begin/def_bundle_end - Walk all defs of the specified register, stepping by bundle.
using use_iterator = defusechain_iterator<true, false, false, true, false>
 use_iterator/use_begin/use_end - Walk all uses of the specified register.
using use_instr_iterator
 use_instr_iterator/use_instr_begin/use_instr_end - Walk all uses of the specified register, stepping by MachineInstr.
using use_bundle_iterator
 use_bundle_iterator/use_bundle_begin/use_bundle_end - Walk all uses of the specified register, stepping by bundle.
using use_nodbg_iterator
 use_nodbg_iterator/use_nodbg_begin/use_nodbg_end - Walk all uses of the specified register, skipping those marked as Debug.
using use_instr_nodbg_iterator
 use_instr_nodbg_iterator/use_instr_nodbg_begin/use_instr_nodbg_end - Walk all uses of the specified register, stepping by MachineInstr, skipping those marked as Debug.
using use_bundle_nodbg_iterator
 use_bundle_nodbg_iterator/use_bundle_nodbg_begin/use_bundle_nodbg_end - Walk all uses of the specified register, stepping by bundle, skipping those marked as Debug.
using livein_iterator

Public Member Functions

LLVM_ABI MachineRegisterInfo (MachineFunction *MF)
 MachineRegisterInfo (const MachineRegisterInfo &)=delete
MachineRegisterInfooperator= (const MachineRegisterInfo &)=delete
const TargetRegisterInfogetTargetRegisterInfo () const
void resetDelegate (Delegate *delegate)
void addDelegate (Delegate *delegate)
void noteNewVirtualRegister (Register Reg)
void noteCloneVirtualRegister (Register NewReg, Register SrcReg)
const MachineFunctiongetMF () const
bool isSSA () const
void leaveSSA ()
bool tracksLiveness () const
 tracksLiveness - Returns true when tracking register liveness accurately.
void invalidateLiveness ()
 invalidateLiveness - Indicates that register liveness is no longer being tracked accurately.
bool shouldTrackSubRegLiveness (const TargetRegisterClass &RC) const
 Returns true if liveness for register class RC should be tracked at the subregister level.
bool shouldTrackSubRegLiveness (Register VReg) const
bool subRegLivenessEnabled () const
bool isUpdatedCSRsInitialized () const
 Returns true if the updated CSR list was initialized and false otherwise.
LLVM_ABI void disableCalleeSavedRegister (MCRegister Reg)
 Disables the register from the list of CSRs.
LLVM_ABI const MCPhysReggetCalleeSavedRegs () const
 Returns list of callee saved registers.
LLVM_ABI void setCalleeSavedRegs (ArrayRef< MCPhysReg > CSRs)
 Sets the updated Callee Saved Registers list.
LLVM_ABI void addRegOperandToUseList (MachineOperand *MO)
 Add MO to the linked list of operands for its register.
LLVM_ABI void removeRegOperandFromUseList (MachineOperand *MO)
 Remove MO from its use-def list.
LLVM_ABI void moveOperands (MachineOperand *Dst, MachineOperand *Src, unsigned NumOps)
 Move NumOps operands from Src to Dst, updating use-def lists as needed.
LLVM_ABI void verifyUseList (Register Reg) const
 Verify the sanity of the use list for Reg.
LLVM_ABI void verifyUseLists () const
 Verify the use list of all registers.
reg_iterator reg_begin (Register RegNo) const
iterator_range< reg_iteratorreg_operands (Register Reg) const
reg_instr_iterator reg_instr_begin (Register RegNo) const
iterator_range< reg_instr_iteratorreg_instructions (Register Reg) const
reg_bundle_iterator reg_bundle_begin (Register RegNo) const
iterator_range< reg_bundle_iteratorreg_bundles (Register Reg) const
bool reg_empty (Register RegNo) const
 reg_empty - Return true if there are no instructions using or defining the specified register (it may be live-in).
reg_nodbg_iterator reg_nodbg_begin (Register RegNo) const
iterator_range< reg_nodbg_iteratorreg_nodbg_operands (Register Reg) const
reg_instr_nodbg_iterator reg_instr_nodbg_begin (Register RegNo) const
iterator_range< reg_instr_nodbg_iteratorreg_nodbg_instructions (Register Reg) const
reg_bundle_nodbg_iterator reg_bundle_nodbg_begin (Register RegNo) const
iterator_range< reg_bundle_nodbg_iteratorreg_nodbg_bundles (Register Reg) const
bool reg_nodbg_empty (Register RegNo) const
 reg_nodbg_empty - Return true if the only instructions using or defining Reg are Debug instructions.
def_iterator def_begin (Register RegNo) const
iterator_range< def_iteratordef_operands (Register Reg) const
def_instr_iterator def_instr_begin (Register RegNo) const
iterator_range< def_instr_iteratordef_instructions (Register Reg) const
def_bundle_iterator def_bundle_begin (Register RegNo) const
iterator_range< def_bundle_iteratordef_bundles (Register Reg) const
bool def_empty (Register RegNo) const
 def_empty - Return true if there are no instructions defining the specified register (it may be live-in).
StringRef getVRegName (Register Reg) const
void insertVRegByName (StringRef Name, Register Reg)
bool hasOneDef (Register RegNo) const
 Return true if there is exactly one operand defining the specified register.
MachineOperandgetOneDef (Register Reg) const
 Returns the defining operand if there is exactly one operand defining the specified register, otherwise nullptr.
use_iterator use_begin (Register RegNo) const
iterator_range< use_iteratoruse_operands (Register Reg) const
use_instr_iterator use_instr_begin (Register RegNo) const
iterator_range< use_instr_iteratoruse_instructions (Register Reg) const
use_bundle_iterator use_bundle_begin (Register RegNo) const
iterator_range< use_bundle_iteratoruse_bundles (Register Reg) const
bool use_empty (Register RegNo) const
 use_empty - Return true if there are no instructions using the specified register.
bool hasOneUse (Register RegNo) const
 hasOneUse - Return true if there is exactly one instruction using the specified register.
use_nodbg_iterator use_nodbg_begin (Register RegNo) const
iterator_range< use_nodbg_iteratoruse_nodbg_operands (Register Reg) const
use_instr_nodbg_iterator use_instr_nodbg_begin (Register RegNo) const
iterator_range< use_instr_nodbg_iteratoruse_nodbg_instructions (Register Reg) const
use_bundle_nodbg_iterator use_bundle_nodbg_begin (Register RegNo) const
iterator_range< use_bundle_nodbg_iteratoruse_nodbg_bundles (Register Reg) const
bool use_nodbg_empty (Register RegNo) const
 use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register.
LLVM_ABI bool hasOneNonDBGUse (Register RegNo) const
 hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.
LLVM_ABI bool hasOneNonDBGUser (Register RegNo) const
 hasOneNonDBGUse - Return true if there is exactly one non-Debug instruction using the specified register.
LLVM_ABI MachineOperandgetOneNonDBGUse (Register RegNo) const
 If the register has a single non-Debug use, returns it; otherwise returns nullptr.
LLVM_ABI MachineInstrgetOneNonDBGUser (Register RegNo) const
 If the register has a single non-Debug instruction using the specified register, returns it; otherwise returns nullptr.
LLVM_ABI bool hasAtMostUserInstrs (Register Reg, unsigned MaxUsers) const
 hasAtMostUses - Return true if the given register has at most MaxUsers non-debug user instructions.
LLVM_ABI void replaceRegWith (Register FromReg, Register ToReg)
 replaceRegWith - Replace all instances of FromReg with ToReg in the machine function.
LLVM_ABI MachineInstrgetVRegDef (Register Reg) const
 getVRegDef - Return the machine instr that defines the specified virtual register or null if none is found.
LLVM_ABI MachineInstrgetUniqueVRegDef (Register Reg) const
 getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or null if none is found.
LLVM_ABI void clearKillFlags (Register Reg) const
 clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the MachineOperand.
LLVM_ABI void dumpUses (Register RegNo) const
LLVM_ABI bool isConstantPhysReg (MCRegister PhysReg) const
 Returns true if PhysReg is unallocatable and constant throughout the function.
PSetIterator getPressureSets (Register RegUnit) const
 Get an iterator over the pressure sets affected by the given physical or virtual register.
const TargetRegisterClassgetRegClass (Register Reg) const
 Return the register class of the specified virtual register.
const TargetRegisterClassgetRegClassOrNull (Register Reg) const
 Return the register class of Reg, or null if Reg has not been assigned a register class yet.
const RegisterBankgetRegBank (Register Reg) const
 Return the register bank of Reg.
const RegisterBankgetRegBankOrNull (Register Reg) const
 Return the register bank of Reg, or null if Reg has not been assigned a register bank or has been assigned a register class.
const RegClassOrRegBankgetRegClassOrRegBank (Register Reg) const
 Return the register bank or register class of Reg.
LLVM_ABI void setRegClass (Register Reg, const TargetRegisterClass *RC)
 setRegClass - Set the register class of the specified virtual register.
LLVM_ABI void setRegBank (Register Reg, const RegisterBank &RegBank)
 Set the register bank to RegBank for Reg.
void setRegClassOrRegBank (Register Reg, const RegClassOrRegBank &RCOrRB)
LLVM_ABI const TargetRegisterClassconstrainRegClass (Register Reg, const TargetRegisterClass *RC, unsigned MinNumRegs=0)
 constrainRegClass - Constrain the register class of the specified virtual register to be a common subclass of RC and the current register class, but only if the new class has at least MinNumRegs registers.
LLVM_ABI bool constrainRegAttrs (Register Reg, Register ConstrainingReg, unsigned MinNumRegs=0)
 Constrain the register class or the register bank of the virtual register Reg (and low-level type) to be a common subclass or a common bank of both registers provided respectively (and a common low-level type).
LLVM_ABI bool recomputeRegClass (Register Reg)
 recomputeRegClass - Try to find a legal super-class of Reg's register class that still satisfies the constraints from the instructions using Reg.
LLVM_ABI Register createVirtualRegister (const TargetRegisterClass *RegClass, StringRef Name="")
 createVirtualRegister - Create and return a new virtual register in the function with the specified register class.
VRegAttrs getVRegAttrs (Register Reg) const
 Returns register class or bank and low level type of Reg.
LLVM_ABI Register createVirtualRegister (VRegAttrs RegAttr, StringRef Name="")
 Create and return a new virtual register in the function with the specified register attributes(register class or bank and low level type).
LLVM_ABI Register cloneVirtualRegister (Register VReg, StringRef Name="")
 Create and return a new virtual register in the function with the same attributes as the given register.
LLT getType (Register Reg) const
 Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register.
LLVM_ABI void setType (Register VReg, LLT Ty)
 Set the low-level type of VReg to Ty.
LLVM_ABI Register createGenericVirtualRegister (LLT Ty, StringRef Name="")
 Create and return a new generic virtual register with low-level type Ty.
LLVM_ABI void clearVirtRegTypes ()
 Remove all types associated to virtual registers (after instruction selection and constraining of all generic virtual registers).
LLVM_ABI Register createIncompleteVirtualRegister (StringRef Name="")
 Creates a new virtual register that has no register class, register bank or size assigned yet.
unsigned getNumVirtRegs () const
 getNumVirtRegs - Return the number of virtual registers created.
LLVM_ABI void clearVirtRegs ()
 clearVirtRegs - Remove all virtual registers (after physreg assignment).
void setRegAllocationHint (Register VReg, unsigned Type, Register PrefReg)
 setRegAllocationHint - Specify a register allocation hint for the specified virtual register.
void addRegAllocationHint (Register VReg, Register PrefReg)
 addRegAllocationHint - Add a register allocation hint to the hints vector for VReg.
void setSimpleHint (Register VReg, Register PrefReg)
 Specify the preferred (target independent) register allocation hint for the specified virtual register.
void clearSimpleHint (Register VReg)
std::pair< unsigned, RegistergetRegAllocationHint (Register VReg) const
 getRegAllocationHint - Return the register allocation hint for the specified virtual register.
Register getSimpleHint (Register VReg) const
 getSimpleHint - same as getRegAllocationHint except it will only return a target independent hint.
const std::pair< unsigned, SmallVector< Register, 4 > > * getRegAllocationHints (Register VReg) const
 getRegAllocationHints - Return a reference to the vector of all register allocation hints for VReg.
LLVM_ABI void markUsesInDebugValueAsUndef (Register Reg) const
 markUsesInDebugValueAsUndef - Mark every DBG_VALUE referencing the specified register as undefined which causes the DBG_VALUE to be deleted during LiveDebugVariables analysis.
void updateDbgUsersToReg (MCRegister OldReg, MCRegister NewReg, ArrayRef< MachineInstr * > Users) const
 updateDbgUsersToReg - Update a collection of debug instructions to refer to the designated register.
LLVM_ABI bool isPhysRegModified (MCRegister PhysReg, bool SkipNoReturnDef=false) const
 Return true if the specified register is modified in this function.
LLVM_ABI bool isPhysRegUsed (MCRegister PhysReg, bool SkipRegMaskTest=false) const
 Return true if the specified register is modified or read in this function.
void addPhysRegsUsedFromRegMask (const uint32_t *RegMask)
 addPhysRegsUsedFromRegMask - Mark any registers not in RegMask as used.
const BitVectorgetUsedPhysRegsMask () const
LLVM_ABI void freezeReservedRegs ()
 freezeReservedRegs - Called by the register allocator to freeze the set of reserved registers before allocation begins.
void reserveReg (MCRegister PhysReg, const TargetRegisterInfo *TRI)
 reserveReg – Mark a register as reserved so checks like isAllocatable will not suggest using it.
bool reservedRegsFrozen () const
 reservedRegsFrozen - Returns true after freezeReservedRegs() was called to ensure the set of reserved registers stays constant.
bool canReserveReg (MCRegister PhysReg) const
 canReserveReg - Returns true if PhysReg can be used as a reserved register.
const BitVectorgetReservedRegs () const
 getReservedRegs - Returns a reference to the frozen set of reserved registers.
bool isReserved (MCRegister PhysReg) const
 isReserved - Returns true when PhysReg is a reserved register.
LLVM_ABI bool isReservedRegUnit (unsigned Unit) const
 Returns true when the given register unit is considered reserved.
bool isAllocatable (MCRegister PhysReg) const
 isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been reserved.
void addLiveIn (MCRegister Reg, Register vreg=Register())
 addLiveIn - Add the specified register as a live-in.
livein_iterator livein_begin () const
livein_iterator livein_end () const
bool livein_empty () const
ArrayRef< std::pair< MCRegister, Register > > liveins () const
LLVM_ABI bool isLiveIn (Register Reg) const
LLVM_ABI MCRegister getLiveInPhysReg (Register VReg) const
 getLiveInPhysReg - If VReg is a live-in virtual register, return the corresponding live-in physical register.
LLVM_ABI Register getLiveInVirtReg (MCRegister PReg) const
 getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in virtual register.
LLVM_ABI void EmitLiveInCopies (MachineBasicBlock *EntryMBB, const TargetRegisterInfo &TRI, const TargetInstrInfo &TII)
 EmitLiveInCopies - Emit copies to initialize livein virtual registers into the given entry block.
LLVM_ABI LaneBitmask getMaxLaneMaskForVReg (Register Reg) const
 Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual register Reg.

Static Public Member Functions

static reg_iterator reg_end ()
static reg_instr_iterator reg_instr_end ()
static reg_bundle_iterator reg_bundle_end ()
static reg_nodbg_iterator reg_nodbg_end ()
static reg_instr_nodbg_iterator reg_instr_nodbg_end ()
static reg_bundle_nodbg_iterator reg_bundle_nodbg_end ()
static def_iterator def_end ()
static def_instr_iterator def_instr_end ()
static def_bundle_iterator def_bundle_end ()
static use_iterator use_end ()
static use_instr_iterator use_instr_end ()
static use_bundle_iterator use_bundle_end ()
static use_nodbg_iterator use_nodbg_end ()
static use_instr_nodbg_iterator use_instr_nodbg_end ()
static use_bundle_nodbg_iterator use_bundle_nodbg_end ()

Friends

template<bool, bool, bool, bool, bool>
class defusechain_iterator
template<bool, bool, bool, bool>
class defusechain_instr_iterator

Detailed Description

MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.

Definition at line 53 of file MachineRegisterInfo.h.

Member Typedef Documentation

◆ def_bundle_iterator

Initial value:
defusechain_iterator - This class provides iterator support for machine operands in the function that...

def_bundle_iterator/def_bundle_begin/def_bundle_end - Walk all defs of the specified register, stepping by bundle.

Definition at line 415 of file MachineRegisterInfo.h.

◆ def_instr_iterator

Initial value:

def_instr_iterator/def_instr_begin/def_instr_end - Walk all defs of the specified register, stepping by MachineInst.

Definition at line 399 of file MachineRegisterInfo.h.

◆ def_iterator

using llvm::MachineRegisterInfo::def_iterator = defusechain_iterator<false, true, false, true, false>

def_iterator/def_begin/def_end - Walk all defs of the specified register.

Definition at line 387 of file MachineRegisterInfo.h.

◆ livein_iterator

Initial value:
std::vector<std::pair<MCRegister,Register>>::const_iterator

Definition at line 1010 of file MachineRegisterInfo.h.

◆ reg_bundle_iterator

Initial value:

reg_bundle_iterator/reg_bundle_begin/reg_bundle_end - Walk all defs and uses of the specified register, stepping by bundle.

Definition at line 313 of file MachineRegisterInfo.h.

◆ reg_bundle_nodbg_iterator

Initial value:

reg_bundle_nodbg_iterator/reg_bundle_nodbg_begin/reg_bundle_nodbg_end - Walk all defs and uses of the specified register, stepping by bundle, skipping those marked as Debug.

Definition at line 366 of file MachineRegisterInfo.h.

◆ reg_instr_iterator

Initial value:

reg_instr_iterator/reg_instr_begin/reg_instr_end - Walk all defs and uses of the specified register, stepping by MachineInstr.

Definition at line 297 of file MachineRegisterInfo.h.

◆ reg_instr_nodbg_iterator

Initial value:

reg_instr_nodbg_iterator/reg_instr_nodbg_begin/reg_instr_nodbg_end - Walk all defs and uses of the specified register, stepping by MachineInstr, skipping those marked as Debug.

Definition at line 349 of file MachineRegisterInfo.h.

◆ reg_iterator

using llvm::MachineRegisterInfo::reg_iterator = defusechain_iterator<true, true, false, true, false>

reg_iterator/reg_begin/reg_end - Walk all defs and uses of the specified register.

Definition at line 285 of file MachineRegisterInfo.h.

◆ reg_nodbg_iterator

Initial value:
reg_begin/reg_end - Provide iteration support to walk over all definitions and uses of a register wit...

reg_nodbg_iterator/reg_nodbg_begin/reg_nodbg_end - Walk all defs and uses of the specified register, skipping those marked as Debug.

Definition at line 332 of file MachineRegisterInfo.h.

◆ use_bundle_iterator

Initial value:

use_bundle_iterator/use_bundle_begin/use_bundle_end - Walk all uses of the specified register, stepping by bundle.

Definition at line 494 of file MachineRegisterInfo.h.

◆ use_bundle_nodbg_iterator

Initial value:

use_bundle_nodbg_iterator/use_bundle_nodbg_begin/use_bundle_nodbg_end - Walk all uses of the specified register, stepping by bundle, skipping those marked as Debug.

Definition at line 553 of file MachineRegisterInfo.h.

◆ use_instr_iterator

Initial value:

use_instr_iterator/use_instr_begin/use_instr_end - Walk all uses of the specified register, stepping by MachineInstr.

Definition at line 478 of file MachineRegisterInfo.h.

◆ use_instr_nodbg_iterator

Initial value:

use_instr_nodbg_iterator/use_instr_nodbg_begin/use_instr_nodbg_end - Walk all uses of the specified register, stepping by MachineInstr, skipping those marked as Debug.

Definition at line 536 of file MachineRegisterInfo.h.

◆ use_iterator

using llvm::MachineRegisterInfo::use_iterator = defusechain_iterator<true, false, false, true, false>

use_iterator/use_begin/use_end - Walk all uses of the specified register.

Definition at line 466 of file MachineRegisterInfo.h.

◆ use_nodbg_iterator

Initial value:

use_nodbg_iterator/use_nodbg_begin/use_nodbg_end - Walk all uses of the specified register, skipping those marked as Debug.

Definition at line 519 of file MachineRegisterInfo.h.

Constructor & Destructor Documentation

◆ MachineRegisterInfo() [1/2]

MachineRegisterInfo::MachineRegisterInfo ( MachineFunction * MF)
explicit

◆ MachineRegisterInfo() [2/2]

llvm::MachineRegisterInfo::MachineRegisterInfo ( const MachineRegisterInfo & )
delete

References MachineRegisterInfo().

Member Function Documentation

◆ addDelegate()

void llvm::MachineRegisterInfo::addDelegate ( Delegate * delegate)
inline

◆ addLiveIn()

void llvm::MachineRegisterInfo::addLiveIn ( MCRegister Reg,
Register vreg = Register() )
inline

addLiveIn - Add the specified register as a live-in.

Note that it is an error to add the same register to the same set more than once.

Definition at line 1004 of file MachineRegisterInfo.h.

References Reg.

Referenced by addLiveIn(), buildGitPtr(), llvm::MipsFunctionInfo::initGlobalBaseReg(), and llvm::SparcTargetLowering::LowerFormalArguments_32().

◆ addPhysRegsUsedFromRegMask()

void llvm::MachineRegisterInfo::addPhysRegsUsedFromRegMask ( const uint32_t * RegMask)
inline

addPhysRegsUsedFromRegMask - Mark any registers not in RegMask as used.

This corresponds to the bit mask attached to register mask operands.

Definition at line 914 of file MachineRegisterInfo.h.

◆ addRegAllocationHint()

void llvm::MachineRegisterInfo::addRegAllocationHint ( Register VReg,
Register PrefReg )
inline

addRegAllocationHint - Add a register allocation hint to the hints vector for VReg.

Definition at line 816 of file MachineRegisterInfo.h.

References assert(), getNumVirtRegs(), llvm::Register::index2VirtReg(), and llvm::Register::isVirtual().

◆ addRegOperandToUseList()

void MachineRegisterInfo::addRegOperandToUseList ( MachineOperand * MO)

Add MO to the linked list of operands for its register.

Definition at line 273 of file MachineRegisterInfo.cpp.

References assert(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isDef(), and llvm::Last.

◆ canReserveReg()

bool llvm::MachineRegisterInfo::canReserveReg ( MCRegister PhysReg) const
inline

canReserveReg - Returns true if PhysReg can be used as a reserved register.

Any register can be reserved before freezeReservedRegs() is called.

Definition at line 957 of file MachineRegisterInfo.h.

References llvm::MCRegister::id(), and reservedRegsFrozen().

Referenced by llvm::MipsRegisterInfo::canRealignStack().

◆ clearKillFlags()

void MachineRegisterInfo::clearKillFlags ( Register Reg) const

clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the MachineOperand.

This function is used by optimization passes which extend register lifetimes and need only preserve conservative kill flag information.

Definition at line 455 of file MachineRegisterInfo.cpp.

References use_operands().

Referenced by llvm::SITargetLowering::EmitInstrWithCustomInserter().

◆ clearSimpleHint()

void llvm::MachineRegisterInfo::clearSimpleHint ( Register VReg)
inline

Definition at line 828 of file MachineRegisterInfo.h.

References assert().

◆ clearVirtRegs()

void MachineRegisterInfo::clearVirtRegs ( )

clearVirtRegs - Remove all virtual registers (after physreg assignment).

Definition at line 206 of file MachineRegisterInfo.cpp.

References llvm::errs(), getNumVirtRegs(), getTargetRegisterInfo(), I, llvm::Register::index2VirtReg(), MI, llvm::printReg(), reg_instructions(), and verifyUseList().

◆ clearVirtRegTypes()

void MachineRegisterInfo::clearVirtRegTypes ( )

Remove all types associated to virtual registers (after instruction selection and constraining of all generic virtual registers).

Definition at line 203 of file MachineRegisterInfo.cpp.

◆ cloneVirtualRegister()

Register MachineRegisterInfo::cloneVirtualRegister ( Register VReg,
StringRef Name = "" )

Create and return a new virtual register in the function with the same attributes as the given register.

Definition at line 178 of file MachineRegisterInfo.cpp.

References createIncompleteVirtualRegister(), getType(), noteCloneVirtualRegister(), and setType().

◆ constrainRegAttrs()

bool MachineRegisterInfo::constrainRegAttrs ( Register Reg,
Register ConstrainingReg,
unsigned MinNumRegs = 0 )

Constrain the register class or the register bank of the virtual register Reg (and low-level type) to be a common subclass or a common bank of both registers provided respectively (and a common low-level type).

Do nothing if any of the attributes (classes, banks, or low-level types) of the registers are deemed incompatible, or if the resulting register will have a class smaller than before and of size less than MinNumRegs. Return true if such register attributes exist, false otherwise.

Note
Use this method instead of constrainRegClass and RegisterBankInfo::constrainGenericRegister everywhere but SelectionDAG ISel / FastISel and GlobalISel's InstructionSelect pass respectively.

Definition at line 92 of file MachineRegisterInfo.cpp.

References llvm::cast(), constrainRegClass(), getRegClassOrRegBank(), getType(), llvm::isa(), llvm::LLT::isValid(), setRegClassOrRegBank(), and setType().

◆ constrainRegClass()

const TargetRegisterClass * MachineRegisterInfo::constrainRegClass ( Register Reg,
const TargetRegisterClass * RC,
unsigned MinNumRegs = 0 )

constrainRegClass - Constrain the register class of the specified virtual register to be a common subclass of RC and the current register class, but only if the new class has at least MinNumRegs registers.

Return the new register class, or NULL if no such class exists. This should only be used when the constraint is known to be trivial, like GR32 -> GR32_NOSP. Beware of increasing register pressure.

Note
Assumes that the register has a register class assigned. Use RegisterBankInfo::constrainGenericRegister in GlobalISel's InstructionSelect pass and constrainRegAttrs in every other pass, including non-select passes of GlobalISel, instead.

Definition at line 84 of file MachineRegisterInfo.cpp.

References getRegClass().

Referenced by llvm::X86InstrInfo::classifyLEAReg(), constrainRegAttrs(), llvm::X86InstrInfo::convertToThreeAddress(), llvm::SIRegisterInfo::eliminateFrameIndex(), llvm::AArch64InstrInfo::foldMemoryOperandImpl(), llvm::AArch64InstrInfo::loadRegFromStackSlot(), and llvm::AArch64InstrInfo::storeRegToStackSlot().

◆ createGenericVirtualRegister()

◆ createIncompleteVirtualRegister()

Register MachineRegisterInfo::createIncompleteVirtualRegister ( StringRef Name = "")

Creates a new virtual register that has no register class, register bank or size assigned yet.

This is only allowed to be used temporarily while constructing machine instructions. Most operations are undefined on an incomplete register until one of setRegClass(), setRegBank() or setSize() has been called on it.

Definition at line 145 of file MachineRegisterInfo.cpp.

References getNumVirtRegs(), llvm::Register::index2VirtReg(), and insertVRegByName().

Referenced by cloneVirtualRegister(), createGenericVirtualRegister(), createVirtualRegister(), and createVirtualRegister().

◆ createVirtualRegister() [1/2]

Register MachineRegisterInfo::createVirtualRegister ( const TargetRegisterClass * RegClass,
StringRef Name = "" )

createVirtualRegister - Create and return a new virtual register in the function with the specified register class.

Definition at line 156 of file MachineRegisterInfo.cpp.

References assert(), createIncompleteVirtualRegister(), llvm::TargetRegisterClass::isAllocatable(), and noteNewVirtualRegister().

Referenced by addLiveIn(), llvm::buildBuiltinVariableLoad(), llvm::SPIRVGlobalRegistry::buildConstantSampler(), llvm::X86InstrInfo::classifyLEAReg(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::AArch64RegisterInfo::eliminateFrameIndex(), llvm::ARMBaseRegisterInfo::eliminateFrameIndex(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::SystemZRegisterInfo::eliminateFrameIndex(), llvm::ThumbRegisterInfo::eliminateFrameIndex(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::X86TargetLowering::EmitInstrWithCustomInserter(), llvm::CSKYFrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitThumbRegPlusImmInReg(), llvm::MipsFunctionInfo::getGlobalBaseReg(), llvm::SPIRVGlobalRegistry::getOrCreateGlobalVariableWithBinding(), llvm::SPIRVCallLowering::lowerCall(), LowerCallResults(), llvm::PPCRegisterInfo::lowerCRBitRestore(), llvm::PPCRegisterInfo::lowerCRBitSpilling(), llvm::PPCRegisterInfo::lowerCRRestore(), llvm::PPCRegisterInfo::lowerCRSpilling(), llvm::PPCRegisterInfo::lowerDMRRestore(), llvm::PPCRegisterInfo::lowerDMRSpilling(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::SparcTargetLowering::LowerFormalArguments_32(), llvm::PPCRegisterInfo::lowerWACCRestore(), llvm::PPCRegisterInfo::lowerWACCSpilling(), llvm::RISCVRegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::prepareDynamicAlloca(), and llvm::ThumbRegisterInfo::rewriteFrameIndex().

◆ createVirtualRegister() [2/2]

Register MachineRegisterInfo::createVirtualRegister ( VRegAttrs RegAttr,
StringRef Name = "" )

Create and return a new virtual register in the function with the specified register attributes(register class or bank and low level type).

Definition at line 169 of file MachineRegisterInfo.cpp.

References createIncompleteVirtualRegister(), noteNewVirtualRegister(), llvm::MachineRegisterInfo::VRegAttrs::RCOrRB, setType(), and llvm::MachineRegisterInfo::VRegAttrs::Ty.

◆ def_begin()

def_iterator llvm::MachineRegisterInfo::def_begin ( Register RegNo) const
inline

◆ def_bundle_begin()

def_bundle_iterator llvm::MachineRegisterInfo::def_bundle_begin ( Register RegNo) const
inline

Definition at line 417 of file MachineRegisterInfo.h.

Referenced by def_bundles().

◆ def_bundle_end()

def_bundle_iterator llvm::MachineRegisterInfo::def_bundle_end ( )
inlinestatic

Definition at line 420 of file MachineRegisterInfo.h.

Referenced by def_bundles().

◆ def_bundles()

iterator_range< def_bundle_iterator > llvm::MachineRegisterInfo::def_bundles ( Register Reg) const
inline

Definition at line 424 of file MachineRegisterInfo.h.

References def_bundle_begin(), def_bundle_end(), llvm::make_range(), and Reg.

◆ def_empty()

bool llvm::MachineRegisterInfo::def_empty ( Register RegNo) const
inline

def_empty - Return true if there are no instructions defining the specified register (it may be live-in).

Definition at line 430 of file MachineRegisterInfo.h.

References def_begin(), and def_end().

Referenced by getUniqueVRegDef(), and isConstantPhysReg().

◆ def_end()

def_iterator llvm::MachineRegisterInfo::def_end ( )
inlinestatic

◆ def_instr_begin()

def_instr_iterator llvm::MachineRegisterInfo::def_instr_begin ( Register RegNo) const
inline

Definition at line 401 of file MachineRegisterInfo.h.

Referenced by def_instructions(), getUniqueVRegDef(), and getVRegDef().

◆ def_instr_end()

def_instr_iterator llvm::MachineRegisterInfo::def_instr_end ( )
inlinestatic

Definition at line 404 of file MachineRegisterInfo.h.

Referenced by def_instructions(), getUniqueVRegDef(), and getVRegDef().

◆ def_instructions()

iterator_range< def_instr_iterator > llvm::MachineRegisterInfo::def_instructions ( Register Reg) const
inline

Definition at line 409 of file MachineRegisterInfo.h.

References def_instr_begin(), def_instr_end(), llvm::make_range(), and Reg.

◆ def_operands()

iterator_range< def_iterator > llvm::MachineRegisterInfo::def_operands ( Register Reg) const
inline

Definition at line 393 of file MachineRegisterInfo.h.

References def_begin(), def_end(), llvm::make_range(), and Reg.

Referenced by hasOneDef().

◆ disableCalleeSavedRegister()

void MachineRegisterInfo::disableCalleeSavedRegister ( MCRegister Reg)

Disables the register from the list of CSRs.

I.e. the register will not appear as part of the CSR mask.

See also
UpdatedCalleeSavedRegs.

Definition at line 622 of file MachineRegisterInfo.cpp.

References assert(), llvm::erase(), getTargetRegisterInfo(), I, llvm::MCRegAliasIterator::isValid(), Reg, and TRI.

◆ dumpUses()

LLVM_DUMP_METHOD void MachineRegisterInfo::dumpUses ( Register RegNo) const

Definition at line 525 of file MachineRegisterInfo.cpp.

References I, LLVM_DUMP_METHOD, and use_instructions().

◆ EmitLiveInCopies()

void MachineRegisterInfo::EmitLiveInCopies ( MachineBasicBlock * EntryMBB,
const TargetRegisterInfo & TRI,
const TargetInstrInfo & TII )

EmitLiveInCopies - Emit copies to initialize livein virtual registers into the given entry block.

Definition at line 488 of file MachineRegisterInfo.cpp.

References llvm::MachineBasicBlock::addLiveIn(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), TII, TRI, and use_nodbg_empty().

◆ freezeReservedRegs()

void MachineRegisterInfo::freezeReservedRegs ( )

freezeReservedRegs - Called by the register allocator to freeze the set of reserved registers before allocation begins.

Definition at line 531 of file MachineRegisterInfo.cpp.

References assert(), llvm::TargetRegisterInfo::getReservedRegs(), and getTargetRegisterInfo().

Referenced by createFrameHelperMachineFunction(), and llvm::TargetLoweringBase::finalizeLowering().

◆ getCalleeSavedRegs()

◆ getLiveInPhysReg()

MCRegister MachineRegisterInfo::getLiveInPhysReg ( Register VReg) const

getLiveInPhysReg - If VReg is a live-in virtual register, return the corresponding live-in physical register.

Definition at line 469 of file MachineRegisterInfo.cpp.

References liveins().

◆ getLiveInVirtReg()

Register MachineRegisterInfo::getLiveInVirtReg ( MCRegister PReg) const

getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in virtual register.

getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical register.

Definition at line 478 of file MachineRegisterInfo.cpp.

References liveins(), and Register.

◆ getMaxLaneMaskForVReg()

LaneBitmask MachineRegisterInfo::getMaxLaneMaskForVReg ( Register Reg) const

Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual register Reg.

Definition at line 517 of file MachineRegisterInfo.cpp.

References assert(), llvm::TargetRegisterClass::getLaneMask(), and getRegClass().

◆ getMF()

const MachineFunction & llvm::MachineRegisterInfo::getMF ( ) const
inline

Definition at line 189 of file MachineRegisterInfo.h.

◆ getNumVirtRegs()

unsigned llvm::MachineRegisterInfo::getNumVirtRegs ( ) const
inline

getNumVirtRegs - Return the number of virtual registers created.

Definition at line 797 of file MachineRegisterInfo.h.

Referenced by addRegAllocationHint(), clearVirtRegs(), createIncompleteVirtualRegister(), llvm::SPIRV::lowerBuiltinType(), setRegAllocationHint(), and verifyUseLists().

◆ getOneDef()

MachineOperand * llvm::MachineRegisterInfo::getOneDef ( Register Reg) const
inline

Returns the defining operand if there is exactly one operand defining the specified register, otherwise nullptr.

Definition at line 454 of file MachineRegisterInfo.h.

References def_begin(), def_end(), and Reg.

◆ getOneNonDBGUse()

MachineOperand * MachineRegisterInfo::getOneNonDBGUse ( Register RegNo) const

If the register has a single non-Debug use, returns it; otherwise returns nullptr.

Definition at line 435 of file MachineRegisterInfo.cpp.

References llvm::hasSingleElement(), and use_nodbg_operands().

◆ getOneNonDBGUser()

MachineInstr * MachineRegisterInfo::getOneNonDBGUser ( Register RegNo) const

If the register has a single non-Debug instruction using the specified register, returns it; otherwise returns nullptr.

Definition at line 440 of file MachineRegisterInfo.cpp.

References llvm::hasSingleElement(), and use_nodbg_instructions().

◆ getPressureSets()

PSetIterator llvm::MachineRegisterInfo::getPressureSets ( Register RegUnit) const
inline

Get an iterator over the pressure sets affected by the given physical or virtual register.

If RegUnit is physical, it must be a register unit (from MCRegUnitIterator).

Definition at line 1281 of file MachineRegisterInfo.h.

◆ getRegAllocationHint()

std::pair< unsigned, Register > llvm::MachineRegisterInfo::getRegAllocationHint ( Register VReg) const
inline

getRegAllocationHint - Return the register allocation hint for the specified virtual register.

If there are many hints, this returns the one with the greatest weight.

Definition at line 838 of file MachineRegisterInfo.h.

References assert(), llvm::Register::id(), llvm::Register::isVirtual(), and Register.

Referenced by getSimpleHint().

◆ getRegAllocationHints()

const std::pair< unsigned, SmallVector< Register, 4 > > * llvm::MachineRegisterInfo::getRegAllocationHints ( Register VReg) const
inline

getRegAllocationHints - Return a reference to the vector of all register allocation hints for VReg.

Definition at line 858 of file MachineRegisterInfo.h.

References assert(), and llvm::Register::isVirtual().

◆ getRegBank()

const RegisterBank * llvm::MachineRegisterInfo::getRegBank ( Register Reg) const
inline

Return the register bank of Reg.

This shouldn't be used directly unless Reg has a register bank.

Definition at line 673 of file MachineRegisterInfo.h.

References llvm::cast(), and Reg.

◆ getRegBankOrNull()

const RegisterBank * llvm::MachineRegisterInfo::getRegBankOrNull ( Register Reg) const
inline

Return the register bank of Reg, or null if Reg has not been assigned a register bank or has been assigned a register class.

Note
It is possible to get the register bank from the register class via RegisterBankInfo::getRegBankFromRegClass.

Definition at line 681 of file MachineRegisterInfo.h.

References llvm::dyn_cast_if_present(), and Reg.

◆ getRegClass()

const TargetRegisterClass * llvm::MachineRegisterInfo::getRegClass ( Register Reg) const
inline

Return the register class of the specified virtual register.

This shouldn't be used directly unless Reg has a register class.

See also
getRegClassOrNull when this might happen.

Definition at line 649 of file MachineRegisterInfo.h.

References assert(), llvm::cast(), llvm::isa(), and Reg.

Referenced by constrainRegClass(), llvm::AllocationOrder::create(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), foldPatchpoint(), GetCostForDef(), getMaxLaneMaskForVReg(), getRegTy(), isNonFoldablePartialRegisterLoad(), and recomputeRegClass().

◆ getRegClassOrNull()

const TargetRegisterClass * llvm::MachineRegisterInfo::getRegClassOrNull ( Register Reg) const
inline

Return the register class of Reg, or null if Reg has not been assigned a register class yet.

Note
A null register class can only happen when these two conditions are met:
  1. Generic virtual registers are created.
  2. The machine function has not completely been through the instruction selection process. None of this condition is possible without GlobalISel for now. In other words, if GlobalISel is not used or if the query happens after the select pass, using getRegClass is safe.

Definition at line 666 of file MachineRegisterInfo.h.

References llvm::dyn_cast_if_present(), and Reg.

Referenced by getRegClass(), and shouldTrackSubRegLiveness().

◆ getRegClassOrRegBank()

const RegClassOrRegBank & llvm::MachineRegisterInfo::getRegClassOrRegBank ( Register Reg) const
inline

Return the register bank or register class of Reg.

Note
Before the register bank gets assigned (i.e., before the RegBankSelect pass) Reg may not have either.

Definition at line 689 of file MachineRegisterInfo.h.

References Reg.

Referenced by constrainRegAttrs(), and getVRegAttrs().

◆ getReservedRegs()

const BitVector & llvm::MachineRegisterInfo::getReservedRegs ( ) const
inline

getReservedRegs - Returns a reference to the frozen set of reserved registers.

This method should always be preferred to calling TRI::getReservedRegs() when possible.

Definition at line 964 of file MachineRegisterInfo.h.

References assert(), and reservedRegsFrozen().

Referenced by isReserved().

◆ getSimpleHint()

Register llvm::MachineRegisterInfo::getSimpleHint ( Register VReg) const
inline

getSimpleHint - same as getRegAllocationHint except it will only return a target independent hint.

Definition at line 849 of file MachineRegisterInfo.h.

References assert(), getRegAllocationHint(), llvm::Register::isVirtual(), and Register.

◆ getTargetRegisterInfo()

◆ getType()

LLT llvm::MachineRegisterInfo::getType ( Register Reg) const
inline

Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register.

Definition at line 772 of file MachineRegisterInfo.h.

References Reg.

Referenced by cloneVirtualRegister(), constrainRegAttrs(), and getVRegAttrs().

◆ getUniqueVRegDef()

MachineInstr * MachineRegisterInfo::getUniqueVRegDef ( Register Reg) const

getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or null if none is found.

If there are multiple definitions or no definition, return null.

Definition at line 419 of file MachineRegisterInfo.cpp.

References def_empty(), def_instr_begin(), def_instr_end(), and I.

Referenced by llvm::WebAssemblyRegisterInfo::eliminateFrameIndex(), and genIndexedMultiply().

◆ getUsedPhysRegsMask()

const BitVector & llvm::MachineRegisterInfo::getUsedPhysRegsMask ( ) const
inline

Definition at line 918 of file MachineRegisterInfo.h.

◆ getVRegAttrs()

VRegAttrs llvm::MachineRegisterInfo::getVRegAttrs ( Register Reg) const
inline

Returns register class or bank and low level type of Reg.

Always safe to use. Special values are returned when Reg does not have some of the attributes.

Definition at line 757 of file MachineRegisterInfo.h.

References getRegClassOrRegBank(), getType(), and Reg.

◆ getVRegDef()

MachineInstr * MachineRegisterInfo::getVRegDef ( Register Reg) const

getVRegDef - Return the machine instr that defines the specified virtual register or null if none is found.

This assumes that the code is in SSA form, so there should only be one definition.

Definition at line 406 of file MachineRegisterInfo.cpp.

References assert(), def_instr_begin(), def_instr_end(), and I.

Referenced by llvm::SPIRVIRMapping::findMI(), getEffectiveImm(), llvm::SPIRVGlobalRegistry::getOrCreateOpTypeSampledImage(), validateFunCallMachineDef(), and llvm::SSAUpdaterTraits< MachineSSAUpdater >::ValueIsPHI().

◆ getVRegName()

StringRef llvm::MachineRegisterInfo::getVRegName ( Register Reg) const
inline

Definition at line 432 of file MachineRegisterInfo.h.

References Reg.

◆ hasAtMostUserInstrs()

bool MachineRegisterInfo::hasAtMostUserInstrs ( Register Reg,
unsigned MaxUsers ) const

hasAtMostUses - Return true if the given register has at most MaxUsers non-debug user instructions.

Definition at line 445 of file MachineRegisterInfo.cpp.

References llvm::hasNItemsOrLess(), use_instr_nodbg_begin(), and use_instr_nodbg_end().

◆ hasOneDef()

bool llvm::MachineRegisterInfo::hasOneDef ( Register RegNo) const
inline

Return true if there is exactly one operand defining the specified register.

Definition at line 448 of file MachineRegisterInfo.h.

References def_operands(), and llvm::hasSingleElement().

◆ hasOneNonDBGUse()

bool MachineRegisterInfo::hasOneNonDBGUse ( Register RegNo) const

hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.

Definition at line 427 of file MachineRegisterInfo.cpp.

References llvm::hasSingleElement(), and use_nodbg_operands().

◆ hasOneNonDBGUser()

bool MachineRegisterInfo::hasOneNonDBGUser ( Register RegNo) const

hasOneNonDBGUse - Return true if there is exactly one non-Debug instruction using the specified register.

Said instruction may have multiple uses.

Definition at line 431 of file MachineRegisterInfo.cpp.

References llvm::hasSingleElement(), and use_nodbg_instructions().

◆ hasOneUse()

bool llvm::MachineRegisterInfo::hasOneUse ( Register RegNo) const
inline

hasOneUse - Return true if there is exactly one instruction using the specified register.

Definition at line 513 of file MachineRegisterInfo.h.

References llvm::hasSingleElement(), and use_operands().

◆ insertVRegByName()

void llvm::MachineRegisterInfo::insertVRegByName ( StringRef Name,
Register Reg )
inline

Definition at line 436 of file MachineRegisterInfo.h.

References assert(), and Reg.

Referenced by createIncompleteVirtualRegister().

◆ invalidateLiveness()

void llvm::MachineRegisterInfo::invalidateLiveness ( )
inline

invalidateLiveness - Indicates that register liveness is no longer being tracked accurately.

This should be called by late passes that invalidate the liveness information.

Definition at line 218 of file MachineRegisterInfo.h.

◆ isAllocatable()

bool llvm::MachineRegisterInfo::isAllocatable ( MCRegister PhysReg) const
inline

isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been reserved.

Allocatable registers may show up in the allocation order of some virtual register, so a register allocator needs to track its liveness and availability.

Definition at line 993 of file MachineRegisterInfo.h.

References getTargetRegisterInfo(), llvm::TargetRegisterInfo::isInAllocatableClass(), and isReserved().

Referenced by llvm::PPCRegisterInfo::getCalleeSavedRegs(), and isConstantPhysReg().

◆ isConstantPhysReg()

bool MachineRegisterInfo::isConstantPhysReg ( MCRegister PhysReg) const

Returns true if PhysReg is unallocatable and constant throughout the function.

Writing to a constant register has no effect.

Definition at line 537 of file MachineRegisterInfo.cpp.

References assert(), def_empty(), getTargetRegisterInfo(), isAllocatable(), llvm::MCRegister::isPhysical(), llvm::MCRegAliasIterator::isValid(), and TRI.

◆ isLiveIn()

◆ isPhysRegModified()

bool MachineRegisterInfo::isPhysRegModified ( MCRegister PhysReg,
bool SkipNoReturnDef = false ) const

Return true if the specified register is modified in this function.

This checks that no defining machine operands exist for the register or any of its aliases. Definitions found on functions marked noreturn are ignored, to consider them pass 'true' for optional parameter SkipNoReturnDef. The register is also considered modified when it is set in the UsedPhysRegMask.

Definition at line 594 of file MachineRegisterInfo.cpp.

References def_begin(), def_end(), getTargetRegisterInfo(), llvm::MCRegister::id(), isNoReturnDef(), llvm::MCRegAliasIterator::isValid(), llvm::make_range(), and TRI.

Referenced by llvm::SIFrameLowering::determineCalleeSaves().

◆ isPhysRegUsed()

bool MachineRegisterInfo::isPhysRegUsed ( MCRegister PhysReg,
bool SkipRegMaskTest = false ) const

Return true if the specified register is modified or read in this function.

This checks that no machine operands exist for the register or any of its aliases. If SkipRegMaskTest is false, the register is considered used when it is set in the UsedPhysRegMask.

Definition at line 609 of file MachineRegisterInfo.cpp.

References getTargetRegisterInfo(), llvm::MCRegister::id(), llvm::MCRegAliasIterator::isValid(), reg_nodbg_empty(), and TRI.

Referenced by llvm::AArch64FrameLowering::determineCalleeSaves().

◆ isReserved()

bool llvm::MachineRegisterInfo::isReserved ( MCRegister PhysReg) const
inline

isReserved - Returns true when PhysReg is a reserved register.

Reserved registers may belong to an allocatable register class, but the target has explicitly requested that they are not used.

Definition at line 975 of file MachineRegisterInfo.h.

References getReservedRegs(), llvm::MCRegister::id(), and llvm::BitVector::test().

Referenced by llvm::SIRegisterInfo::buildSpillLoadStore(), llvm::SIRegisterInfo::eliminateFrameIndex(), llvm::RISCVFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), isAllocatable(), and llvm::SIRegisterInfo::isAsmClobberable().

◆ isReservedRegUnit()

bool MachineRegisterInfo::isReservedRegUnit ( unsigned Unit) const

Returns true when the given register unit is considered reserved.

Register units are considered reserved when for at least one of their root registers, the root register and all super registers are reserved. This currently iterates the register hierarchy and may be slower than expected.

Definition at line 670 of file MachineRegisterInfo.cpp.

References llvm::all_of(), getTargetRegisterInfo(), llvm::MCRegUnitRootIterator::isValid(), and TRI.

◆ isSSA()

bool llvm::MachineRegisterInfo::isSSA ( ) const
inline

Definition at line 202 of file MachineRegisterInfo.h.

◆ isUpdatedCSRsInitialized()

bool llvm::MachineRegisterInfo::isUpdatedCSRsInitialized ( ) const
inline

Returns true if the updated CSR list was initialized and false otherwise.

Definition at line 239 of file MachineRegisterInfo.h.

◆ leaveSSA()

void llvm::MachineRegisterInfo::leaveSSA ( )
inline

Definition at line 205 of file MachineRegisterInfo.h.

◆ livein_begin()

livein_iterator llvm::MachineRegisterInfo::livein_begin ( ) const
inline

Definition at line 1012 of file MachineRegisterInfo.h.

◆ livein_empty()

bool llvm::MachineRegisterInfo::livein_empty ( ) const
inline

Definition at line 1014 of file MachineRegisterInfo.h.

◆ livein_end()

livein_iterator llvm::MachineRegisterInfo::livein_end ( ) const
inline

Definition at line 1013 of file MachineRegisterInfo.h.

◆ liveins()

ArrayRef< std::pair< MCRegister, Register > > llvm::MachineRegisterInfo::liveins ( ) const
inline

◆ markUsesInDebugValueAsUndef()

void MachineRegisterInfo::markUsesInDebugValueAsUndef ( Register Reg) const

markUsesInDebugValueAsUndef - Mark every DBG_VALUE referencing the specified register as undefined which causes the DBG_VALUE to be deleted during LiveDebugVariables analysis.

Definition at line 556 of file MachineRegisterInfo.cpp.

References llvm::make_early_inc_range(), use_instructions(), and UseMI.

◆ moveOperands()

void MachineRegisterInfo::moveOperands ( MachineOperand * Dst,
MachineOperand * Src,
unsigned NumOps )

Move NumOps operands from Src to Dst, updating use-def lists as needed.

The Dst range is assumed to be uninitialized memory. (Or it may contain operands that won't be destroyed, which is OK because the MO destructor is trivial anyway).

The Src and Dst ranges may overlap.

Definition at line 341 of file MachineRegisterInfo.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, assert(), and llvm::Next.

◆ noteCloneVirtualRegister()

void llvm::MachineRegisterInfo::noteCloneVirtualRegister ( Register NewReg,
Register SrcReg )
inline

Definition at line 184 of file MachineRegisterInfo.h.

Referenced by cloneVirtualRegister().

◆ noteNewVirtualRegister()

void llvm::MachineRegisterInfo::noteNewVirtualRegister ( Register Reg)
inline

◆ operator=()

MachineRegisterInfo & llvm::MachineRegisterInfo::operator= ( const MachineRegisterInfo & )
delete

References MachineRegisterInfo().

◆ recomputeRegClass()

bool MachineRegisterInfo::recomputeRegClass ( Register Reg)

recomputeRegClass - Try to find a legal super-class of Reg's register class that still satisfies the constraints from the instructions using Reg.

Returns true if Reg was upgraded.

This method can be used after constraints have been removed from a virtual register, for example after removing instructions or splitting the live range.

Definition at line 122 of file MachineRegisterInfo.cpp.

References getRegClass(), getTargetRegisterInfo(), MI, reg_nodbg_operands(), setRegClass(), TII, and TRI.

◆ reg_begin()

reg_iterator llvm::MachineRegisterInfo::reg_begin ( Register RegNo) const
inline

Definition at line 286 of file MachineRegisterInfo.h.

Referenced by reg_empty(), and reg_operands().

◆ reg_bundle_begin()

reg_bundle_iterator llvm::MachineRegisterInfo::reg_bundle_begin ( Register RegNo) const
inline

Definition at line 315 of file MachineRegisterInfo.h.

Referenced by reg_bundles().

◆ reg_bundle_end()

reg_bundle_iterator llvm::MachineRegisterInfo::reg_bundle_end ( )
inlinestatic

Definition at line 318 of file MachineRegisterInfo.h.

Referenced by reg_bundles().

◆ reg_bundle_nodbg_begin()

reg_bundle_nodbg_iterator llvm::MachineRegisterInfo::reg_bundle_nodbg_begin ( Register RegNo) const
inline

Definition at line 368 of file MachineRegisterInfo.h.

Referenced by reg_nodbg_bundles().

◆ reg_bundle_nodbg_end()

reg_bundle_nodbg_iterator llvm::MachineRegisterInfo::reg_bundle_nodbg_end ( )
inlinestatic

Definition at line 371 of file MachineRegisterInfo.h.

Referenced by reg_nodbg_bundles().

◆ reg_bundles()

iterator_range< reg_bundle_iterator > llvm::MachineRegisterInfo::reg_bundles ( Register Reg) const
inline

Definition at line 322 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, reg_bundle_begin(), and reg_bundle_end().

◆ reg_empty()

bool llvm::MachineRegisterInfo::reg_empty ( Register RegNo) const
inline

reg_empty - Return true if there are no instructions using or defining the specified register (it may be live-in).

Definition at line 328 of file MachineRegisterInfo.h.

References reg_begin(), and reg_end().

◆ reg_end()

reg_iterator llvm::MachineRegisterInfo::reg_end ( )
inlinestatic

Definition at line 289 of file MachineRegisterInfo.h.

Referenced by reg_empty(), and reg_operands().

◆ reg_instr_begin()

reg_instr_iterator llvm::MachineRegisterInfo::reg_instr_begin ( Register RegNo) const
inline

Definition at line 299 of file MachineRegisterInfo.h.

Referenced by reg_instructions().

◆ reg_instr_end()

reg_instr_iterator llvm::MachineRegisterInfo::reg_instr_end ( )
inlinestatic

Definition at line 302 of file MachineRegisterInfo.h.

Referenced by reg_instructions().

◆ reg_instr_nodbg_begin()

reg_instr_nodbg_iterator llvm::MachineRegisterInfo::reg_instr_nodbg_begin ( Register RegNo) const
inline

Definition at line 351 of file MachineRegisterInfo.h.

Referenced by reg_nodbg_instructions().

◆ reg_instr_nodbg_end()

reg_instr_nodbg_iterator llvm::MachineRegisterInfo::reg_instr_nodbg_end ( )
inlinestatic

Definition at line 354 of file MachineRegisterInfo.h.

Referenced by reg_nodbg_instructions().

◆ reg_instructions()

iterator_range< reg_instr_iterator > llvm::MachineRegisterInfo::reg_instructions ( Register Reg) const
inline

Definition at line 307 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, reg_instr_begin(), and reg_instr_end().

Referenced by clearVirtRegs().

◆ reg_nodbg_begin()

reg_nodbg_iterator llvm::MachineRegisterInfo::reg_nodbg_begin ( Register RegNo) const
inline

Definition at line 334 of file MachineRegisterInfo.h.

Referenced by reg_nodbg_empty(), and reg_nodbg_operands().

◆ reg_nodbg_bundles()

iterator_range< reg_bundle_nodbg_iterator > llvm::MachineRegisterInfo::reg_nodbg_bundles ( Register Reg) const
inline

◆ reg_nodbg_empty()

bool llvm::MachineRegisterInfo::reg_nodbg_empty ( Register RegNo) const
inline

reg_nodbg_empty - Return true if the only instructions using or defining Reg are Debug instructions.

Definition at line 382 of file MachineRegisterInfo.h.

References reg_nodbg_begin(), and reg_nodbg_end().

Referenced by isPhysRegUsed().

◆ reg_nodbg_end()

reg_nodbg_iterator llvm::MachineRegisterInfo::reg_nodbg_end ( )
inlinestatic

Definition at line 337 of file MachineRegisterInfo.h.

Referenced by reg_nodbg_empty(), and reg_nodbg_operands().

◆ reg_nodbg_instructions()

iterator_range< reg_instr_nodbg_iterator > llvm::MachineRegisterInfo::reg_nodbg_instructions ( Register Reg) const
inline

◆ reg_nodbg_operands()

iterator_range< reg_nodbg_iterator > llvm::MachineRegisterInfo::reg_nodbg_operands ( Register Reg) const
inline

Definition at line 342 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, reg_nodbg_begin(), and reg_nodbg_end().

Referenced by recomputeRegClass().

◆ reg_operands()

iterator_range< reg_iterator > llvm::MachineRegisterInfo::reg_operands ( Register Reg) const
inline

Definition at line 291 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, reg_begin(), and reg_end().

Referenced by replaceRegWith(), and verifyUseList().

◆ removeRegOperandFromUseList()

void MachineRegisterInfo::removeRegOperandFromUseList ( MachineOperand * MO)

Remove MO from its use-def list.

Definition at line 312 of file MachineRegisterInfo.cpp.

References assert(), llvm::MachineOperand::getReg(), and llvm::Next.

◆ replaceRegWith()

void MachineRegisterInfo::replaceRegWith ( Register FromReg,
Register ToReg )

replaceRegWith - Replace all instances of FromReg with ToReg in the machine function.

This is like llvm-level X->replaceAllUsesWith(Y), except that it also changes any definitions of the register as well.

Note that it is usually necessary to first constrain ToReg's register class and register bank to match the FromReg constraints using one of the methods:

constrainRegClass(ToReg, getRegClass(FromReg)) constrainRegAttrs(ToReg, FromReg) RegisterBankInfo::constrainGenericRegister(ToReg, *MRI.getRegClass(FromReg), MRI)

These functions will return a falsy result if the virtual registers have incompatible constraints.

Note that if ToReg is a physical register the function will replace and apply sub registers to ToReg in order to obtain a final/proper physical register.

This is like llvm-level X->replaceAllUsesWith(Y), except that it also changes any definitions of the register as well. If ToReg is a physical register we apply the sub register to obtain the final/proper physical register.

Definition at line 388 of file MachineRegisterInfo.cpp.

References assert(), getTargetRegisterInfo(), llvm::Register::isPhysical(), llvm::make_early_inc_range(), reg_operands(), and TRI.

◆ reservedRegsFrozen()

bool llvm::MachineRegisterInfo::reservedRegsFrozen ( ) const
inline

reservedRegsFrozen - Returns true after freezeReservedRegs() was called to ensure the set of reserved registers stays constant.

Definition at line 950 of file MachineRegisterInfo.h.

Referenced by canReserveReg(), getReservedRegs(), llvm::AArch64InstrInfo::probedStackAlloc(), and reserveReg().

◆ reserveReg()

void llvm::MachineRegisterInfo::reserveReg ( MCRegister PhysReg,
const TargetRegisterInfo * TRI )
inline

reserveReg – Mark a register as reserved so checks like isAllocatable will not suggest using it.

This should not be used during the middle of a function walk, or when liveness info is available.

Definition at line 939 of file MachineRegisterInfo.h.

References assert(), reservedRegsFrozen(), and TRI.

◆ resetDelegate()

void llvm::MachineRegisterInfo::resetDelegate ( Delegate * delegate)
inline

Definition at line 163 of file MachineRegisterInfo.h.

References assert().

◆ setCalleeSavedRegs()

void MachineRegisterInfo::setCalleeSavedRegs ( ArrayRef< MCPhysReg > CSRs)

Sets the updated Callee Saved Registers list.

Notice that it will override ant previously disabled/saved CSRs.

Definition at line 658 of file MachineRegisterInfo.cpp.

References llvm::append_range().

Referenced by llvm::AArch64RegisterInfo::UpdateCustomCalleeSavedRegs().

◆ setRegAllocationHint()

void llvm::MachineRegisterInfo::setRegAllocationHint ( Register VReg,
unsigned Type,
Register PrefReg )
inline

setRegAllocationHint - Specify a register allocation hint for the specified virtual register.

This is typically used by target, and in case of an earlier hint it will be overwritten.

Definition at line 805 of file MachineRegisterInfo.h.

References assert(), getNumVirtRegs(), llvm::Register::index2VirtReg(), and llvm::Register::isVirtual().

Referenced by setSimpleHint().

◆ setRegBank()

void MachineRegisterInfo::setRegBank ( Register Reg,
const RegisterBank & RegBank )

Set the register bank to RegBank for Reg.

Definition at line 63 of file MachineRegisterInfo.cpp.

◆ setRegClass()

void MachineRegisterInfo::setRegClass ( Register Reg,
const TargetRegisterClass * RC )

setRegClass - Set the register class of the specified virtual register.

Definition at line 58 of file MachineRegisterInfo.cpp.

References assert(), and llvm::TargetRegisterClass::isAllocatable().

Referenced by llvm::buildBoolRegister(), llvm::generateImageSizeQueryInst(), and recomputeRegClass().

◆ setRegClassOrRegBank()

void llvm::MachineRegisterInfo::setRegClassOrRegBank ( Register Reg,
const RegClassOrRegBank & RCOrRB )
inline

Definition at line 699 of file MachineRegisterInfo.h.

References Reg.

Referenced by constrainRegAttrs().

◆ setSimpleHint()

void llvm::MachineRegisterInfo::setSimpleHint ( Register VReg,
Register PrefReg )
inline

Specify the preferred (target independent) register allocation hint for the specified virtual register.

Definition at line 824 of file MachineRegisterInfo.h.

References setRegAllocationHint().

◆ setType()

void MachineRegisterInfo::setType ( Register VReg,
LLT Ty )

◆ shouldTrackSubRegLiveness() [1/2]

bool llvm::MachineRegisterInfo::shouldTrackSubRegLiveness ( const TargetRegisterClass & RC) const
inline

Returns true if liveness for register class RC should be tracked at the subregister level.

Definition at line 222 of file MachineRegisterInfo.h.

References llvm::TargetRegisterClass::HasDisjunctSubRegs, and subRegLivenessEnabled().

Referenced by shouldTrackSubRegLiveness().

◆ shouldTrackSubRegLiveness() [2/2]

bool llvm::MachineRegisterInfo::shouldTrackSubRegLiveness ( Register VReg) const
inline

◆ subRegLivenessEnabled()

bool llvm::MachineRegisterInfo::subRegLivenessEnabled ( ) const
inline

Definition at line 230 of file MachineRegisterInfo.h.

Referenced by shouldTrackSubRegLiveness().

◆ tracksLiveness()

bool llvm::MachineRegisterInfo::tracksLiveness ( ) const
inline

tracksLiveness - Returns true when tracking register liveness accurately.

(see MachineFUnctionProperties::Property description for details)

Definition at line 209 of file MachineRegisterInfo.h.

Referenced by findRenameRegForSameLdStRegPair(), and llvm::BranchFolder::OptimizeFunction().

◆ updateDbgUsersToReg()

void llvm::MachineRegisterInfo::updateDbgUsersToReg ( MCRegister OldReg,
MCRegister NewReg,
ArrayRef< MachineInstr * > Users ) const
inline

updateDbgUsersToReg - Update a collection of debug instructions to refer to the designated register.

Definition at line 870 of file MachineRegisterInfo.h.

References assert(), getTargetRegisterInfo(), llvm_unreachable, MI, and Users.

◆ use_begin()

use_iterator llvm::MachineRegisterInfo::use_begin ( Register RegNo) const
inline

Definition at line 467 of file MachineRegisterInfo.h.

Referenced by use_empty(), and use_operands().

◆ use_bundle_begin()

use_bundle_iterator llvm::MachineRegisterInfo::use_bundle_begin ( Register RegNo) const
inline

Definition at line 496 of file MachineRegisterInfo.h.

Referenced by use_bundles().

◆ use_bundle_end()

use_bundle_iterator llvm::MachineRegisterInfo::use_bundle_end ( )
inlinestatic

Definition at line 499 of file MachineRegisterInfo.h.

Referenced by use_bundles().

◆ use_bundle_nodbg_begin()

use_bundle_nodbg_iterator llvm::MachineRegisterInfo::use_bundle_nodbg_begin ( Register RegNo) const
inline

Definition at line 555 of file MachineRegisterInfo.h.

Referenced by use_nodbg_bundles().

◆ use_bundle_nodbg_end()

use_bundle_nodbg_iterator llvm::MachineRegisterInfo::use_bundle_nodbg_end ( )
inlinestatic

Definition at line 558 of file MachineRegisterInfo.h.

Referenced by use_nodbg_bundles().

◆ use_bundles()

iterator_range< use_bundle_iterator > llvm::MachineRegisterInfo::use_bundles ( Register Reg) const
inline

Definition at line 503 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, use_bundle_begin(), and use_bundle_end().

◆ use_empty()

bool llvm::MachineRegisterInfo::use_empty ( Register RegNo) const
inline

use_empty - Return true if there are no instructions using the specified register.

Definition at line 509 of file MachineRegisterInfo.h.

References use_begin(), and use_end().

Referenced by llvm::AArch64TargetLowering::EmitEntryPStateSM(), llvm::NVPTXFrameLowering::emitPrologue(), and GetInitialOffset().

◆ use_end()

use_iterator llvm::MachineRegisterInfo::use_end ( )
inlinestatic

Definition at line 470 of file MachineRegisterInfo.h.

Referenced by use_empty(), and use_operands().

◆ use_instr_begin()

use_instr_iterator llvm::MachineRegisterInfo::use_instr_begin ( Register RegNo) const
inline

Definition at line 480 of file MachineRegisterInfo.h.

Referenced by use_instructions().

◆ use_instr_end()

use_instr_iterator llvm::MachineRegisterInfo::use_instr_end ( )
inlinestatic

Definition at line 483 of file MachineRegisterInfo.h.

Referenced by use_instructions().

◆ use_instr_nodbg_begin()

use_instr_nodbg_iterator llvm::MachineRegisterInfo::use_instr_nodbg_begin ( Register RegNo) const
inline

Definition at line 538 of file MachineRegisterInfo.h.

Referenced by hasAtMostUserInstrs(), and use_nodbg_instructions().

◆ use_instr_nodbg_end()

use_instr_nodbg_iterator llvm::MachineRegisterInfo::use_instr_nodbg_end ( )
inlinestatic

Definition at line 541 of file MachineRegisterInfo.h.

Referenced by hasAtMostUserInstrs(), and use_nodbg_instructions().

◆ use_instructions()

iterator_range< use_instr_iterator > llvm::MachineRegisterInfo::use_instructions ( Register Reg) const
inline

◆ use_nodbg_begin()

use_nodbg_iterator llvm::MachineRegisterInfo::use_nodbg_begin ( Register RegNo) const
inline

Definition at line 521 of file MachineRegisterInfo.h.

Referenced by use_nodbg_empty(), and use_nodbg_operands().

◆ use_nodbg_bundles()

iterator_range< use_bundle_nodbg_iterator > llvm::MachineRegisterInfo::use_nodbg_bundles ( Register Reg) const
inline

◆ use_nodbg_empty()

bool llvm::MachineRegisterInfo::use_nodbg_empty ( Register RegNo) const
inline

use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register.

Definition at line 569 of file MachineRegisterInfo.h.

References use_nodbg_begin(), and use_nodbg_end().

Referenced by EmitLiveInCopies().

◆ use_nodbg_end()

use_nodbg_iterator llvm::MachineRegisterInfo::use_nodbg_end ( )
inlinestatic

Definition at line 524 of file MachineRegisterInfo.h.

Referenced by use_nodbg_empty(), and use_nodbg_operands().

◆ use_nodbg_instructions()

iterator_range< use_instr_nodbg_iterator > llvm::MachineRegisterInfo::use_nodbg_instructions ( Register Reg) const
inline

◆ use_nodbg_operands()

iterator_range< use_nodbg_iterator > llvm::MachineRegisterInfo::use_nodbg_operands ( Register Reg) const
inline

Definition at line 529 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, use_nodbg_begin(), and use_nodbg_end().

Referenced by getOneNonDBGUse(), and hasOneNonDBGUse().

◆ use_operands()

iterator_range< use_iterator > llvm::MachineRegisterInfo::use_operands ( Register Reg) const
inline

Definition at line 472 of file MachineRegisterInfo.h.

References llvm::make_range(), Reg, use_begin(), and use_end().

Referenced by clearKillFlags(), and hasOneUse().

◆ verifyUseList()

◆ verifyUseLists()

void MachineRegisterInfo::verifyUseLists ( ) const

Verify the use list of all registers.

Definition at line 263 of file MachineRegisterInfo.cpp.

References getNumVirtRegs(), getTargetRegisterInfo(), llvm::Register::index2VirtReg(), and verifyUseList().

◆ defusechain_instr_iterator

template<bool, bool, bool, bool>
friend class defusechain_instr_iterator
friend

Definition at line 281 of file MachineRegisterInfo.h.

◆ defusechain_iterator

template<bool, bool, bool, bool, bool>
friend class defusechain_iterator
friend

Definition at line 280 of file MachineRegisterInfo.h.


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