LLVM API Documentation

X86InstrInfo.cpp File Reference

#include "X86InstrInfo.h"
#include "X86.h"
#include "X86GenInstrInfo.inc"
#include "X86InstrBuilder.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
#include "X86TargetMachine.h"
#include "llvm/GlobalVariable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/LLVMContext.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetAsmInfo.h"

Include dependency graph for X86InstrInfo.cpp:

Go to the source code of this file.

Functions

static bool regIsPICBase (unsigned BaseReg, const MachineRegisterInfo &MRI)
static bool CanRematLoadWithDispOperand (const MachineOperand &MO, X86TargetMachine &TM)
static bool isSafeToClobberEFLAGS (MachineBasicBlock &MBB, MachineBasicBlock::iterator I)
static bool hasLiveCondCodeDef (MachineInstr *MI)
static X86::CondCode GetCondFromBranchOpc (unsigned BrOpc)
static bool isBrAnalysisUnpredicatedTerminator (const MachineInstr *MI, const X86InstrInfo &TII)
static bool isHReg (unsigned Reg)
 isHReg - Test if the given register is a physical h register.
static unsigned getStoreRegOpcode (unsigned SrcReg, const TargetRegisterClass *RC, bool isStackAligned, TargetMachine &TM)
static unsigned getLoadRegOpcode (unsigned DestReg, const TargetRegisterClass *RC, bool isStackAligned, const TargetMachine &TM)
static MachineInstr * FuseTwoAddrInst (MachineFunction &MF, unsigned Opcode, const SmallVectorImpl< MachineOperand > &MOs, MachineInstr *MI, const TargetInstrInfo &TII)
static MachineInstr * FuseInst (MachineFunction &MF, unsigned Opcode, unsigned OpNo, const SmallVectorImpl< MachineOperand > &MOs, MachineInstr *MI, const TargetInstrInfo &TII)
static MachineInstr * MakeM0Inst (const TargetInstrInfo &TII, unsigned Opcode, const SmallVectorImpl< MachineOperand > &MOs, MachineInstr *MI)
static unsigned sizePCRelativeBlockAddress ()
static unsigned sizeGlobalAddress (bool dword)
static unsigned sizeConstPoolAddress (bool dword)
static unsigned sizeExternalSymbolAddress (bool dword)
static unsigned sizeJumpTableAddress (bool dword)
static unsigned sizeConstant (unsigned Size)
static unsigned sizeRegModRMByte ()
static unsigned sizeSIBByte ()
static unsigned getDisplacementFieldSize (const MachineOperand *RelocOp)
static unsigned getMemModRMByteSize (const MachineInstr &MI, unsigned Op, bool IsPIC, bool Is64BitMode)
static unsigned GetInstSizeWithDesc (const MachineInstr &MI, const TargetInstrDesc *Desc, bool IsPIC, bool Is64BitMode)

Variables

cl::opt< bool > NoFusing ("disable-spill-fusing", cl::desc("Disable fusing of spill code into instructions"))
cl::opt< bool > PrintFailedFusing ("print-failed-fuse-candidates", cl::desc("Print instructions that the allocator wants to"" fuse, but the X86 backend currently can't"), cl::Hidden)
cl::opt< bool > ReMatPICStubLoad ("remat-pic-stub-load", cl::desc("Re-materialize load from stub in PIC mode"), cl::init(false), cl::Hidden)


Function Documentation

static bool CanRematLoadWithDispOperand ( const MachineOperand &  MO,
X86TargetMachine &  TM 
) [static]

CanRematLoadWithDispOperand - Return true if a load with the specified operand is a candidate for remat: for this to be true we need to know that the load will always return the same value, even if moved.

Definition at line 790 of file X86InstrInfo.cpp.

References llvm::MachineOperand::getGlobal(), llvm::MachineOperand::getTargetFlags(), GV, llvm::MachineOperand::isCPI(), llvm::MachineOperand::isGlobal(), and llvm::isGlobalStubReference().

Referenced by llvm::X86InstrInfo::isReallyTriviallyReMaterializable().

static MachineInstr* FuseInst ( MachineFunction &  MF,
unsigned  Opcode,
unsigned  OpNo,
const SmallVectorImpl< MachineOperand > &  MOs,
MachineInstr *  MI,
const TargetInstrInfo &  TII 
) [static]

static MachineInstr* FuseTwoAddrInst ( MachineFunction &  MF,
unsigned  Opcode,
const SmallVectorImpl< MachineOperand > &  MOs,
MachineInstr *  MI,
const TargetInstrInfo &  TII 
) [static]

