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

Synopsis

Declared in <llvm/CodeGen/MachineRegisterInfo.h>

class MachineRegisterInfo;

Types

Name

Description

Delegate

Observer notified when virtual registers are created or cloned.

PendingVirtRegMapEntry

Pending VirtRegMap entry parsed from MIR for later initialization.

VRegAttrs

All attributes(register class or bank and low‐level type) a virtual register can have.

defusechain_instr_iterator

Forward declaration of the instruction def/use‐chain iterator.

defusechain_iterator

Forward declaration of the operand def/use‐chain iterator.

Type Aliases

Name

Description

def_bundle_iterator

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

def_instr_iterator

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

def_iterator

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

livein_iterator

Iterator over live‐in physical/virtual register pairs.

reg_bundle_iterator

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

reg_bundle_nodbg_iterator

Iterator over non‐debug defs and uses of a register, stepping by bundle.

reg_instr_iterator

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

reg_instr_nodbg_iterator

Iterator over non‐debug defs and uses of a register, stepping by MachineInstr.

reg_iterator

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

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.

use_bundle_iterator

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

use_bundle_nodbg_iterator

Iterator over non‐debug uses of a register, stepping by bundle.

use_instr_iterator

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

use_instr_nodbg_iterator

Iterator over non‐debug uses of a register, stepping by MachineInstr.

use_iterator

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

use_nodbg_iterator

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

Member Functions

Name

Description

MachineRegisterInfo [constructor]

Constructors

operator= [deleted]

MachineRegisterInfo is non‐assignable.

EmitLiveInCopies

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

addDelegate

Attach delegate as an observer of virtual‐register events.

addLiveIn

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.

addPendingVirtRegMapEntry

Record a VirtRegMap entry to be applied when VirtRegMap is initialized.

addPhysRegsUsedFromRegMask

addPhysRegsUsedFromRegMask ‐ Mark any registers not in RegMask as used. This corresponds to the bit mask attached to register mask operands.

addRegAllocationHint

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

addRegOperandToUseList

Add register operand MO to its register's use/def list.

canReserveReg

canReserveReg ‐ Returns true if PhysReg can be used as a reserved register. Any register can be reserved before freezeReservedRegs() is called.

clearKillFlags

Clear kill flags on all uses of the given register.

clearPendingVirtRegMapEntries

Clear all pending VirtRegMap entries.

clearSimpleHint

Clear the target‐independent register allocation hints for VReg.

clearVirtRegTypes

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

clearVirtRegs

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

cloneVirtualRegister

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

constrainRegAttrs

Constrain register class/bank and type of Reg to match another register.

constrainRegClass

Constrain a virtual register to a common subclass with RC.

copyPendingVirtRegMapEntriesFrom

Copy pending VirtRegMap entries from another MachineRegisterInfo.

createGenericVirtualRegister

Create and return a new generic virtual register with low‐level type Ty.

createIncompleteVirtualRegister

Create a virtual register with no class, bank, or size assigned yet.

createVirtualRegister

createVirtualRegister overloads

def_begin

Return an iterator to the first defining operand of RegNo.

def_bundle_begin

Return an iterator to the first bundle that defines RegNo.

def_bundles

Return a range over all bundles that define Reg.

def_empty

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

def_instr_begin

Return an iterator to the first instruction that defines RegNo.

def_instructions

Return a range over all instructions that define Reg.

def_operands

Return a range over all defining operands of Reg.

disableCalleeSavedRegister

Disables the register from the list of CSRs. I.e. the register will not appear as part of the CSR mask.

dumpUses

Dump all uses of RegNo to the debug stream.

freezeReservedRegs

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

getCalleeSavedRegs

Returns list of callee saved registers. The function returns the updated CSR list (after taking into account registers that are disabled from the CSR list).

getDefBlock

Return the machine basic block in which the specified virtual register is defined, or null if it has no definition. This assumes SSA form.

getLiveInPhysReg

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

getLiveInVirtReg

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

getMF

Return the machine function associated with this register info.

