LLVM API Documentation

llvm::SystemZInstrInfo Class Reference

#include <SystemZInstrInfo.h>

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

List of all members.

Public Member Functions

 SystemZInstrInfo (SystemZTargetMachine &TM)
virtual const SystemZRegisterInfo & getRegisterInfo () const
bool copyRegToReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, unsigned SrcReg, const TargetRegisterClass *DestRC, const TargetRegisterClass *SrcRC) const
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
bool isInvariantLoad (const MachineInstr *MI) const
virtual void storeRegToStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC) const
virtual void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIdx, const TargetRegisterClass *RC) const
virtual bool spillCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI) const
virtual bool restoreCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI) const
bool ReverseBranchCondition (SmallVectorImpl< MachineOperand > &Cond) const
virtual bool BlockHasNoFallThrough (const MachineBasicBlock &MBB) const
virtual bool isUnpredicatedTerminator (const MachineInstr *MI) const
virtual bool AnalyzeBranch (MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const
virtual unsigned InsertBranch (MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const SmallVectorImpl< MachineOperand > &Cond) const
virtual unsigned RemoveBranch (MachineBasicBlock &MBB) const
SystemZCC::CondCodes getOppositeCondition (SystemZCC::CondCodes CC) const
SystemZCC::CondCodes getCondFromBranchOpc (unsigned Opc) const
const TargetInstrDesc & getBrCond (SystemZCC::CondCodes CC) const
const TargetInstrDesc & getLongDispOpc (unsigned Opc) const
const TargetInstrDesc & getMemoryInstr (unsigned Opc, int64_t Offset=0) const


Detailed Description

Definition at line 50 of file SystemZInstrInfo.h.


Constructor & Destructor Documentation

SystemZInstrInfo::SystemZInstrInfo ( SystemZTargetMachine &  TM  )  [explicit]


Member Function Documentation

virtual const SystemZRegisterInfo& llvm::SystemZInstrInfo::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 61 of file SystemZInstrInfo.h.

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

bool SystemZInstrInfo::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 118 of file SystemZInstrInfo.cpp.

References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::DebugLoc::getUnknownLoc(), llvm::TargetRegisterClass::hasSubClass(), and llvm::TargetRegisterClass::hasSuperClass().

bool SystemZInstrInfo::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 175 of file SystemZInstrInfo.cpp.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), and llvm::MachineOperand::isReg().

unsigned SystemZInstrInfo::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 199 of file SystemZInstrInfo.cpp.

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

unsigned SystemZInstrInfo::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 234 of file SystemZInstrInfo.cpp.

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

bool SystemZInstrInfo::isInvariantLoad ( const MachineInstr *  MI  )  const [virtual]

isInvariantLoad - Return true if the specified instruction (which is marked mayLoad) is loading from a location whose value is invariant across the function. For example, loading a value from the constant pool or from from the argument area of a function if it does not change. This should only return true of *all* loads the instruction does are invariant (if it does multiple loads).

Reimplemented from llvm::TargetInstrInfo.

Definition at line 269 of file SystemZInstrInfo.cpp.

References llvm::MachineFunction::getFrameInfo(), llvm::MachineOperand::getGlobal(), llvm::MachineOperand::getIndex(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), Idx, llvm::MachineOperand::isCPI(), llvm::MachineOperand::isFI(), llvm::MachineFrameInfo::isFixedObjectIndex(), llvm::MachineOperand::isGlobal(), isGVStub(), llvm::MachineFrameInfo::isImmutableObjectIndex(), and MFI.

void SystemZInstrInfo::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 61 of file SystemZInstrInfo.cpp.

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

Referenced by spillCalleeSavedRegisters().

void SystemZInstrInfo::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 90 of file SystemZInstrInfo.cpp.

References llvm::addFrameReference(), llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::DebugLoc::getUnknownLoc(), and llvm_unreachable.

Referenced by restoreCalleeSavedRegisters().

bool SystemZInstrInfo::spillCalleeSavedRegisters ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
const std::vector< CalleeSavedInfo > &  CSI 
) const [virtual]

bool SystemZInstrInfo::restoreCalleeSavedRegisters ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
const std::vector< CalleeSavedInfo > &  CSI 
) const [virtual]

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

