LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::MachineInstr Class Reference

#include <MachineInstr.h>

Collaboration diagram for llvm::MachineInstr:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ValOpIterator< const
MachineInstr *, const Value * > 
const_val_op_iterator
typedef ValOpIterator< MachineInstr *,
Value * > 
val_op_iterator

Public Member Functions

 MachineInstr (short Opcode, unsigned numOperands)
 MachineInstr (short Opcode, unsigned numOperands, bool XX, bool YY)
 MachineInstr (MachineBasicBlock *MBB, short Opcode, unsigned numOps)
 ~MachineInstr ()
const MachineBasicBlockgetParent () const
MachineBasicBlockgetParent ()
const int getOpcode () const
unsigned getNumOperands () const
const MachineOperandgetOperand (unsigned i) const
MachineOperandgetOperand (unsigned i)
const MachineOperandgetExplOrImplOperand (unsigned i) const
unsigned getNumImplicitRefs () const
MachineOperandgetImplicitOp (unsigned i)
const MachineOperandgetImplicitOp (unsigned i) const
ValuegetImplicitRef (unsigned i)
const ValuegetImplicitRef (unsigned i) const
void addImplicitRef (Value *V, bool isDef=false, bool isDefAndUse=false)
void setImplicitRef (unsigned i, Value *V)
MachineInstrclone () const
void print (std::ostream &OS, const TargetMachine *TM) const
void dump () const
void addRegOperand (Value *V, bool isDef, bool isDefAndUse=false)
void addRegOperand (Value *V, MachineOperand::UseType UTy=MachineOperand::Use, bool isPCRelative=false)
void addCCRegOperand (Value *V, MachineOperand::UseType UTy=MachineOperand::Use)
void addRegOperand (int reg, bool isDef)
void addRegOperand (int reg, MachineOperand::UseType UTy=MachineOperand::Use)
void addPCDispOperand (Value *V)
void addMachineRegOperand (int reg, bool isDef)
void addMachineRegOperand (int reg, MachineOperand::UseType UTy=MachineOperand::Use)
void addZeroExtImmOperand (int intValue)
void addSignExtImmOperand (int intValue)
void addMachineBasicBlockOperand (MachineBasicBlock *MBB)
void addFrameIndexOperand (unsigned Idx)
void addConstantPoolIndexOperand (unsigned I)
void addGlobalAddressOperand (GlobalValue *GV, bool isPCRelative, int Offset)
void addExternalSymbolOperand (const char *SymName, bool isPCRelative)
void replace (short Opcode, unsigned numOperands)
void setOpcode (unsigned Op)
void RemoveOperand (unsigned i)
void SetMachineOperandVal (unsigned i, MachineOperand::MachineOperandType operandType, Value *V)
void SetMachineOperandConst (unsigned i, MachineOperand::MachineOperandType operandType, int intValue)
void SetMachineOperandReg (unsigned i, int regNum)
unsigned substituteValue (const Value *oldVal, Value *newVal, bool defsOnly, bool notDefsAndUses, bool &someArgsWereIgnored)
void SetRegForOperand (unsigned i, int regNum)
void SetRegForImplicitRef (unsigned i, int regNum)
val_op_iterator begin ()
val_op_iterator end ()
const_val_op_iterator begin () const
const_val_op_iterator end () const

Friends

struct ilist_traits< MachineInstr >
std::ostream & operator<< (std::ostream &os, const MachineInstr &minstr)

Classes

class  ValOpIterator

Detailed Description

Definition at line 393 of file MachineInstr.h.


Member Typedef Documentation

typedef ValOpIterator<const MachineInstr*,const Value*> llvm::MachineInstr::const_val_op_iterator
 

Definition at line 509 of file MachineInstr.h.

typedef ValOpIterator< MachineInstr*, Value*> llvm::MachineInstr::val_op_iterator
 

Definition at line 511 of file MachineInstr.h.


Constructor & Destructor Documentation

MachineInstr::MachineInstr short  Opcode,
unsigned  numOperands
 

Definition at line 40 of file MachineInstr.cpp.

References llvm::LeakDetector::addGarbageObject().

MachineInstr::MachineInstr short  Opcode,
unsigned  numOperands,
bool  XX,
bool  YY
 

