LLVM  8.0.1
Classes | Public Member Functions | Protected Member Functions | List of all members
llvm::MachineOperandIteratorBase Class Reference

MachineOperandIteratorBase - Iterator that can visit all operands on a MachineInstr, or all operands on a bundle of MachineInstrs. More...

#include "llvm/CodeGen/MachineInstrBundle.h"

Inheritance diagram for llvm::MachineOperandIteratorBase:
Inheritance graph
[legend]

Classes

struct  PhysRegInfo
 Information about how a physical register Reg is used by a set of operands. More...
 
struct  VirtRegInfo
 VirtRegInfo - Information about a virtual register used by a set of operands. More...
 

Public Member Functions

bool isValid () const
 isValid - Returns true until all the operands have been visited. More...
 
void operator++ ()
 Preincrement. Move to the next operand. More...
 
unsigned getOperandNo () const
 getOperandNo - Returns the number of the current operand relative to its instruction. More...
 
VirtRegInfo analyzeVirtReg (unsigned Reg, SmallVectorImpl< std::pair< MachineInstr *, unsigned > > *Ops=nullptr)
 analyzeVirtReg - Analyze how the current instruction or bundle uses a virtual register. More...
 
PhysRegInfo analyzePhysReg (unsigned Reg, const TargetRegisterInfo *TRI)
 analyzePhysReg - Analyze how the current instruction or bundle uses a physical register. More...
 

Protected Member Functions

 MachineOperandIteratorBase (MachineInstr &MI, bool WholeBundle)
 MachineOperandIteratorBase - Create an iterator that visits all operands on MI, or all operands on every instruction in the bundle containing MI. More...
 
MachineOperandderef () const
 

Detailed Description

MachineOperandIteratorBase - Iterator that can visit all operands on a MachineInstr, or all operands on a bundle of MachineInstrs.

This class is not intended to be used directly, use one of the sub-classes instead.

Intended use:

for (MIBundleOperands MIO(MI); MIO.isValid(); ++MIO) { if (!MIO->isReg()) continue; ... }

Definition at line 92 of file MachineInstrBundle.h.

Constructor & Destructor Documentation

◆ MachineOperandIteratorBase()

llvm::MachineOperandIteratorBase::MachineOperandIteratorBase ( MachineInstr MI,
bool  WholeBundle 
)
inlineexplicitprotected

MachineOperandIteratorBase - Create an iterator that visits all operands on MI, or all operands on every instruction in the bundle containing MI.

Parameters
MIThe instruction to examine.
WholeBundleWhen true, visit all operands on the entire bundle.

Definition at line 115 of file MachineInstrBundle.h.

References llvm::getBundleStart(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getParent(), and llvm::MachineBasicBlock::instr_end().

Member Function Documentation

◆ analyzePhysReg()

MachineOperandIteratorBase::PhysRegInfo MachineOperandIteratorBase::analyzePhysReg ( unsigned  Reg,
const TargetRegisterInfo TRI 
)

◆ analyzeVirtReg()

MachineOperandIteratorBase::VirtRegInfo MachineOperandIteratorBase::analyzeVirtReg ( unsigned  Reg,
SmallVectorImpl< std::pair< MachineInstr *, unsigned > > *  Ops = nullptr 
)

analyzeVirtReg - Analyze how the current instruction or bundle uses a virtual register.

This function should not be called after operator++(), it expects a fresh iterator.

Parameters
RegThe virtual register to analyze.
OpsWhen set, this vector will receive an (MI, OpNum) entry for each operand referring to Reg.
Returns
A filled-in RegInfo struct.

Definition at line 286 of file MachineInstrBundle.cpp.

References llvm::MachineOperand::getParent(), llvm::MachineOperand::getReg(), if(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), llvm::MachineInstr::isRegTiedToDefOperand(), llvm::MachineOperandIteratorBase::VirtRegInfo::Reads, llvm::MachineOperand::readsReg(), Reg, llvm::MachineOperandIteratorBase::VirtRegInfo::Tied, and llvm::MachineOperandIteratorBase::VirtRegInfo::Writes.

Referenced by isFullCopyOf(), and isFullUndefDef().

◆ deref()

MachineOperand& llvm::MachineOperandIteratorBase::deref ( ) const
inlineprotected

◆ getOperandNo()

unsigned llvm::MachineOperandIteratorBase::getOperandNo ( ) const
inline

getOperandNo - Returns the number of the current operand relative to its instruction.

Definition at line 145 of file MachineInstrBundle.h.

◆ isValid()

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

◆ operator++()

void llvm::MachineOperandIteratorBase::operator++ ( )
inline

Preincrement. Move to the next operand.

Definition at line 136 of file MachineInstrBundle.h.

References assert(), and isValid().


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