ReverseBranchCondition - Reverses the branch condition of the specified condition list, returning false on success and true if it cannot be reversed.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 421 of file SystemZInstrInfo.cpp.

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

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

BlockHasNoFallThrough - Return true if the specified block does not fall-through into its successor block. This is primarily used when a branch is unanalyzable. It is useful for things like unconditional indirect branches (jump tables).

Reimplemented from llvm::TargetInstrInfo.

Definition at line 429 of file SystemZInstrInfo.cpp.

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

bool SystemZInstrInfo::isUnpredicatedTerminator ( const MachineInstr *  MI  )  const [virtual]

isUnpredicatedTerminator - Returns true if the instruction is a terminator instruction that has not been predicated.

Reimplemented from llvm::TargetInstrInfo.

Definition at line 441 of file SystemZInstrInfo.cpp.

References llvm::MachineInstr::getDesc(), llvm::TargetInstrDesc::isBarrier(), llvm::TargetInstrDesc::isBranch(), llvm::TargetInstrDesc::isPredicable(), llvm::TargetInstrInfo::isPredicated(), and llvm::TargetInstrDesc::isTerminator().

Referenced by AnalyzeBranch().

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

AnalyzeBranch - Analyze the branching code at the end of MBB, returning true if it cannot be understood (e.g. it's a switch dispatch or isn't implemented for a target). Upon success, this returns false and returns with the following information in various cases:

1. If this block ends with no branches (it just falls through to its succ) just return false, leaving TBB/FBB null. 2. If this block ends with only an unconditional branch, it sets TBB to be the destination block. 3. If this block ends with an conditional branch and it falls through to a successor block, it sets TBB to be the branch destination block and a list of operands that evaluate the condition. These operands can be passed to other TargetInstrInfo methods to create new branches. 4. If this block ends with a conditional branch followed by an unconditional branch, it returns the 'true' destination in TBB, the 'false' destination in FBB, and a list of operands that evaluate the condition. These operands can be passed to other TargetInstrInfo methods to create new branches.

Note that RemoveBranch and InsertBranch must be implemented to support cases where this method returns success.

If AllowModify is true, then this routine is allowed to modify the basic block (e.g. delete instructions after the unconditional branch).

Reimplemented from llvm::TargetInstrInfo.

Definition at line 453 of file SystemZInstrInfo.cpp.

References llvm::MachineBasicBlock::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::MachineOperand::CreateImm(), llvm::SmallVectorImpl< T >::empty(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::eraseFromParent(), getCondFromBranchOpc(), llvm::SystemZCC::INVALID, llvm::MachineBasicBlock::isLayoutSuccessor(), isUnpredicatedTerminator(), llvm::next(), llvm::SmallVectorImpl< T >::push_back(), and llvm::SmallVectorImpl< T >::size().

unsigned SystemZInstrInfo::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 552 of file SystemZInstrInfo.cpp.

References llvm::MachineInstrBuilder::addMBB(), llvm::BuildMI(), llvm::SmallVectorImpl< T >::empty(), getBrCond(), llvm::DebugLoc::getUnknownLoc(), and llvm::SmallVectorImpl< T >::size().

unsigned SystemZInstrInfo::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 533 of file SystemZInstrInfo.cpp.

References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), getCondFromBranchOpc(), and llvm::SystemZCC::INVALID.

SystemZCC::CondCodes SystemZInstrInfo::getOppositeCondition ( SystemZCC::CondCodes  CC  )  const

SystemZCC::CondCodes SystemZInstrInfo::getCondFromBranchOpc ( unsigned  Opc  )  const

const TargetInstrDesc & SystemZInstrInfo::getBrCond ( SystemZCC::CondCodes  CC  )  const

const TargetInstrDesc & SystemZInstrInfo::getLongDispOpc ( unsigned  Opc  )  const

Definition at line 649 of file SystemZInstrInfo.cpp.

References llvm_unreachable.

Referenced by getMemoryInstr().

const TargetInstrDesc& llvm::SystemZInstrInfo::getMemoryInstr ( unsigned  Opc,
int64_t  Offset = 0 
) const [inline]

Definition at line 110 of file SystemZInstrInfo.h.

References getLongDispOpc().

Referenced by llvm::SystemZRegisterInfo::eliminateFrameIndex().


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