MachineInstr ctor - This constructor only does a _reserve_ of the operands, not a resize for them. It is expected that if you use this that you call add* methods below to fill up the operands, instead of the Set methods. Eventually, the "resizing" ctors will be phased out.

Definition at line 54 of file MachineInstr.cpp.

References llvm::LeakDetector::addGarbageObject().

MachineInstr::MachineInstr MachineBasicBlock MBB,
short  Opcode,
unsigned  numOps
 

MachineInstr ctor - Work exactly the same as the ctor above, except that the MachineInstr is created and added to the end of the specified basic block.

Definition at line 64 of file MachineInstr.cpp.

References llvm::LeakDetector::addGarbageObject(), and llvm::MachineBasicBlock::push_back().

MachineInstr::~MachineInstr  ) 
 

Definition at line 92 of file MachineInstr.cpp.

References llvm::LeakDetector::removeGarbageObject().


Member Function Documentation

void llvm::MachineInstr::addCCRegOperand Value V,
MachineOperand::UseType  UTy = MachineOperand::Use
[inline]
 

Definition at line 540 of file MachineInstr.h.

References llvm::MachineOperand::MO_CCRegister.

void llvm::MachineInstr::addConstantPoolIndexOperand unsigned  I  )  [inline]
 

addConstantPoolndexOperand - Add a constant pool object index to the instruction.

Definition at line 635 of file MachineInstr.h.

References llvm::MachineOperand::MO_ConstantPoolIndex.

void llvm::MachineInstr::addExternalSymbolOperand const char *  SymName,
bool  isPCRelative
[inline]
 

addExternalSymbolOperand - Add an external symbol operand to this instr

Definition at line 651 of file MachineInstr.h.

void llvm::MachineInstr::addFrameIndexOperand unsigned  Idx  )  [inline]
 

addFrameIndexOperand - Add an abstract frame index to the instruction

Definition at line 626 of file MachineInstr.h.

References llvm::MachineOperand::MO_FrameIndex.

void llvm::MachineInstr::addGlobalAddressOperand GlobalValue GV,
bool  isPCRelative,
int  Offset
[inline]
 

Definition at line 641 of file MachineInstr.h.

References llvm::MachineOperand::MO_GlobalAddress, and llvm::MachineOperand::Use.

void llvm::MachineInstr::addImplicitRef Value V,
bool  isDef = false,
bool  isDefAndUse = false
[inline]
 

Definition at line 483 of file MachineInstr.h.

References addRegOperand().

void llvm::MachineInstr::addMachineBasicBlockOperand MachineBasicBlock MBB  )  [inline]
 

Definition at line 618 of file MachineInstr.h.

void llvm::MachineInstr::addMachineRegOperand int  reg,
MachineOperand::UseType  UTy = MachineOperand::Use
[inline]
 

addMachineRegOperand - Add a virtual register operand to this MachineInstr

Definition at line 590 of file MachineInstr.h.

References llvm::MachineOperand::MO_MachineRegister.

void llvm::MachineInstr::addMachineRegOperand int  reg,
bool  isDef
[inline]
 

addMachineRegOperand - Add a virtual register operand to this MachineInstr

Definition at line 580 of file MachineInstr.h.

References llvm::MachineOperand::Def, llvm::MachineOperand::MO_MachineRegister, and llvm::MachineOperand::Use.

void llvm::MachineInstr::addPCDispOperand Value V  )  [inline]
 

addPCDispOperand - Add a PC relative displacement operand to the MI

Definition at line 571 of file MachineInstr.h.

References llvm::MachineOperand::MO_PCRelativeDisp, and llvm::MachineOperand::Use.

void llvm::MachineInstr::addRegOperand int  reg,
MachineOperand::UseType  UTy = MachineOperand::Use
[inline]
 

addRegOperand - Add a symbolic virtual register reference...

Definition at line 561 of file MachineInstr.h.

References llvm::MachineOperand::MO_VirtualRegister.

void llvm::MachineInstr::addRegOperand int  reg,
bool  isDef
[inline]
 

addRegOperand - Add a symbolic virtual register reference...

Definition at line 551 of file MachineInstr.h.

References llvm::MachineOperand::Def, llvm::MachineOperand::MO_VirtualRegister, and llvm::MachineOperand::Use.

