LLVM API Documentation
#include <SPUInstrInfo.h>
Public Member Functions | |
| SPUInstrInfo (SPUTargetMachine &tm) | |
| virtual const SPURegisterInfo & | getRegisterInfo () const |
| virtual const TargetRegisterClass * | getPointerRegClass () const |
| virtual bool | isMoveInstr (const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg, unsigned &SrcSubIdx, unsigned &DstSubIdx) const |
| unsigned | isLoadFromStackSlot (const MachineInstr *MI, int &FrameIndex) const |
| unsigned | isStoreToStackSlot (const MachineInstr *MI, int &FrameIndex) const |
| virtual bool | copyRegToReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, 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 |
| Store a register to a stack slot, based on its register class. | |
| virtual void | storeRegToAddr (MachineFunction &MF, unsigned SrcReg, bool isKill, SmallVectorImpl< MachineOperand > &Addr, const TargetRegisterClass *RC, SmallVectorImpl< MachineInstr * > &NewMIs) const |
| Store a register to an address, based on its register class. | |
| virtual void | loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC) const |
| Load a register from a stack slot, based on its register class. | |
| virtual void | loadRegFromAddr (MachineFunction &MF, unsigned DestReg, SmallVectorImpl< MachineOperand > &Addr, const TargetRegisterClass *RC, SmallVectorImpl< MachineInstr * > &NewMIs) const |
| Loqad a register from an address, based on its register class. | |
| virtual bool | canFoldMemoryOperand (const MachineInstr *MI, const SmallVectorImpl< unsigned > &Ops) const |
| Return true if the specified load or store can be folded. | |
| virtual bool | BlockHasNoFallThrough (const MachineBasicBlock &MBB) const |
| Return true if the specified block does not fall through. | |
| virtual bool | ReverseBranchCondition (SmallVectorImpl< MachineOperand > &Cond) const |
| Reverses a branch's condition, returning false on success. | |
| 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 |
Protected Member Functions | |
| 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 |
Definition at line 23 of file SPUInstrInfo.h.
| SPUInstrInfo::SPUInstrInfo | ( | SPUTargetMachine & | tm | ) | [explicit] |
Definition at line 50 of file SPUInstrInfo.cpp.
| MachineInstr * SPUInstrInfo::foldMemoryOperandImpl | ( | MachineFunction & | MF, | |
| MachineInstr * | MI, | |||
| const SmallVectorImpl< unsigned > & | Ops, | |||
| int | FrameIndex | |||
| ) | const [protected, virtual] |
foldMemoryOperand - SPU, like PPC, can only fold spills into copy instructions, turning them into load/store instructions.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 480 of file SPUInstrInfo.cpp.
References llvm::addFrameReference(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::Attribute::InReg, llvm::MachineOperand::isDead(), llvm::MachineOperand::isKill(), llvm::SPUFrameInfo::maxFrameOffset(), and llvm::SmallVectorImpl< T >::size().
| virtual MachineInstr* llvm::SPUInstrInfo::foldMemoryOperandImpl | ( | MachineFunction & | MF, | |
| MachineInstr * | MI, | |||
| const SmallVectorImpl< unsigned > & | Ops, | |||
| MachineInstr * | LoadMI | |||
| ) | const [inline, protected, 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 32 of file SPUInstrInfo.h.
| virtual const SPURegisterInfo& llvm::SPUInstrInfo::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 46 of file SPUInstrInfo.h.
Referenced by llvm::SPUTargetMachine::getRegisterInfo().
| const TargetRegisterClass * SPUInstrInfo::getPointerRegClass | ( | ) | const [virtual] |
getPointerRegClass - Return the register class to use to hold pointers. This is used for addressing modes.
getPointerRegClass - Return the register class to use to hold pointers. This is used for addressing modes.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 59 of file SPUInstrInfo.cpp.
| bool SPUInstrInfo::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.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 65 of file SPUInstrInfo.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isImm(), and llvm::MachineOperand::isReg().
| unsigned SPUInstrInfo::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.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 207 of file SPUInstrInfo.cpp.
References llvm::MachineOperand::getIndex(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isFI(), and llvm::MachineOperand::isImm().
| unsigned SPUInstrInfo::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.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 233 of file SPUInstrInfo.cpp.
References llvm::MachineOperand::getIndex(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isFI(), and llvm::MachineOperand::isImm().
| bool SPUInstrInfo::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 259 of file SPUInstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), and llvm::BuildMI().
| void SPUInstrInfo::storeRegToStackSlot | ( | MachineBasicBlock & | MBB, | |
| MachineBasicBlock::iterator | MBBI, | |||
| unsigned | SrcReg, | |||
| bool | isKill, | |||
| int | FrameIndex, | |||
| const TargetRegisterClass * | RC | |||
| ) | const [virtual] |
Store a register to a stack slot, based on its register class.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 295 of file SPUInstrInfo.cpp.
References llvm::addFrameReference(), llvm::BuildMI(), and llvm::SPUFrameInfo::maxFrameOffset().
| void SPUInstrInfo::storeRegToAddr | ( | MachineFunction & | MF, | |
| unsigned | SrcReg, | |||
| bool | isKill, | |||
| SmallVectorImpl< MachineOperand > & | Addr, | |||
| const TargetRegisterClass * | RC, | |||
| SmallVectorImpl< MachineInstr * > & | NewMIs | |||
| ) | const [virtual] |
Store a register to an address, based on its register class.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 327 of file SPUInstrInfo.cpp.
References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::cerr(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), llvm::SmallVectorImpl< T >::push_back(), and llvm::SmallVectorImpl< T >::size().
| void SPUInstrInfo::loadRegFromStackSlot | ( | MachineBasicBlock & | MBB, | |
| MachineBasicBlock::iterator | MBBI, | |||
| unsigned | DestReg, | |||
| int | FrameIndex, | |||
| const TargetRegisterClass * | RC | |||
| ) | const [virtual] |
Load a register from a stack slot, based on its register class.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 371 of file SPUInstrInfo.cpp.
References llvm::addFrameReference(), llvm::BuildMI(), and llvm::SPUFrameInfo::maxFrameOffset().
| void SPUInstrInfo::loadRegFromAddr | ( | MachineFunction & | MF, | |
| unsigned | DestReg, | |||
| SmallVectorImpl< MachineOperand > & | Addr, | |||
| const TargetRegisterClass * | RC, | |||
| SmallVectorImpl< MachineInstr * > & | NewMIs | |||
| ) | const [virtual] |
Loqad a register from an address, based on its register class.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 405 of file SPUInstrInfo.cpp.
References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::cerr(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), llvm::SmallVectorImpl< T >::push_back(), and llvm::SmallVectorImpl< T >::size().
| bool SPUInstrInfo::canFoldMemoryOperand | ( | const MachineInstr * | MI, | |
| const SmallVectorImpl< unsigned > & | Ops | |||
| ) | const [virtual] |
Return true if the specified load or store can be folded.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 451 of file SPUInstrInfo.cpp.
References llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), and llvm::SmallVectorImpl< T >::size().
| bool SPUInstrInfo::BlockHasNoFallThrough | ( | const MachineBasicBlock & | MBB | ) | const [virtual] |
Return true if the specified block does not fall through.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 668 of file SPUInstrInfo.cpp.
References llvm::MachineBasicBlock::back(), llvm::MachineBasicBlock::empty(), and isUncondBranch().
| bool SPUInstrInfo::ReverseBranchCondition | ( | SmallVectorImpl< MachineOperand > & | Cond | ) | const [virtual] |
Reverses a branch's condition, returning false on success.
The incoming opcode
The reversed condition opcode
Reimplemented from llvm::TargetInstrInfo.
Definition at line 673 of file SPUInstrInfo.cpp.
| bool SPUInstrInfo::AnalyzeBranch | ( | MachineBasicBlock & | MBB, | |
| MachineBasicBlock *& | TBB, | |||
| MachineBasicBlock *& | FBB, | |||
| SmallVectorImpl< MachineOperand > & | Cond, | |||
| bool | AllowModify | |||
| ) | const [virtual] |
Branch analysis.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 533 of file SPUInstrInfo.cpp.
References llvm::MachineBasicBlock::begin(), llvm::cerr(), llvm::MachineOperand::CreateImm(), DEBUG, llvm::MachineInstr::dump(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), llvm::MachineOperand::getMBB(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), isCondBranch(), isUncondBranch(), llvm::TargetInstrInfo::isUnpredicatedTerminator(), and llvm::SmallVectorImpl< T >::push_back().
| unsigned SPUInstrInfo::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 597 of file SPUInstrInfo.cpp.
References llvm::MachineBasicBlock::begin(), llvm::cerr(), DEBUG, llvm::MachineBasicBlock::end(), isCondBranch(), and isUncondBranch().
| unsigned SPUInstrInfo::InsertBranch | ( | MachineBasicBlock & | MBB, | |
| MachineBasicBlock * | TBB, | |||
| MachineBasicBlock * | FBB, | |||
| const SmallVectorImpl< MachineOperand > & | Cond | |||
| ) | const [virtual] |
InsertBranch - Insert a branch into the end of the specified MachineBasicBlock. This operands to this method are the same as those returned by AnalyzeBranch. This is invoked in cases where AnalyzeBranch returns success and when an unconditional branch (TBB is non-null, FBB is null, Cond is empty) needs to be inserted. It returns the number of instructions inserted.
Reimplemented from llvm::TargetInstrInfo.
Definition at line 625 of file SPUInstrInfo.cpp.
References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::ISD::BR, llvm::BuildMI(), llvm::cerr(), DEBUG, llvm::SmallVectorImpl< T >::empty(), and llvm::SmallVectorImpl< T >::size().