LLVM  5.0.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::MipsInstrInfo Class Referenceabstract

#include "Target/Mips/MipsInstrInfo.h"

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

Public Types

enum  BranchType {
  BT_None, BT_NoBranch, BT_Uncond, BT_Cond,
  BT_CondUncond, BT_Indirect
}
 

Public Member Functions

 MipsInstrInfo (const MipsSubtarget &STI, unsigned UncondBrOpc)
 
bool analyzeBranch (MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
 Branch Analysis. More...
 
unsigned removeBranch (MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
 
unsigned insertBranch (MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
 
bool reverseBranchCondition (SmallVectorImpl< MachineOperand > &Cond) const override
 reverseBranchCondition - Return the inverse opcode of the specified Branch instruction. More...
 
BranchType analyzeBranch (MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify, SmallVectorImpl< MachineInstr * > &BranchInstrs) const
 
unsigned getEquivalentCompactForm (const MachineBasicBlock::iterator I) const
 Determine the opcode of a non-delay slot form for a branch if one exists. More...
 
bool SafeInForbiddenSlot (const MachineInstr &MI) const
 Predicate to determine if an instruction can go in a forbidden slot. More...
 
bool HasForbiddenSlot (const MachineInstr &MI) const
 Predicate to determine if an instruction has a forbidden slot. More...
 
void insertNoop (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
 Insert nop instruction when hazard condition is found. More...
 
virtual const MipsRegisterInfo & getRegisterInfo () const =0
 getRegisterInfo - TargetInstrInfo is a superset of MRegister info. More...
 
virtual unsigned getOppositeBranchOpc (unsigned Opc) const =0
 
unsigned getInstSizeInBytes (const MachineInstr &MI) const override
 Return the number of bytes of code the specified instruction may be. More...
 
void storeRegToStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
 
void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
 
virtual void storeRegToStack (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, int64_t Offset) const =0
 
virtual void loadRegFromStack (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, int64_t Offset) const =0
 
virtual void adjustStackPtr (unsigned SP, int64_t Amount, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const =0
 
MachineInstrBuilder genInstrWithNewOpc (unsigned NewOpc, MachineBasicBlock::iterator I) const
 Create an instruction which has the same operands and memory operands as MI but has a new opcode. More...
 
bool findCommutedOpIndices (MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const override
 

Static Public Member Functions

static const MipsInstrInfo * create (MipsSubtarget &STI)
 

Protected Member Functions

bool isZeroImm (const MachineOperand &op) const
 
MachineMemOperand * GetMemOperand (MachineBasicBlock &MBB, int FI, MachineMemOperand::Flags Flags) const
 

Protected Attributes

const MipsSubtarget & Subtarget
 
unsigned UncondBrOpc
 

Detailed Description

Definition at line 32 of file MipsInstrInfo.h.

Member Enumeration Documentation

Enumerator
BT_None 
BT_NoBranch 
BT_Uncond 
BT_Cond 
BT_CondUncond 
BT_Indirect 

Definition at line 39 of file MipsInstrInfo.h.

Constructor & Destructor Documentation

MipsInstrInfo::MipsInstrInfo ( const MipsSubtarget &  STI,
unsigned  UncondBrOpc 
)
explicit

Definition at line 32 of file MipsInstrInfo.cpp.

Member Function Documentation

virtual void llvm::MipsInstrInfo::adjustStackPtr ( unsigned  SP,
int64_t  Amount,
MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  I 
) const
pure virtual
bool MipsInstrInfo::analyzeBranch ( MachineBasicBlock &  MBB,
MachineBasicBlock *&  TBB,
MachineBasicBlock *&  FBB,
SmallVectorImpl< MachineOperand > &  Cond,
bool  AllowModify 
) const
override

Branch Analysis.

Definition at line 87 of file MipsInstrInfo.cpp.

References BT_Indirect, and BT_None.

MipsInstrInfo::BranchType MipsInstrInfo::analyzeBranch ( MachineBasicBlock &  MBB,
MachineBasicBlock *&  TBB,
MachineBasicBlock *&  FBB,
SmallVectorImpl< MachineOperand > &  Cond,
bool  AllowModify,
SmallVectorImpl< MachineInstr * > &  BranchInstrs 
) const
const MipsInstrInfo * MipsInstrInfo::create ( MipsSubtarget &  STI)
static
bool MipsInstrInfo::findCommutedOpIndices ( MachineInstr &  MI,
unsigned &  SrcOpIdx1,
unsigned &  SrcOpIdx2 
) const
override
MachineInstrBuilder MipsInstrInfo::genInstrWithNewOpc ( unsigned  NewOpc,
MachineBasicBlock::iterator  I 
) const

Create an instruction which has the same operands and memory operands as MI but has a new opcode.

Definition at line 425 of file MipsInstrInfo.cpp.

References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::MachineInstrBuilder::copyImplicitOps(), E, I, llvm::MachineInstr::RemoveOperand(), and llvm::MachineInstrBuilder::setMemRefs().

unsigned MipsInstrInfo::getEquivalentCompactForm ( const MachineBasicBlock::iterator  I) const

Determine the opcode of a non-delay slot form for a branch if one exists.

Return the corresponding compact (no delay slot) form of a branch.

Definition at line 268 of file MipsInstrInfo.cpp.

References B, llvm::MipsSubtarget::getABI(), llvm::MipsABIInfo::GetZeroReg(), llvm::MipsSubtarget::hasMips32r6(), llvm::MipsSubtarget::inMicroMipsMode(), and Subtarget.

unsigned MipsInstrInfo::getInstSizeInBytes ( const MachineInstr &  MI) const
override
MachineMemOperand * MipsInstrInfo::GetMemOperand ( MachineBasicBlock &  MBB,
int  FI,
MachineMemOperand::Flags  Flags 
) const
protected
virtual unsigned llvm::MipsInstrInfo::getOppositeBranchOpc ( unsigned  Opc) const
pure virtual
virtual const MipsRegisterInfo& llvm::MipsInstrInfo::getRegisterInfo ( ) const
pure 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).

Implemented in llvm::Mips16InstrInfo, and llvm::MipsSEInstrInfo.

bool MipsInstrInfo::HasForbiddenSlot ( const MachineInstr &  MI) const

Predicate to determine if an instruction has a forbidden slot.

Predicate for distingushing instructions that have forbidden slots.

Definition at line 403 of file MipsInstrInfo.cpp.

References llvm::MachineInstr::getDesc(), llvm::MipsII::HasForbiddenSlot, and llvm::MCInstrDesc::TSFlags.

unsigned MipsInstrInfo::insertBranch ( MachineBasicBlock &  MBB,
MachineBasicBlock *  TBB,
MachineBasicBlock *  FBB,
ArrayRef< MachineOperand >  Cond,
const DebugLoc &  DL,
int *  BytesAdded = nullptr 
) const
override
void MipsInstrInfo::insertNoop ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI 
) const
override

Insert nop instruction when hazard condition is found.

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

Definition at line 51 of file MipsInstrInfo.cpp.

References llvm::BuildMI(), and llvm::DL.

bool MipsInstrInfo::isZeroImm ( const MachineOperand &  op) const
protected
virtual void llvm::MipsInstrInfo::loadRegFromStack ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
int  FrameIndex,
const TargetRegisterClass *  RC,
const TargetRegisterInfo *  TRI,
int64_t  Offset 
) const
pure virtual
void llvm::MipsInstrInfo::loadRegFromStackSlot ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MBBI,
unsigned  DestReg,
int  FrameIndex,
const TargetRegisterClass *  RC,
const TargetRegisterInfo *  TRI 
) const
inlineoverride

Definition at line 107 of file MipsInstrInfo.h.

References loadRegFromStack().

unsigned MipsInstrInfo::removeBranch ( MachineBasicBlock &  MBB,
int *  BytesRemoved = nullptr 
) const
override
bool MipsInstrInfo::reverseBranchCondition ( SmallVectorImpl< MachineOperand > &  Cond) const
override

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

Definition at line 176 of file MipsInstrInfo.cpp.

References assert(), getOppositeBranchOpc(), and llvm::SmallVectorTemplateCommon< T >::size().

bool MipsInstrInfo::SafeInForbiddenSlot ( const MachineInstr &  MI) const

Predicate to determine if an instruction can go in a forbidden slot.

Predicate for distingushing between control transfer instructions and all other instructions for handling forbidden slots.

Consider inline assembly as unsafe as well.

Definition at line 394 of file MipsInstrInfo.cpp.

References llvm::MachineInstr::getDesc(), llvm::MipsII::IsCTI, llvm::MachineInstr::isInlineAsm(), and llvm::MCInstrDesc::TSFlags.

virtual void llvm::MipsInstrInfo::storeRegToStack ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MI,
unsigned  SrcReg,
bool  isKill,
int  FrameIndex,
const TargetRegisterClass *  RC,
const TargetRegisterInfo *  TRI,
int64_t  Offset 
) const
pure virtual
void llvm::MipsInstrInfo::storeRegToStackSlot ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  MBBI,
unsigned  SrcReg,
bool  isKill,
int  FrameIndex,
const TargetRegisterClass *  RC,
const TargetRegisterInfo *  TRI 
) const
inlineoverride

Definition at line 99 of file MipsInstrInfo.h.

References storeRegToStack().

Member Data Documentation

const MipsSubtarget& llvm::MipsInstrInfo::Subtarget
protected
unsigned llvm::MipsInstrInfo::UncondBrOpc
protected

Definition at line 36 of file MipsInstrInfo.h.

Referenced by insertBranch().


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