void llvm::MachineInstr::addRegOperand Value V,
MachineOperand::UseType  UTy = MachineOperand::Use,
bool  isPCRelative = false
[inline]
 

Definition at line 531 of file MachineInstr.h.

References llvm::MachineOperand::MO_VirtualRegister.

void llvm::MachineInstr::addRegOperand Value V,
bool  isDef,
bool  isDefAndUse = false
[inline]
 

addRegOperand - Add a MO_VirtualRegister operand to the end of the operands list...

Definition at line 521 of file MachineInstr.h.

References llvm::MachineOperand::Def, llvm::MachineOperand::MO_VirtualRegister, llvm::MachineOperand::Use, and llvm::MachineOperand::UseAndDef.

Referenced by addImplicitRef(), and llvm::MachineInstrBuilder::addReg().

void llvm::MachineInstr::addSignExtImmOperand int  intValue  )  [inline]
 

addSignExtImmOperand - Add a zero extended constant argument to the machine instruction.

Definition at line 611 of file MachineInstr.h.

References llvm::MachineOperand::MO_SignExtendedImmed.

void llvm::MachineInstr::addZeroExtImmOperand int  intValue  )  [inline]
 

addZeroExtImmOperand - Add a zero extended constant argument to the machine instruction.

Definition at line 601 of file MachineInstr.h.

References llvm::MachineOperand::MO_UnextendedImmed.

const_val_op_iterator llvm::MachineInstr::begin  )  const [inline]
 

Definition at line 758 of file MachineInstr.h.

References llvm::MachineInstr::ValOpIterator< MITy, VTy >::begin().

val_op_iterator llvm::MachineInstr::begin  )  [inline]
 

Definition at line 755 of file MachineInstr.h.

References llvm::MachineInstr::ValOpIterator< MITy, VTy >::begin().

Referenced by llvm::applyTranferFuncForMInst(), llvm::LiveRangeInfo::coalesceLRs(), llvm::LiveRangeInfo::constructLiveRanges(), and substituteValue().

MachineInstr * MachineInstr::clone  )  const
 

clone - Create a copy of 'this' instruction that is identical in all ways except the the instruction has no parent, prev, or next.

Definition at line 99 of file MachineInstr.cpp.

void MachineInstr::dump  )  const
 

Definition at line 212 of file MachineInstr.cpp.

Referenced by llvm::LiveRangeInfo::coalesceLRs().

const_val_op_iterator llvm::MachineInstr::end  )  const [inline]
 

Definition at line 761 of file MachineInstr.h.

References llvm::MachineInstr::ValOpIterator< MITy, VTy >::end().

val_op_iterator llvm::MachineInstr::end  )  [inline]
 

Definition at line 756 of file MachineInstr.h.

References llvm::MachineInstr::ValOpIterator< MITy, VTy >::end().

Referenced by llvm::applyTranferFuncForMInst(), llvm::LiveRangeInfo::coalesceLRs(), llvm::LiveRangeInfo::constructLiveRanges(), and substituteValue().

const MachineOperand& llvm::MachineInstr::getExplOrImplOperand unsigned  i  )  const [inline]
 

Definition at line 456 of file MachineInstr.h.

References getImplicitOp(), getNumOperands(), and getOperand().

const MachineOperand& llvm::MachineInstr::getImplicitOp unsigned  i  )  const [inline]
 

Definition at line 471 of file MachineInstr.h.

MachineOperand& llvm::MachineInstr::getImplicitOp unsigned  i  )  [inline]
 

Definition at line 467 of file MachineInstr.h.

Referenced by llvm::applyTranferFuncForMInst(), llvm::LiveRangeInfo::constructLiveRanges(), getExplOrImplOperand(), getImplicitRef(), llvm::operator<<(), print(), SetRegForImplicitRef(), and substituteValue().

const Value* llvm::MachineInstr::getImplicitRef unsigned  i  )  const [inline]
 

Definition at line 479 of file MachineInstr.h.

References getImplicitOp(), and llvm::MachineOperand::getVRegValue().

Value* llvm::MachineInstr::getImplicitRef unsigned  i  )  [inline]
 

Definition at line 476 of file MachineInstr.h.

References getImplicitOp(), and llvm::MachineOperand::getVRegValue().

