LLVM API Documentation

llvm::TargetInstrInfoImpl Class Reference

#include <TargetInstrInfo.h>

Inheritance diagram for llvm::TargetInstrInfoImpl:
[legend]
Collaboration diagram for llvm::TargetInstrInfoImpl:
[legend]

List of all members.

Public Member Functions

virtual MachineInstr * commuteInstruction (MachineInstr *MI, bool NewMI=false) const
virtual bool findCommutedOpIndices (MachineInstr *MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const
virtual bool PredicateInstruction (MachineInstr *MI, const SmallVectorImpl< MachineOperand > &Pred) const
virtual void reMaterialize (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SubReg, const MachineInstr *Orig) const
virtual bool isDeadInstruction (const MachineInstr *MI) const
virtual unsigned GetFunctionSizeInBytes (const MachineFunction &MF) const

Protected Member Functions

 TargetInstrInfoImpl (const TargetInstrDesc *desc, unsigned NumOpcodes)


Detailed Description

TargetInstrInfoImpl - This is the default implementation of TargetInstrInfo, which just provides a couple of default implementations for various methods. This separated out because it is implemented in libcodegen, not in libtarget.

Definition at line 474 of file TargetInstrInfo.h.


Constructor & Destructor Documentation

llvm::TargetInstrInfoImpl::TargetInstrInfoImpl ( const TargetInstrDesc *  desc,
unsigned  NumOpcodes 
) [inline, protected]

Definition at line 476 of file TargetInstrInfo.h.


Member Function Documentation

MachineInstr * TargetInstrInfoImpl::commuteInstruction ( MachineInstr *  MI,
bool  NewMI = false 
) const [virtual]

commuteInstruction - If a target has any instructions that are commutable, but require converting to a different instruction or making non-trivial changes to commute them, this method can overloaded to do this. The default implementation of this method simply swaps the first two operands of MI and returns it.

If a target wants to make more aggressive changes, they can construct and return a new machine instruction. If an instruction cannot commute, it can also return null.

If NewMI is true, then a new machine instruction must be created.

Implements llvm::TargetInstrInfo.

Reimplemented in llvm::PPCInstrInfo, and llvm::X86InstrInfo.

Definition at line 27 of file TargetInstrInfoImpl.cpp.

References llvm::BuildMI(), llvm::RegState::Define, findCommutedOpIndices(), llvm::getDeadRegState(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDesc(), llvm::getKillRegState(), llvm::TargetInstrDesc::getNumDefs(), llvm::MachineInstr::getOperand(), llvm::TargetInstrDesc::getOperandConstraint(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), HasDef, llvm::MachineOperand::isDead(), llvm::MachineOperand::isKill(), llvm::MachineOperand::isReg(), llvm::llvm_report_error(), MF, llvm::MachineOperand::setIsKill(), llvm::MachineOperand::setReg(), llvm::raw_string_ostream::str(), and llvm::TOI::TIED_TO.

Referenced by llvm::PPCInstrInfo::commuteInstruction(), and llvm::X86InstrInfo::commuteInstruction().

bool TargetInstrInfoImpl::findCommutedOpIndices ( MachineInstr *  MI,
unsigned &  SrcOpIdx1,
unsigned &  SrcOpIdx2 
) const [virtual]

findCommutedOpIndices - If specified MI is commutable, return the two operand indices that would swap value. Return true if the instruction is not in a form which this routine understands.

Implements llvm::TargetInstrInfo.

Definition at line 86 of file TargetInstrInfoImpl.cpp.

References llvm::MachineInstr::getDesc(), llvm::TargetInstrDesc::getNumDefs(), llvm::MachineInstr::getOperand(), llvm::TargetInstrDesc::isCommutable(), and llvm::MachineOperand::isReg().

Referenced by commuteInstruction().

bool TargetInstrInfoImpl::PredicateInstruction ( MachineInstr *  MI,
const SmallVectorImpl< MachineOperand > &  Pred 
) const [virtual]

void TargetInstrInfoImpl::reMaterialize ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
unsigned  SubIdx,
const MachineInstr *  Orig 
) const [virtual]

reMaterialize - Re-issue the specified 'original' instruction at the specific location targeting a new destination register.

Implements llvm::TargetInstrInfo.

Reimplemented in llvm::ARMInstrInfo, and llvm::X86InstrInfo.

Definition at line 130 of file TargetInstrInfoImpl.cpp.

References llvm::MachineFunction::CloneMachineInstr(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineBasicBlock::insert(), MI, llvm::MachineOperand::setReg(), and llvm::MachineOperand::setSubReg().

bool TargetInstrInfoImpl::isDeadInstruction ( const MachineInstr *  MI  )  const [virtual]

unsigned TargetInstrInfoImpl::GetFunctionSizeInBytes ( const MachineFunction &  MF  )  const [virtual]


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