LLVM API Documentation

llvm::MipsInstrInfo Class Reference

#include <MipsInstrInfo.h>

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

List of all members.

Public Member Functions

 MipsInstrInfo (MipsTargetMachine &TM)
virtual const MipsRegisterInfo & getRegisterInfo () const
virtual bool isMoveInstr (const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg, unsigned &SrcSubIdx, unsigned &DstSubIdx) const
virtual unsigned isLoadFromStackSlot (const MachineInstr *MI, int &FrameIndex) const
virtual unsigned isStoreToStackSlot (const MachineInstr *MI, int &FrameIndex) const
virtual bool AnalyzeBranch (MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const
 Branch Analysis.
virtual unsigned RemoveBranch (MachineBasicBlock &MBB) const
virtual unsigned InsertBranch (MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const SmallVectorImpl< MachineOperand > &Cond) const
virtual bool copyRegToReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, unsigned SrcReg, const TargetRegisterClass *DestRC, const TargetRegisterClass *SrcRC) const
virtual void storeRegToStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC) const
virtual void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC) const
virtual MachineInstr * foldMemoryOperandImpl (MachineFunction &MF, MachineInstr *MI, const SmallVectorImpl< unsigned > &Ops, int FrameIndex) const
virtual MachineInstr * foldMemoryOperandImpl (MachineFunction &MF, MachineInstr *MI, const SmallVectorImpl< unsigned > &Ops, MachineInstr *LoadMI) const
virtual bool BlockHasNoFallThrough (const MachineBasicBlock &MBB) const
virtual bool ReverseBranchCondition (SmallVectorImpl< MachineOperand > &Cond) const
virtual void insertNoop (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const
 Insert nop instruction when hazard condition is found.
unsigned getGlobalBaseReg (MachineFunction *MF) const


Detailed Description

Definition at line 133 of file MipsInstrInfo.h.


Constructor & Destructor Documentation

MipsInstrInfo::MipsInstrInfo ( MipsTargetMachine &  TM  )  [explicit]

Definition at line 25 of file MipsInstrInfo.cpp.


Member Function Documentation

virtual const MipsRegisterInfo& llvm::MipsInstrInfo::getRegisterInfo (  )  const [inline, virtual]

getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As such, whenever a client has an instance of instruction info, it should always be able to get register info as well (through this method).

Definition at line 143 of file MipsInstrInfo.h.

Referenced by llvm::MipsTargetMachine::getRegisterInfo().

bool MipsInstrInfo::isMoveInstr ( const MachineInstr &  MI,
unsigned &  SrcReg,
unsigned &  DstReg,
unsigned &  SrcSubIdx,
unsigned &  DstSubIdx 
) const [virtual]

Return true if the instruction is a register to register move and return the source and dest operands and their sub-register indices by reference.

Return true if the instruction is a register to register move and leave the source and dest operands in the passed parameters.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 36 of file MipsInstrInfo.cpp.

References llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), isZeroImm(), and llvm::ISD::OR.

unsigned MipsInstrInfo::isLoadFromStackSlot ( const MachineInstr *  MI,
int &  FrameIndex 
) const [virtual]

isLoadFromStackSlot - If the specified machine instruction is a direct load from a stack slot, return the virtual or physical register number of the destination along with the FrameIndex of the loaded stack slot. If not, return 0. This predicate must return 0 if the instruction has any side effects other than loading from the stack slot.

isLoadFromStackSlot - If the specified machine instruction is a direct load from a stack slot, return the virtual or physical register number of the destination along with the FrameIndex of the loaded stack slot. If not, return 0. This predicate must return 0 if the instruction has any side effects other than loading from the stack slot.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 86 of file MipsInstrInfo.cpp.