static X86::CondCode GetCondFromBranchOpc ( unsigned  BrOpc  )  [static]

static unsigned getDisplacementFieldSize ( const MachineOperand *  RelocOp  )  [static]

static unsigned GetInstSizeWithDesc ( const MachineInstr &  MI,
const TargetInstrDesc *  Desc,
bool  IsPIC,
bool  Is64BitMode 
) [static]

Definition at line 2897 of file X86InstrInfo.cpp.

References llvm::X86II::AddRegFrm, llvm::X86II::AdSize, llvm::X86II::D8, llvm::X86II::D9, llvm::X86II::DA, llvm::X86II::DB, llvm::TargetInstrInfo::DBG_LABEL, llvm::X86II::DC, llvm::X86II::DD, llvm::X86II::DE, llvm::TargetInstrInfo::DECLARE, llvm::X86InstrInfo::determineREX(), llvm::X86II::DF, llvm::TargetInstrInfo::EH_LABEL, llvm::X86II::FormMask, llvm::X86II::FS, llvm::TargetInstrInfo::getInlineAsmLength(), llvm::TargetMachine::getInstrInfo(), getMemModRMByteSize(), llvm::TargetInstrDesc::getNumOperands(), llvm::TargetInstrDesc::getOpcode(), llvm::MachineInstr::getOperand(), llvm::TargetInstrDesc::getOperandConstraint(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getSymbolName(), llvm::MachineFunction::getTarget(), llvm::TargetMachine::getTargetAsmInfo(), llvm::X86II::GS, llvm::TargetInstrInfo::IMPLICIT_DEF, llvm::TargetInstrInfo::INLINEASM, llvm::MachineOperand::isCPI(), llvm::MachineOperand::isGlobal(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isJTI(), llvm::MachineOperand::isMBB(), llvm::MachineOperand::isSymbol(), llvm::TargetInstrDesc::isVariadic(), llvm::llvm_report_error(), llvm_unreachable, llvm::X86II::LOCK, llvm::X86II::MRM0m, llvm::X86II::MRM0r, llvm::X86II::MRM1m, llvm::X86II::MRM1r, llvm::X86II::MRM2m, llvm::X86II::MRM2r, llvm::X86II::MRM3m, llvm::X86II::MRM3r, llvm::X86II::MRM4m, llvm::X86II::MRM4r, llvm::X86II::MRM5m, llvm::X86II::MRM5r, llvm::X86II::MRM6m, llvm::X86II::MRM6r, llvm::X86II::MRM7m, llvm::X86II::MRM7r, llvm::X86II::MRMDestMem, llvm::X86II::MRMDestReg, llvm::X86II::MRMInitReg, llvm::X86II::MRMSrcMem, llvm::X86II::MRMSrcReg, llvm::X86II::Op0Mask, llvm::TargetInstrDesc::Opcode, llvm::X86II::OpSize, llvm::X86II::Pseudo, llvm::X86II::RawFrm, llvm::X86II::REP, llvm::X86II::SegOvrMask, sizeConstant(), sizeConstPoolAddress(), sizeExternalSymbolAddress(), sizeGlobalAddress(), sizeJumpTableAddress(), llvm::X86InstrInfo::sizeOfImm(), sizePCRelativeBlockAddress(), sizeRegModRMByte(), llvm::raw_string_ostream::str(), llvm::X86II::T8, llvm::X86II::TA, llvm::X86II::TB, llvm::X86II::TF, llvm::TOI::TIED_TO, TII, llvm::TargetInstrDesc::TSFlags, llvm::X86AddrNumOperands, llvm::X86II::XD, and llvm::X86II::XS.

Referenced by llvm::X86InstrInfo::GetInstSizeInBytes().

static unsigned getLoadRegOpcode ( unsigned  DestReg,
const TargetRegisterClass *  RC,
bool  isStackAligned,
const TargetMachine &  TM 
) [static]

static unsigned getMemModRMByteSize ( const MachineInstr &  MI,
unsigned  Op,
bool  IsPIC,
bool  Is64BitMode 
) [static]

static unsigned getStoreRegOpcode ( unsigned  SrcReg,
const TargetRegisterClass *  RC,
bool  isStackAligned,
TargetMachine &  TM 
) [static]

static bool hasLiveCondCodeDef ( MachineInstr *  MI  )  [static]

hasLiveCondCodeDef - True if MI has a condition code def, e.g. EFLAGS, that is not marked dead.

Definition at line 1002 of file X86InstrInfo.cpp.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isDead(), llvm::MachineOperand::isDef(), and llvm::MachineOperand::isReg().

Referenced by llvm::X86InstrInfo::convertToThreeAddress().

static bool isBrAnalysisUnpredicatedTerminator ( const MachineInstr *  MI,
const X86InstrInfo &  TII 
) [static]

static bool isHReg ( unsigned  Reg  )  [static]

isHReg - Test if the given register is a physical h register.

Definition at line 1680 of file X86InstrInfo.cpp.

Referenced by llvm::X86InstrInfo::copyRegToReg(), getLoadRegOpcode(), and getStoreRegOpcode().

static bool isSafeToClobberEFLAGS ( MachineBasicBlock &  MBB,
MachineBasicBlock::iterator  I 
) [static]

isSafeToClobberEFLAGS - Return true if it's safe insert an instruction that would clobber the EFLAGS condition register. Note the result may be conservative. If it cannot definitely determine the safety after visiting two instructions it assumes it's not safe.

Definition at line 882 of file X86InstrInfo.cpp.

References llvm::MachineBasicBlock::end(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::isUse().

Referenced by llvm::X86InstrInfo::reMaterialize().

static MachineInstr* MakeM0Inst ( const TargetInstrInfo &  TII,
unsigned  Opcode,
const SmallVectorImpl< MachineOperand > &  MOs,
MachineInstr *  MI 
) [static]

static bool regIsPICBase ( unsigned  BaseReg,
const MachineRegisterInfo &  MRI 
) [static]

regIsPICBase - Return true if register is PIC base (i.e.g defined by X86::MOVPC32r.

Definition at line 774 of file X86InstrInfo.cpp.

References llvm::MachineRegisterInfo::def_begin(), llvm::MachineRegisterInfo::def_end(), E, and llvm::MachineInstr::getOpcode().

Referenced by llvm::X86InstrInfo::isReallyTriviallyReMaterializable().

static unsigned sizeConstant ( unsigned  Size  )  [static]

Definition at line 2788 of file X86InstrInfo.cpp.

Referenced by getDisplacementFieldSize(), and GetInstSizeWithDesc().

static unsigned sizeConstPoolAddress ( bool  dword  )  [static]

sizeConstPoolAddress - Give the size of the emission of this constant pool address

Definition at line 2770 of file X86InstrInfo.cpp.

Referenced by getDisplacementFieldSize(), and GetInstSizeWithDesc().

static unsigned sizeExternalSymbolAddress ( bool  dword  )  [static]

sizeExternalSymbolAddress - Give the size of the emission of this external symbol

Definition at line 2777 of file X86InstrInfo.cpp.

Referenced by GetInstSizeWithDesc().

static unsigned sizeGlobalAddress ( bool  dword  )  [static]

sizeGlobalAddress - Give the size of the emission of this global address

Definition at line 2763 of file X86InstrInfo.cpp.

Referenced by getDisplacementFieldSize(), and GetInstSizeWithDesc().

static unsigned sizeJumpTableAddress ( bool  dword  )  [static]

sizeJumpTableAddress - Give the size of the emission of this jump table address

Definition at line 2784 of file X86InstrInfo.cpp.

Referenced by getDisplacementFieldSize(), and GetInstSizeWithDesc().

static unsigned sizePCRelativeBlockAddress (  )  [static]

sizePCRelativeBlockAddress - This method returns the size of a PC relative block address instruction

Definition at line 2757 of file X86InstrInfo.cpp.

Referenced by GetInstSizeWithDesc().

static unsigned sizeRegModRMByte (  )  [static]

Definition at line 2792 of file X86InstrInfo.cpp.

Referenced by GetInstSizeWithDesc().

static unsigned sizeSIBByte (  )  [static]

Definition at line 2796 of file X86InstrInfo.cpp.

Referenced by getMemModRMByteSize().


Variable Documentation

cl::opt<bool> NoFusing("disable-spill-fusing", cl::desc("Disable fusing of spill code into instructions")) [static]

cl::opt<bool> PrintFailedFusing("print-failed-fuse-candidates", cl::desc("Print instructions that the allocator wants to"" fuse, but the X86 backend currently can't"), cl::Hidden) [static]

cl::opt<bool> ReMatPICStubLoad("remat-pic-stub-load", cl::desc("Re-materialize load from stub in PIC mode"), cl::init(false), cl::Hidden) [static]