getMaxLaneMaskForVReg

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

getNumVirtRegs

getNumVirtRegs ‐ Return the number of virtual registers created.

getOneDef

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

getOneNonDBGUse

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

getOneNonDBGUser

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

getPendingVirtRegMapEntries

Return the pending VirtRegMap entries waiting to be consumed.

getPressureSets

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

getRegAllocationHint

Return the strongest register allocation hint for a virtual register.

getRegAllocationHints

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

getRegBank

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

getRegBankOrNull

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

getRegClass

Return the register class of the specified virtual register. This shouldn't be used directly unless Reg has a register class.

getRegClassOrNull

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

getRegClassOrRegBank

Return the register bank or register class of Reg.

getReservedRegs

Return a reference to the frozen set of reserved registers.

getSimpleHint

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

getTargetRegisterInfo

Return the target register info for this machine function.

getType

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

getUniqueVRegDef

Return the unique defining instruction of a virtual register, or null.

getUsedPhysRegsMask

Return the bit vector of physical registers marked used via regmasks.

getVRegAttrs

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.

getVRegDef

Return the defining instruction of a virtual register in SSA form.

getVRegName

Return the debug name of virtual register Reg, or an empty string.

hasAtMostUserInstrs

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

hasOneDef

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

hasOneNonDBGUse

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

hasOneNonDBGUser

hasOneNonDBGUse ‐ Return true if there is exactly one non‐Debug instruction using the specified register. Said instruction may have multiple uses.

hasOneUse

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

insertVRegByName

Associate debug name Name with virtual register Reg.

invalidateLiveness

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

isAllocatable

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

isConstantPhysReg

Returns true if PhysReg is unallocatable and constant throughout the function. Writing to a constant register has no effect.

isLiveIn

Return true if Reg is a live‐in register of this function.

isPhysRegModified

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

isPhysRegUsed

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

isReserved

isReserved ‐ Returns true when PhysReg is a reserved register.

isReservedRegUnit

Returns true when the given register unit is considered reserved.

isSSA

Return true when the machine function is in SSA form.

isUpdatedCSRsInitialized

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

leaveSSA

Indicate that the machine function is no longer in SSA form.

livein_begin

Return an iterator to the beginning of the live‐in set.

livein_empty

Return true if the live‐in set is empty.

livein_end

Return an iterator to the end of the live‐in set.

liveins

Return the live‐in physical/virtual register pairs for this function.

markUsesInDebugValueAsUndef

Mark DBG_VALUE uses of a register as undefined so they are deleted later.

moveOperands

Move NumOps operands from Src to Dst, updating use/def lists.

noteCloneVirtualRegister

Notify all delegates that NewReg was cloned from SrcReg.

noteNewVirtualRegister

Notify all delegates that virtual register Reg was created.

recomputeRegClass

Recompute a legal super‐class for Reg after constraints are relaxed.

reg_begin

Return an iterator to the first def or use operand of RegNo.

reg_bundle_begin

Return an iterator to the first bundle that defs or uses RegNo.

reg_bundle_nodbg_begin

Return an iterator to the first non‐debug bundle that defs or uses RegNo.

reg_bundles

Return a range over all bundles that def or use Reg.

reg_empty

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

reg_instr_begin

Return an iterator to the first instruction that defs or uses RegNo.

reg_instr_nodbg_begin

Return an iterator to the first non‐debug instruction that defs or uses RegNo.

reg_instructions

Return a range over all instructions that def or use Reg.

reg_nodbg_begin

Return an iterator to the first non‐debug def or use operand of RegNo.

reg_nodbg_bundles

Return a range over all non‐debug bundles that def or use Reg.

reg_nodbg_empty

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

reg_nodbg_instructions

Return a range over all non‐debug instructions that def or use Reg.

reg_nodbg_operands

Return a range over all non‐debug def and use operands of Reg.

reg_operands

Return a range over all def and use operands of Reg.

removeRegOperandFromUseList

Remove register operand MO from its register's use/def list.