References llvm::MachineOperand::getIndex(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isFI(), llvm::MachineOperand::isImm(), and isZeroImm().

unsigned MipsInstrInfo::isStoreToStackSlot ( const MachineInstr *  MI,
int &  FrameIndex 
) const [virtual]

isStoreToStackSlot - If the specified machine instruction is a direct store to a stack slot, return the virtual or physical register number of the source reg along with the FrameIndex of the loaded stack slot. If not, return 0. This predicate must return 0 if the instruction has any side effects other than storing to the stack slot.

isStoreToStackSlot - If the specified machine instruction is a direct store to a stack slot, return the virtual or physical register number of the source reg along with the FrameIndex of the loaded stack slot. If not, return 0. This predicate must return 0 if the instruction has any side effects other than storing to the stack slot.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 107 of file MipsInstrInfo.cpp.

References llvm::MachineOperand::getIndex(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isFI(), llvm::MachineOperand::isImm(), and isZeroImm().

bool MipsInstrInfo::AnalyzeBranch ( MachineBasicBlock &  MBB,
MachineBasicBlock *&  TBB,
MachineBasicBlock *&  FBB,
SmallVectorImpl< MachineOperand > &  Cond,
bool  AllowModify 
) const [virtual]

unsigned MipsInstrInfo::RemoveBranch ( MachineBasicBlock &  MBB  )  const [virtual]

RemoveBranch - Remove the branching code at the end of the specific MBB. This is only invoked in cases where AnalyzeBranch returns success. It returns the number of instructions that were removed.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 538 of file MipsInstrInfo.cpp.

References llvm::MachineBasicBlock::begin(), llvm::Mips::COND_INVALID, llvm::MachineBasicBlock::end(), and GetCondFromBranchOpc().

unsigned MipsInstrInfo::InsertBranch ( MachineBasicBlock &  MBB,
MachineBasicBlock *  TBB,
MachineBasicBlock *  FBB,
const SmallVectorImpl< MachineOperand > &  Cond 
) const [virtual]

InsertBranch - Insert branch code into the end of the specified MachineBasicBlock. The operands to this method are the same as those returned by AnalyzeBranch. This is only invoked in cases where AnalyzeBranch returns success. It returns the number of instructions inserted.

It is also invoked by tail merging to add unconditional branches in cases where AnalyzeBranch doesn't apply because there was no original branch to analyze. At least this much must be implemented, else tail merging needs to be disabled.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 492 of file MipsInstrInfo.cpp.

References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::SmallVectorImpl< T >::empty(), GetCondBranchFromCond(), llvm::TargetInstrDesc::getNumOperands(), llvm::DebugLoc::getUnknownLoc(), and llvm::SmallVectorImpl< T >::size().

bool MipsInstrInfo::copyRegToReg ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
unsigned  SrcReg,
const TargetRegisterClass *  DestRC,
const TargetRegisterClass *  SrcRC 
) const [virtual]

copyRegToReg - Emit instructions to copy between a pair of registers. It returns false if the target does not how to copy between the specified registers.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 132 of file MipsInstrInfo.cpp.

References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::DebugLoc::getUnknownLoc(), llvm::ARMCC::HI, llvm::PIC16ISD::MTHI, and llvm::PIC16ISD::MTLO.

void MipsInstrInfo::storeRegToStackSlot ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
unsigned  SrcReg,
bool  isKill,
int  FrameIndex,
const TargetRegisterClass *  RC 
) const [virtual]

storeRegToStackSlot - Store the specified register of the given register class to the specified stack frame index. The store instruction is to be added to the given machine basic block before the specified machine instruction. If isKill is true, the register operand is the last use and must be marked kill.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 191 of file MipsInstrInfo.cpp.

References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::getKillRegState(), and llvm::DebugLoc::getUnknownLoc().

void MipsInstrInfo::loadRegFromStackSlot ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
int  FrameIndex,
const TargetRegisterClass *  RC 
) const [virtual]

loadRegFromStackSlot - Load the specified register of the given register class from the specified stack frame index. The load instruction is to be added to the given machine basic block before the specified machine instruction.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 213 of file MipsInstrInfo.cpp.

References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::MachineBasicBlock::end(), and llvm::DebugLoc::getUnknownLoc().

MachineInstr * MipsInstrInfo::foldMemoryOperandImpl ( MachineFunction &  MF,
MachineInstr *  MI,
const SmallVectorImpl< unsigned > &  Ops,
int  FrameIndex 
) const [virtual]

virtual MachineInstr* llvm::MipsInstrInfo::foldMemoryOperandImpl ( MachineFunction &  MF,
MachineInstr *  MI,
const SmallVectorImpl< unsigned > &  Ops,
MachineInstr *  LoadMI 
) const [inline, virtual]

foldMemoryOperandImpl - Target-dependent implementation for foldMemoryOperand. Target-independent code in foldMemoryOperand will take care of adding a MachineMemOperand to the newly created instruction.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 196 of file MipsInstrInfo.h.

bool MipsInstrInfo::BlockHasNoFallThrough ( const MachineBasicBlock &  MBB  )  const [virtual]

BlockHasNoFallThrough - Analyze if MachineBasicBlock does not fall-through into its successor block.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 565 of file MipsInstrInfo.cpp.

References llvm::MachineBasicBlock::back(), llvm::MachineBasicBlock::empty(), llvm::MachineInstr::getOpcode(), and llvm::PIC16ISD::RET.

bool MipsInstrInfo::ReverseBranchCondition ( SmallVectorImpl< MachineOperand > &  Cond  )  const [virtual]

ReverseBranchCondition - Return the inverse opcode of the specified Branch instruction.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 581 of file MipsInstrInfo.cpp.

References GetOppositeBranchCondition(), and llvm::SmallVectorImpl< T >::size().

void MipsInstrInfo::insertNoop ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI 
) const [virtual]

Insert nop instruction when hazard condition is found.

insertNoop - If data hazard condition is found insert the target nop instruction.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 124 of file MipsInstrInfo.cpp.

References llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::DebugLoc::getUnknownLoc(), and llvm::PPCISD::NOP.

unsigned MipsInstrInfo::getGlobalBaseReg ( MachineFunction *  MF  )  const

getGlobalBaseReg - Return a virtual register initialized with the the global base register value. Output instructions required to initialize the register in the function entry block, if necessary.

getGlobalBaseReg - Return a virtual register initialized with the the global base register value. Output instructions required to initialize the register in the function entry block, if necessary.

Definition at line 593 of file MipsInstrInfo.cpp.

References llvm::MachineRegisterInfo::addLiveIn(), llvm::MachineBasicBlock::begin(), llvm::TargetInstrInfo::copyRegToReg(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::MachineFunction::front(), llvm::MipsFunctionInfo::getGlobalBaseReg(), llvm::MachineFunction::getInfo(), llvm::TargetMachine::getInstrInfo(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getTarget(), GlobalBaseReg, MBBI, RegInfo, llvm::MipsFunctionInfo::setGlobalBaseReg(), and TII.


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