Referenced by llvm::applyTranferFuncForMInst(), llvm::LiveRangeInfo::constructLiveRanges(), llvm::CallArgsDescriptor::get(), llvm::operator<<(), print(), and substituteValue().

unsigned llvm::MachineInstr::getNumImplicitRefs  )  const [inline]
 

Definition at line 465 of file MachineInstr.h.

Referenced by llvm::applyTranferFuncForMInst(), llvm::CallArgsDescriptor::get(), llvm::operator<<(), print(), replace(), setImplicitRef(), and substituteValue().

unsigned llvm::MachineInstr::getNumOperands  )  const [inline]
 

Access to explicit operands of the instruction.

Definition at line 439 of file MachineInstr.h.

Referenced by llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::PPC64RegisterInfo::eliminateFrameIndex(), llvm::PPC32RegisterInfo::eliminateFrameIndex(), getExplOrImplOperand(), getOperand(), llvm::LiveVariables::instructionChanged(), isMem(), llvm::X86InstrInfo::isMoveInstr(), llvm::PPC64InstrInfo::isMoveInstr(), llvm::PPC32InstrInfo::isMoveInstr(), llvm::operator<<(), print(), llvm::SparcV9CodeEmitter::runOnMachineFunction(), llvm::LiveVariables::runOnMachineFunction(), setImplicitRef(), SetMachineOperandConst(), SetMachineOperandReg(), and SetRegForOperand().

const int llvm::MachineInstr::getOpcode  )  const [inline]
 

getOpcode - Returns the opcode of this MachineInstr.

Definition at line 435 of file MachineInstr.h.

Referenced by llvm::LiveRangeInfo::constructLiveRanges(), llvm::X86RegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPC64RegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPC32RegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPC64RegisterInfo::eliminateFrameIndex(), llvm::PPC32RegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::foldMemoryOperand(), llvm::SchedPriorities::getNextHighest(), llvm::SchedGraphNode::getOpcode(), llvm::X86InstrInfo::isMoveInstr(), llvm::PPC64InstrInfo::isMoveInstr(), llvm::PPC32InstrInfo::isMoveInstr(), llvm::IsUselessCopy(), llvm::operator<<(), print(), llvm::ReplaceNopsWithUsefulInstr(), llvm::LiveVariables::runOnMachineFunction(), llvm::SparcV9RegInfo::suggestReg4RetValue(), and llvm::SparcV9RegInfo::suggestRegs4CallArgs().

MachineOperand& llvm::MachineInstr::getOperand unsigned  i  )  [inline]
 

Definition at line 445 of file MachineInstr.h.

References getNumOperands().

const MachineOperand& llvm::MachineInstr::getOperand unsigned  i  )  const [inline]
 

Definition at line 441 of file MachineInstr.h.

References getNumOperands().

Referenced by llvm::SparcV9RegInfo::cpMem2RegMI(), llvm::SparcV9RegInfo::cpReg2MemMI(), llvm::X86RegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPC64RegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPC32RegisterInfo::eliminateCallFramePseudoInstr(), llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::PPC64RegisterInfo::eliminateFrameIndex(), llvm::PPC32RegisterInfo::eliminateFrameIndex(), llvm::CallArgsDescriptor::get(), getExplOrImplOperand(), llvm::LiveVariables::instructionChanged(), isMem(), llvm::X86InstrInfo::isMoveInstr(), llvm::PPC64InstrInfo::isMoveInstr(), llvm::PPC32InstrInfo::isMoveInstr(), llvm::IsUselessCopy(), llvm::isVarArgsCall(), MakeMIInst(), MakeMRIInst(), MakeMRInst(), MakeRMIInst(), MakeRMInst(), llvm::operator<<(), print(), llvm::SparcV9CodeEmitter::runOnMachineFunction(), llvm::LiveVariables::runOnMachineFunction(), llvm::SparcV9RegInfo::suggestReg4RetValue(), and llvm::VirtRegMap::virtFolded().

MachineBasicBlock* llvm::MachineInstr::getParent  )  [inline]
 

Definition at line 431 of file MachineInstr.h.

const MachineBasicBlock* llvm::MachineInstr::getParent  )  const [inline]
 

Definition at line 430 of file MachineInstr.h.