replaceRegWith

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

reserveReg

Mark a register as reserved so allocatable checks will reject it.

reservedRegsFrozen

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

resetDelegate

Remove delegate from the set of attached observers.

setCalleeSavedRegs

Sets the updated Callee Saved Registers list. Notice that it will override ant previously disabled/saved CSRs.

setRegAllocationHint

Specify a register allocation hint for the given virtual register.

setRegBank

Set the register bank to RegBank for Reg.

setRegClass

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

setRegClassOrRegBank

Set the register class or register bank of Reg to RCOrRB.

setSimpleHint

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

setType

Set the low‐level type of VReg to Ty.

shouldTrackSubRegLiveness

shouldTrackSubRegLiveness overloads

subRegLivenessEnabled

Return true if subregister liveness tracking is enabled for this function.

tracksLiveness

tracksLiveness ‐ Returns true when tracking register liveness accurately. (see MachineFUnctionProperties::Property description for details)

updateDbgUsersToReg

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

use_begin

Return an iterator to the first use operand of RegNo.

use_bundle_begin

Return an iterator to the first bundle that uses RegNo.

use_bundle_nodbg_begin

Return an iterator to the first non‐debug bundle that uses RegNo.

use_bundles

Return a range over all bundles that use Reg.

use_empty

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

use_instr_begin

Return an iterator to the first instruction that uses RegNo.

use_instr_nodbg_begin

Return an iterator to the first non‐debug instruction that uses RegNo.

use_instructions

Return a range over all instructions that use Reg.

use_nodbg_begin

Return an iterator to the first non‐debug use operand of RegNo.

use_nodbg_bundles

Return a range over all non‐debug bundles that use Reg.

use_nodbg_empty

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

use_nodbg_instructions

Return a range over all non‐debug instructions that use Reg.

use_nodbg_operands

Return a range over all non‐debug use operands of Reg.

use_operands

Return a range over all use operands of Reg.

verifyUseList

Verify the sanity of the use list for Reg.

verifyUseLists

Verify the use list of all registers.

Static Member Functions

Name

Description

def_bundle_end

Return the end iterator for register defining‐bundle walks.

def_end

Return the end iterator for register defining‐operand walks.

def_instr_end

Return the end iterator for register defining‐instruction walks.

reg_bundle_end

Return the end iterator for register def/use bundle walks.

reg_bundle_nodbg_end

Return the end iterator for non‐debug register def/use bundle walks.

reg_end

Return the end iterator for register def/use operand walks.

reg_instr_end

Return the end iterator for register def/use instruction walks.

reg_instr_nodbg_end

Return the end iterator for non‐debug register def/use instruction walks.

reg_nodbg_end

Return the end iterator for non‐debug register def/use operand walks.

use_bundle_end

Return the end iterator for register using‐bundle walks.

use_bundle_nodbg_end

Return the end iterator for non‐debug register using‐bundle walks.

use_end

Return the end iterator for register use‐operand walks.

use_instr_end

Return the end iterator for register using‐instruction walks.

use_instr_nodbg_end

Return the end iterator for non‐debug register using‐instruction walks.

use_nodbg_end

Return the end iterator for non‐debug register use‐operand walks.

Friends

Name

Description

llvm::MachineRegisterInfo::defusechain_instr_iterator

Forward declaration of the instruction def/use‐chain iterator.

llvm::MachineRegisterInfo::defusechain_iterator

Forward declaration of the operand def/use‐chain iterator.

Non-Member Functions

Name

Description

constrainRegToClass

Try to constrain Reg to the specified register class.

matchUnaryPredicate

Match a unary predicate against a scalar/splat constant or build vector.

salvageDebugInfo

Assuming the instruction MI is going to be deleted, attempt to salvage debug users of MI by writing the effect of MI in a DIExpression.

salvageDebugInfoForDbgValue

Assuming the instruction MI is going to be deleted, attempt to salvage debug users of MI by writing the effect of MI in a DIExpression.

Created with MrDocs