LLVM API Documentation
#include "X86InstrInfo.h"
#include "X86.h"
#include "X86InstrBuilder.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
#include "X86TargetMachine.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCInst.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOptions.h"
#include <limits>
#include "X86GenInstrInfo.inc"
Go to the source code of this file.
Classes | |
struct | X86OpTblEntry |
Macros | |
#define | GET_INSTRINFO_CTOR_DTOR |
Enumerations | |
enum | { TB_INDEX_0 = 0, TB_INDEX_1 = 1, TB_INDEX_2 = 2, TB_INDEX_3 = 3, TB_INDEX_MASK = 0xf, TB_NO_REVERSE = 1 << 4, TB_NO_FORWARD = 1 << 5, TB_FOLDED_LOAD = 1 << 6, TB_FOLDED_STORE = 1 << 7, TB_ALIGN_SHIFT = 8, TB_ALIGN_NONE = 0 << TB_ALIGN_SHIFT, TB_ALIGN_16 = 16 << TB_ALIGN_SHIFT, TB_ALIGN_32 = 32 << TB_ALIGN_SHIFT, TB_ALIGN_64 = 64 << TB_ALIGN_SHIFT, TB_ALIGN_MASK = 0xff << TB_ALIGN_SHIFT } |
Variables | |
static 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 const uint16_t | ReplaceableInstrs [][3] |
static const uint16_t | ReplaceableInstrsAVX2 [][3] |
#define GET_INSTRINFO_CTOR_DTOR |
Definition at line 39 of file X86InstrInfo.cpp.
anonymous enum |
Definition at line 57 of file X86InstrInfo.cpp.
Definition at line 3019 of file X86InstrInfo.cpp.
References llvm::get512BitSuperRegister().
Referenced by llvm::X86InstrInfo::copyPhysReg().
|
static |
Definition at line 2976 of file X86InstrInfo.cpp.
References llvm::X86Subtarget::hasAVX(), and llvm::X86Subtarget::hasAVX512().
Referenced by llvm::X86InstrInfo::copyPhysReg().
|
static |
Expand2AddrUndef - Expand a single-def pseudo instruction to a two-addr instruction with two undef reads of the register being defined. This is used for mapping: xmm4 = V_SET0 to: xmm4 = PXORrr xmm4<undef>, xmm4<undef>
Definition at line 3821 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineInstr::setDesc(), and llvm::RegState::Undef.
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 4201 of file X86InstrInfo.cpp.
References llvm::addOffset(), llvm::MachineInstrBuilder::addOperand(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineOperand::CreateFI(), llvm::MachineOperand::CreateImm(), llvm::MachineFunction::CreateMachineInstr(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::TargetInstrInfo::getStackSlotRange(), llvm::MachineOperand::getSubReg(), llvm::MachineFunction::getTarget(), llvm::PatchPointOpers::getVarIdx(), I, llvm::StackMaps::IndirectMemRefOp, llvm_unreachable, llvm::TargetOpcode::PATCHPOINT, llvm::report_fatal_error(), and llvm::TargetOpcode::STACKMAP.
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Definition at line 3899 of file X86InstrInfo.cpp.
References llvm::addOffset(), llvm::MachineInstrBuilder::addOperand(), llvm::MachineFunction::CreateMachineInstr(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::isReg(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Definition at line 3871 of file X86InstrInfo.cpp.
References llvm::addOffset(), llvm::MachineInstrBuilder::addOperand(), llvm::MachineFunction::CreateMachineInstr(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDesc(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
getCMovFromCond - Return a cmov opcode for the given condition, register size in bytes, and operand type.
Definition at line 2649 of file X86InstrInfo.cpp.
References llvm_unreachable.
Referenced by llvm::X86InstrInfo::insertSelect(), and llvm::X86InstrInfo::optimizeCompareInstr().
|
static |
Definition at line 2455 of file X86InstrInfo.cpp.
References llvm::X86::COND_A, llvm::X86::COND_AE, llvm::X86::COND_B, llvm::X86::COND_BE, llvm::X86::COND_E, llvm::X86::COND_G, llvm::X86::COND_GE, llvm::X86::COND_INVALID, llvm::X86::COND_L, llvm::X86::COND_LE, llvm::X86::COND_NE, llvm::X86::COND_NO, llvm::X86::COND_NP, llvm::X86::COND_NS, llvm::X86::COND_O, llvm::X86::COND_P, and llvm::X86::COND_S.
Referenced by llvm::X86InstrInfo::AnalyzeBranch(), llvm::X86InstrInfo::optimizeCompareInstr(), and llvm::X86InstrInfo::RemoveBranch().
|
static |
getCondFromSETOpc - return condition code of a SET opcode.
Definition at line 2478 of file X86InstrInfo.cpp.
References llvm::X86::COND_A, llvm::X86::COND_AE, llvm::X86::COND_B, llvm::X86::COND_BE, llvm::X86::COND_E, llvm::X86::COND_G, llvm::X86::COND_GE, llvm::X86::COND_INVALID, llvm::X86::COND_L, llvm::X86::COND_LE, llvm::X86::COND_NE, llvm::X86::COND_NO, llvm::X86::COND_NP, llvm::X86::COND_NS, llvm::X86::COND_O, llvm::X86::COND_P, and llvm::X86::COND_S.
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
|
static |
Definition at line 3208 of file X86InstrInfo.cpp.
References getLoadStoreRegOpcode().
Referenced by llvm::X86InstrInfo::loadRegFromAddr(), llvm::X86InstrInfo::loadRegFromStackSlot(), and llvm::X86InstrInfo::unfoldMemoryOperand().
|
static |
Definition at line 3113 of file X86InstrInfo.cpp.
References llvm::TargetRegisterClass::getSize(), llvm::TargetMachine::getSubtarget(), llvm::X86Subtarget::hasAVX512(), llvm::X86Subtarget::is64Bit(), isHReg(), and llvm_unreachable.
Referenced by getLoadRegOpcode(), and getStoreRegOpcode().
|
static |
getSETFromCond - Return a set opcode for the given condition and whether it has memory operand.
Definition at line 2622 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
|
static |
Definition at line 3200 of file X86InstrInfo.cpp.
References getLoadStoreRegOpcode().
Referenced by llvm::X86InstrInfo::storeRegToAddr(), llvm::X86InstrInfo::storeRegToStackSlot(), and llvm::X86InstrInfo::unfoldMemoryOperand().
|
static |
getSwappedCondition - assume the flags are set by MI(a,b), return the condition code if we modify the instructions such that flags are set by MI(b,a).
Definition at line 2604 of file X86InstrInfo.cpp.
References llvm::X86::COND_A, llvm::X86::COND_AE, llvm::X86::COND_B, llvm::X86::COND_BE, llvm::X86::COND_E, llvm::X86::COND_G, llvm::X86::COND_GE, llvm::X86::COND_INVALID, llvm::X86::COND_L, llvm::X86::COND_LE, and llvm::X86::COND_NE.
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
|
inlinestatic |
getTruncatedShiftCount - check whether the shift count for a machine operand is non-zero.
Definition at line 1831 of file X86InstrInfo.cpp.
References llvm::MachineInstr::getDesc(), llvm::MachineOperand::getImm(), llvm::MachineInstr::getOperand(), llvm::X86II::REX_W, and llvm::MCInstrDesc::TSFlags.
Referenced by llvm::X86InstrInfo::convertToThreeAddress(), and isDefConvertible().
|
static |
hasLiveCondCodeDef - True if MI has a condition code def, e.g. EFLAGS, that is not marked dead.
Definition at line 1818 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().
hasPartialRegUpdate - Return true for all instructions that only update the first 32 or 64-bits of the destination register and leave the rest unmodified. This can be used to avoid folding loads if the instructions only update part of the destination register, and the non-updated part is not needed. e.g. cvtss2sd, sqrtss. Unfolding the load from these instructions breaks the partial register dependency and it can improve performance. e.g.:
movss (rdi), xmm0 cvtss2sd xmm0, xmm0
Instead of cvtss2sd (rdi), xmm0
FIXME: This should be turned into a TSFlags.
Definition at line 4060 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl(), and llvm::X86InstrInfo::getPartialRegUpdateClearance().
Definition at line 4113 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::getUndefRegClearance().
|
inlinestatic |
isDefConvertible - check whether the definition can be converted to remove a comparison against zero.
Definition at line 3402 of file X86InstrInfo.cpp.
References llvm::MachineInstr::getOpcode(), getTruncatedShiftCount(), and isTruncatedShiftCountForLEA().
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
|
static |
Definition at line 1515 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::isLoadFromStackSlot(), and llvm::X86InstrInfo::isLoadFromStackSlotPostFE().
|
static |
Definition at line 1545 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::isStoreToStackSlot(), and llvm::X86InstrInfo::isStoreToStackSlotPostFE().
isHReg - Test if the given register is a physical h register.
Definition at line 2971 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::copyPhysReg(), and getLoadStoreRegOpcode().
|
inlinestatic |
isRedundantFlagInstr - check whether the first instruction, whose only purpose is to update flags, can be made redundant. CMPrr can be made redundant by SUBrr if the operands are the same. This function can be extended later on. SrcReg, SrcRegs: register operands for FlagI. ImmValue: immediate for FlagI if it takes an immediate.
Definition at line 3363 of file X86InstrInfo.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), and llvm::MachineOperand::getReg().
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
|
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 a few instructions in each direction it assumes it's not safe.
Definition at line 1717 of file X86InstrInfo.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineOperand::clobbersPhysReg(), llvm::MachineBasicBlock::end(), llvm::MachineOperand::getReg(), I, llvm::MachineOperand::isDead(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isKill(), llvm::MachineBasicBlock::isLiveIn(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isRegMask(), llvm::MachineOperand::isUse(), llvm::MachineBasicBlock::succ_begin(), and llvm::MachineBasicBlock::succ_end().
Referenced by llvm::X86InstrInfo::reMaterialize().
isTruncatedShiftCountForLEA - check whether the given shift count is appropriate can be represented by a LEA instruction.
Definition at line 1841 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::convertToThreeAddress(), and isDefConvertible().
Definition at line 5181 of file X86InstrInfo.cpp.
References llvm::array_lengthof(), and ReplaceableInstrs.
Referenced by llvm::X86InstrInfo::getExecutionDomain(), llvm::Module::getNamedMetadata(), and llvm::X86InstrInfo::setExecutionDomain().
Definition at line 5188 of file X86InstrInfo.cpp.
References llvm::array_lengthof(), and ReplaceableInstrsAVX2.
Referenced by llvm::X86InstrInfo::getExecutionDomain(), and llvm::X86InstrInfo::setExecutionDomain().
|
static |
Definition at line 3924 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::addOffset(), llvm::MachineInstrBuilder::addOperand(), llvm::BuildMI(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
regIsPICBase - Return true if register is PIC base (i.e.g defined by X86::MOVPC32r.
Definition at line 1619 of file X86InstrInfo.cpp.
References llvm::MachineRegisterInfo::def_begin(), llvm::MachineRegisterInfo::def_end(), llvm::MachineInstr::getOpcode(), I, and llvm::TargetRegisterInfo::isVirtualRegister().
Referenced by llvm::X86InstrInfo::isReallyTriviallyReMaterializable().
|
static |
|
static |
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Referenced by llvm::X86InstrInfo::isReallyTriviallyReMaterializable().
|
static |
Definition at line 5120 of file X86InstrInfo.cpp.
Referenced by lookup().
|
static |
Definition at line 5160 of file X86InstrInfo.cpp.
Referenced by lookupAVX2().