Referenced by llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::PPC64RegisterInfo::eliminateFrameIndex(), llvm::PPC32RegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::foldMemoryOperand(), llvm::LiveVariables::HandleVirtRegUse(), llvm::LiveVariables::MarkVirtRegAliveInBlock(), and llvm::operator<<().

void MachineInstr::print std::ostream &  OS,
const TargetMachine TM
const
 

Definition at line 322 of file MachineInstr.cpp.

References getImplicitOp(), getImplicitRef(), llvm::TargetMachine::getInstrInfo(), llvm::TargetInstrInfo::getName(), getNumImplicitRefs(), getNumOperands(), getOpcode(), getOperand(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isUse(), and OutputValue().

Referenced by llvm::operator<<().

void llvm::MachineInstr::RemoveOperand unsigned  i  )  [inline]
 

RemoveOperand - Erase an operand from an instruction, leaving it with one fewer operand than it started with.

Definition at line 673 of file MachineInstr.h.

void MachineInstr::replace short  Opcode,
unsigned  numOperands
 

replace - Support to rewrite a machine instruction in place: for now, simply replace() and then set new operands with Set.*Operand methods below.

Definition at line 116 of file MachineInstr.cpp.

References getNumImplicitRefs().

void llvm::MachineInstr::setImplicitRef unsigned  i,
Value V
[inline]
 

Definition at line 487 of file MachineInstr.h.

References getNumImplicitRefs(), getNumOperands(), llvm::MachineOperand::MO_VirtualRegister, and SetMachineOperandVal().

void MachineInstr::SetMachineOperandConst unsigned  i,
MachineOperand::MachineOperandType  operandType,
int  intValue
 

Definition at line 134 of file MachineInstr.cpp.

References getNumOperands(), and llvm::TargetInstrDescriptors.

Referenced by llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::PPC64RegisterInfo::eliminateFrameIndex(), llvm::PPC32RegisterInfo::eliminateFrameIndex(), and llvm::SparcV9CodeEmitter::runOnMachineFunction().

void MachineInstr::SetMachineOperandReg unsigned  i,
int  regNum
 

Definition at line 148 of file MachineInstr.cpp.

References getNumOperands(), and llvm::MachineOperand::MO_MachineRegister.

Referenced by llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::PPC64RegisterInfo::eliminateFrameIndex(), and llvm::PPC32RegisterInfo::eliminateFrameIndex().

void MachineInstr::SetMachineOperandVal unsigned  i,
MachineOperand::MachineOperandType  operandType,
Value V
 

Definition at line 124 of file MachineInstr.cpp.

Referenced by setImplicitRef().

void llvm::MachineInstr::setOpcode unsigned  Op  )  [inline]
 

setOpcode - Replace the opcode of the current instruction with a new one.

Definition at line 668 of file MachineInstr.h.

Referenced by llvm::PPC64RegisterInfo::eliminateFrameIndex(), and llvm::PPC32RegisterInfo::eliminateFrameIndex().

void MachineInstr::SetRegForImplicitRef unsigned  i,
int  regNum
 

Definition at line 163 of file MachineInstr.cpp.

References getImplicitOp(), and llvm::MachineOperand::setRegForValue().

void MachineInstr::SetRegForOperand unsigned  i,
int  regNum
 

Definition at line 157 of file MachineInstr.cpp.

References getNumOperands().

unsigned MachineInstr::substituteValue const Value oldVal,
Value newVal,
bool  defsOnly,
bool  notDefsAndUses,
bool &  someArgsWereIgnored
 

substituteValue - Substitute all occurrences of Value* oldVal with newVal in all operands and all implicit refs. If defsOnly == true, substitute defs only.

FIXME: Fold this into its single caller, at SparcInstrSelection.cpp:2865, or make it a static function in that file.

Definition at line 175 of file MachineInstr.cpp.

References begin(), llvm::MachineOperand::contents, E, end(), getImplicitOp(), getImplicitRef(), getNumImplicitRefs(), llvm::MachineOperand::isDef(), and llvm::MachineOperand::isUse().


Friends And Related Function Documentation

friend struct ilist_traits< MachineInstr > [friend]
 

Definition at line 410 of file MachineInstr.h.

std::ostream& operator<< std::ostream &  os,
const MachineInstr minstr
[friend]
 


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