LLVM
8.0.1
|
#include "X86InstrInfo.h"
#include "X86.h"
#include "X86InstrBuilder.h"
#include "X86InstrFoldTables.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
#include "X86TargetMachine.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/CodeGen/LivePhysRegs.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/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.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 "X86GenInstrInfo.inc"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "x86-instr-info" |
#define | GET_INSTRINFO_CTOR_DTOR |
#define | VPERM_CASES(Suffix) |
#define | VPERM_CASES_BROADCAST(Suffix) |
#define | VPERM_CASES(Orig, New) |
#define | VPERM_CASES_BROADCAST(Orig, New) |
#define | GET_INSTRINFO_HELPERS |
Enumerations | |
enum | MachineOutlinerClass { MachineOutlinerDefault, MachineOutlinerTailCall, MachineOutlinerNoLRSave, MachineOutlinerThunk, MachineOutlinerRegSave, MachineOutlinerDefault, MachineOutlinerTailCall } |
Constants defining how certain sequences should be outlined. More... | |
Functions | |
static bool | isFrameLoadOpcode (int Opcode, unsigned &MemBytes) |
static bool | isFrameStoreOpcode (int Opcode, unsigned &MemBytes) |
static bool | regIsPICBase (unsigned BaseReg, const MachineRegisterInfo &MRI) |
Return true if register is PIC base; i.e.g defined by X86::MOVPC32r. More... | |
static unsigned | getTruncatedShiftCount (const MachineInstr &MI, unsigned ShiftAmtOperandIdx) |
Check whether the shift count for a machine operand is non-zero. More... | |
static bool | isTruncatedShiftCountForLEA (unsigned ShAmt) |
Check whether the given shift count is appropriate can be represented by a LEA instruction. More... | |
static unsigned | getThreeSrcCommuteCase (uint64_t TSFlags, unsigned SrcOpIdx1, unsigned SrcOpIdx2) |
This determines which of three possible cases of a three source commute the source indexes correspond to taking into account any mask operands. More... | |
static void | commuteVPTERNLOG (MachineInstr &MI, unsigned SrcOpIdx1, unsigned SrcOpIdx2) |
static bool | isCommutableVPERMV3Instruction (unsigned Opcode) |
static unsigned | getCommutedVPERMV3Opcode (unsigned Opcode) |
static X86::CondCode | getSwappedCondition (X86::CondCode CC) |
Assuming 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). More... | |
static MachineBasicBlock * | getFallThroughMBB (MachineBasicBlock *MBB, MachineBasicBlock *TBB) |
static bool | isHReg (unsigned Reg) |
Test if the given register is a physical h register. More... | |
static unsigned | CopyToFromAsymmetricReg (unsigned DestReg, unsigned SrcReg, const X86Subtarget &Subtarget) |
static unsigned | getLoadStoreRegOpcode (unsigned Reg, const TargetRegisterClass *RC, bool isStackAligned, const X86Subtarget &STI, bool load) |
static unsigned | getStoreRegOpcode (unsigned SrcReg, const TargetRegisterClass *RC, bool isStackAligned, const X86Subtarget &STI) |
static unsigned | getLoadRegOpcode (unsigned DestReg, const TargetRegisterClass *RC, bool isStackAligned, const X86Subtarget &STI) |
static bool | isRedundantFlagInstr (const MachineInstr &FlagI, unsigned SrcReg, unsigned SrcReg2, int ImmMask, int ImmValue, const MachineInstr &OI) |
Check whether the first instruction, whose only purpose is to update flags, can be made redundant. More... | |
static bool | isDefConvertible (const MachineInstr &MI, bool &NoSignFlag) |
Check whether the definition can be converted to remove a comparison against zero. More... | |
static X86::CondCode | isUseDefConvertible (const MachineInstr &MI) |
Check whether the use can be converted to remove a comparison against zero. More... | |
static bool | Expand2AddrUndef (MachineInstrBuilder &MIB, const MCInstrDesc &Desc) |
Expand a single-def pseudo instruction to a two-addr instruction with two undef reads of the register being defined. More... | |
static bool | Expand2AddrKreg (MachineInstrBuilder &MIB, const MCInstrDesc &Desc, unsigned Reg) |
Expand a single-def pseudo instruction to a two-addr instruction with two k0 reads. More... | |
static bool | expandMOV32r1 (MachineInstrBuilder &MIB, const TargetInstrInfo &TII, bool MinusOne) |
static bool | ExpandMOVImmSExti8 (MachineInstrBuilder &MIB, const TargetInstrInfo &TII, const X86Subtarget &Subtarget) |
static void | expandLoadStackGuard (MachineInstrBuilder &MIB, const TargetInstrInfo &TII) |
static bool | expandXorFP (MachineInstrBuilder &MIB, const TargetInstrInfo &TII) |
static bool | expandNOVLXLoad (MachineInstrBuilder &MIB, const TargetRegisterInfo *TRI, const MCInstrDesc &LoadDesc, const MCInstrDesc &BroadcastDesc, unsigned SubIdx) |
static bool | expandNOVLXStore (MachineInstrBuilder &MIB, const TargetRegisterInfo *TRI, const MCInstrDesc &StoreDesc, const MCInstrDesc &ExtractDesc, unsigned SubIdx) |
static bool | hasPartialRegUpdate (unsigned Opcode, const X86Subtarget &Subtarget) |
Return true for all instructions that only update the first 32 or 64-bits of the destination register and leave the rest unmodified. More... | |
static bool | hasUndefRegUpdate (unsigned Opcode) |
static void | addOperands (MachineInstrBuilder &MIB, ArrayRef< MachineOperand > MOs, int PtrOffset=0) |
static void | updateOperandRegConstraints (MachineFunction &MF, MachineInstr &NewMI, const TargetInstrInfo &TII) |
static MachineInstr * | FuseTwoAddrInst (MachineFunction &MF, unsigned Opcode, ArrayRef< MachineOperand > MOs, MachineBasicBlock::iterator InsertPt, MachineInstr &MI, const TargetInstrInfo &TII) |
static MachineInstr * | FuseInst (MachineFunction &MF, unsigned Opcode, unsigned OpNo, ArrayRef< MachineOperand > MOs, MachineBasicBlock::iterator InsertPt, MachineInstr &MI, const TargetInstrInfo &TII, int PtrOffset=0) |
static MachineInstr * | MakeM0Inst (const TargetInstrInfo &TII, unsigned Opcode, ArrayRef< MachineOperand > MOs, MachineBasicBlock::iterator InsertPt, MachineInstr &MI) |
static bool | shouldPreventUndefRegUpdateMemFold (MachineFunction &MF, MachineInstr &MI) |
static bool | isNonFoldablePartialRegisterLoad (const MachineInstr &LoadMI, const MachineInstr &UserMI, const MachineFunction &MF) |
Check if LoadMI is a partial register load that we can't fold into MI because the latter uses contents that wouldn't be defined in the folded version. More... | |
static SmallVector< MachineMemOperand *, 2 > | extractLoadMMOs (ArrayRef< MachineMemOperand *> MMOs, MachineFunction &MF) |
static SmallVector< MachineMemOperand *, 2 > | extractStoreMMOs (ArrayRef< MachineMemOperand *> MMOs, MachineFunction &MF) |
static const uint16_t * | lookup (unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table) |
static const uint16_t * | lookupAVX512 (unsigned opcode, unsigned domain, ArrayRef< uint16_t[4]> Table) |
static bool | AdjustBlendMask (unsigned OldMask, unsigned OldWidth, unsigned NewWidth, unsigned *pNewMask=nullptr) |
Variables | |
static cl::opt< bool > | NoFusing ("disable-spill-fusing", cl::desc("Disable fusing of spill code into instructions"), cl::Hidden) |
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 cl::opt< unsigned > | PartialRegUpdateClearance ("partial-reg-update-clearance", cl::desc("Clearance between two register writes " "for inserting XOR to avoid partial " "register update"), cl::init(64), cl::Hidden) |
static cl::opt< unsigned > | UndefRegClearance ("undef-reg-clearance", cl::desc("How many idle instructions we would like before " "certain undef register reads"), cl::init(128), cl::Hidden) |
static const uint16_t | ReplaceableInstrs [][3] |
static const uint16_t | ReplaceableInstrsAVX2 [][3] |
static const uint16_t | ReplaceableInstrsAVX2InsertExtract [][3] |
static const uint16_t | ReplaceableInstrsAVX512 [][4] |
static const uint16_t | ReplaceableInstrsAVX512DQ [][4] |
static const uint16_t | ReplaceableInstrsAVX512DQMasked [][4] |
static const uint16_t | ReplaceableCustomInstrs [][3] |
static const uint16_t | ReplaceableCustomAVX2Instrs [][3] |
static const uint16_t | ReplaceableCustomAVX512LogicInstrs [][4] |
#define DEBUG_TYPE "x86-instr-info" |
Definition at line 46 of file X86InstrInfo.cpp.
#define GET_INSTRINFO_CTOR_DTOR |
Definition at line 48 of file X86InstrInfo.cpp.
#define GET_INSTRINFO_HELPERS |
Definition at line 7812 of file X86InstrInfo.cpp.
#define VPERM_CASES | ( | Suffix | ) |
Referenced by getCommutedVPERMV3Opcode(), and isCommutableVPERMV3Instruction().
#define VPERM_CASES | ( | Orig, | |
New | |||
) |
#define VPERM_CASES_BROADCAST | ( | Suffix | ) |
Referenced by getCommutedVPERMV3Opcode(), and isCommutableVPERMV3Instruction().
#define VPERM_CASES_BROADCAST | ( | Orig, | |
New | |||
) |
enum MachineOutlinerClass |
Constants defining how certain sequences should be outlined.
MachineOutlinerDefault
implies that the function is called with a call instruction, and a return must be emitted for the outlined function frame.
That is,
I1 OUTLINED_FUNCTION: I2 –> call OUTLINED_FUNCTION I1 I3 I2 I3 ret
MachineOutlinerTailCall
implies that the function is being tail called. A jump is emitted instead of a call, and the return is already present in the outlined sequence. That is,
I1 OUTLINED_FUNCTION: I2 –> jmp OUTLINED_FUNCTION I1 ret I2 ret
Definition at line 7658 of file X86InstrInfo.cpp.
|
static |
Definition at line 4624 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addDisp(), llvm::addOffset(), assert(), and llvm::ArrayRef< T >::size().
Referenced by FuseInst(), FuseTwoAddrInst(), and MakeM0Inst().
|
static |
Definition at line 6432 of file X86InstrInfo.cpp.
References assert().
Referenced by llvm::X86InstrInfo::getExecutionDomainCustom(), and llvm::X86InstrInfo::setExecutionDomainCustom().
|
static |
Definition at line 1363 of file X86InstrInfo.cpp.
References assert(), llvm::MachineInstr::getDesc(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), getThreeSrcCommuteCase(), and llvm::MCInstrDesc::TSFlags.
Referenced by llvm::X86InstrInfo::commuteInstructionImpl().
|
static |
Definition at line 2930 of file X86InstrInfo.cpp.
References assert(), contains(), llvm::X86Subtarget::hasAVX(), llvm::X86Subtarget::hasAVX512(), and llvm::X86Subtarget::hasBWI().
Referenced by llvm::X86InstrInfo::copyPhysReg().
|
static |
Expand a single-def pseudo instruction to a two-addr instruction with two k0 reads.
This is used for mapping: k4 = K_SET1 to: k4 = KXNORrr k0, k0
Definition at line 3966 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::setDesc(), and llvm::RegState::Undef.
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
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 undef xmm4, undef xmm4
Definition at line 3945 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), Reg, llvm::MachineInstr::setDesc(), and llvm::RegState::Undef.
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 4050 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addGlobalAddress(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachinePointerInfo::getGOT(), llvm::MachineInstrBuilder::getInstr(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), I, llvm::RegState::Kill, llvm::MachineInstr::memoperands_begin(), llvm::X86II::MO_GOTPCREL, llvm::MachineMemOperand::MODereferenceable, llvm::MachineMemOperand::MOInvariant, llvm::MachineMemOperand::MOLoad, Reg, llvm::MachineInstr::setDebugLoc(), and llvm::MachineInstr::setDesc().
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 3974 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstrBuilder::getInstr(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), Reg, llvm::MachineInstr::setDesc(), and llvm::RegState::Undef.
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 3992 of file X86InstrInfo.cpp.
References assert(), llvm::X86FrameLowering::BuildCFI(), llvm::BuildMI(), llvm::MCCFIInstruction::createAdjustCfaOffset(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::X86Subtarget::getFrameLowering(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getImm(), llvm::MachineFunction::getInfo(), llvm::MachineInstrBuilder::getInstr(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getMMI(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getTarget(), llvm::getX86SubSuperRegister(), llvm::MachineModuleInfo::hasDebugInfo(), llvm::X86FrameLowering::hasFP(), I, llvm::X86Subtarget::is64Bit(), llvm::Function::needsUnwindTableEntry(), llvm::MachineInstr::setDesc(), llvm::MachineOperand::setReg(), llvm::ARM::WinEH::StackAdjustment(), and llvm::MCAsmInfo::usesWindowsCFI().
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 4087 of file X86InstrInfo.cpp.
References llvm::MCRegisterInfo::getEncodingValue(), llvm::TargetRegisterInfo::getMatchingSuperReg(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineInstr::setDesc(), and llvm::MachineOperand::setReg().
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 4110 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::X86::AddrNumOperands, llvm::MCRegisterInfo::getEncodingValue(), llvm::TargetRegisterInfo::getMatchingSuperReg(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineInstr::setDesc(), and llvm::MachineOperand::setReg().
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 4072 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getOpcode(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::X86Subtarget::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineInstr::setDesc(), TRI, and llvm::RegState::Undef.
Referenced by llvm::X86InstrInfo::expandPostRAPseudo().
|
static |
Definition at line 5349 of file X86InstrInfo.cpp.
References llvm::MachineFunction::getMachineMemOperand(), llvm::MachineMemOperand::getSize(), and llvm::SmallVectorTemplateBase< T >::push_back().
Referenced by llvm::X86InstrInfo::unfoldMemoryOperand().
|
static |
Definition at line 5373 of file X86InstrInfo.cpp.
References llvm::MachineFunction::getMachineMemOperand(), llvm::MachineMemOperand::getSize(), and llvm::SmallVectorTemplateBase< T >::push_back().
Referenced by llvm::X86InstrInfo::unfoldMemoryOperand().
|
static |
Definition at line 4705 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::add(), addOperands(), assert(), llvm::MachineFunction::CreateMachineInstr(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::insert(), llvm::MachineOperand::isReg(), and updateOperandRegConstraints().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl(), and MakeM0Inst().
|
static |
Definition at line 4674 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::add(), addOperands(), llvm::MachineFunction::CreateMachineInstr(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDesc(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::insert(), and updateOperandRegConstraints().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
Definition at line 1431 of file X86InstrInfo.cpp.
References llvm_unreachable, VPERM_CASES, and VPERM_CASES_BROADCAST.
Referenced by llvm::X86InstrInfo::commuteInstructionImpl().
|
static |
Definition at line 2527 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addMBB(), assert(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::SmallVectorImpl< T >::clear(), llvm::X86::COND_E, llvm::X86::COND_E_AND_NP, llvm::X86::COND_INVALID, llvm::X86::COND_NE, llvm::X86::COND_NE_OR_P, llvm::X86::COND_NP, llvm::X86::COND_P, llvm::MachineOperand::CreateImm(), llvm::SmallVectorBase::empty(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::findDebugLoc(), GetCondBranchFromCond(), llvm::X86::getCondFromBranchOpc(), GetOppositeBranchCondition(), I, llvm::MachineBasicBlock::isLayoutSuccessor(), llvm::X86InstrInfo::isUnpredicatedTerminator(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), SI, llvm::SmallVectorBase::size(), llvm::MachineBasicBlock::succ_begin(), and llvm::MachineBasicBlock::succ_end().
Referenced by llvm::X86InstrInfo::insertBranch().
|
static |
Definition at line 3263 of file X86InstrInfo.cpp.
References getLoadStoreRegOpcode().
Referenced by llvm::X86InstrInfo::loadRegFromAddr(), llvm::X86InstrInfo::loadRegFromStackSlot(), and llvm::X86InstrInfo::unfoldMemoryOperand().
|
static |
Definition at line 3102 of file X86InstrInfo.cpp.
References assert(), llvm::X86Subtarget::getRegisterInfo(), llvm::X86Subtarget::hasAVX(), llvm::X86Subtarget::hasAVX512(), llvm::X86Subtarget::hasBWI(), llvm::X86Subtarget::hasVLX(), llvm::X86Subtarget::is64Bit(), isHReg(), and llvm_unreachable.
Referenced by getLoadRegOpcode(), and getStoreRegOpcode().
|
static |
Definition at line 3255 of file X86InstrInfo.cpp.
References getLoadStoreRegOpcode().
Referenced by llvm::X86InstrInfo::storeRegToAddr(), llvm::X86InstrInfo::storeRegToStackSlot(), and llvm::X86InstrInfo::unfoldMemoryOperand().
|
static |
Assuming 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 2242 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().
|
static |
This determines which of three possible cases of a three source commute the source indexes correspond to taking into account any mask operands.
All prevents commuting a passthru operand. Returns -1 if the commute isn't possible. Case 0 - Possible to commute the first and second operands. Case 1 - Possible to commute the first and third operands. Case 2 - Possible to commute the second and third operands.
Definition at line 1284 of file X86InstrInfo.cpp.
References llvm::X86II::isKMasked(), llvm_unreachable, and std::swap().
Referenced by commuteVPTERNLOG(), and llvm::X86InstrInfo::getFMA3OpcodeToCommuteOperands().
|
inlinestatic |
Check whether the shift count for a machine operand is non-zero.
Definition at line 721 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 |
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 4305 of file X86InstrInfo.cpp.
References llvm::X86Subtarget::hasLZCNTFalseDeps(), and llvm::X86Subtarget::hasPOPCNTFalseDeps().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl(), and llvm::X86InstrInfo::getPartialRegUpdateClearance().
Definition at line 4392 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::getUndefRegClearance(), and shouldPreventUndefRegUpdateMemFold().
Definition at line 1391 of file X86InstrInfo.cpp.
References B, D, llvm::X86II::PD, VPERM_CASES, VPERM_CASES_BROADCAST, and llvm::RISCVFenceField::W.
Referenced by llvm::X86InstrInfo::commuteInstructionImpl().
|
inlinestatic |
Check whether the definition can be converted to remove a comparison against zero.
Definition at line 3458 of file X86InstrInfo.cpp.
References llvm::MachineInstr::getOpcode(), getTruncatedShiftCount(), and isTruncatedShiftCountForLEA().
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
Definition at line 209 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::isLoadFromStackSlot(), and llvm::X86InstrInfo::isLoadFromStackSlotPostFE().
Definition at line 299 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::isStoreToStackSlot(), and llvm::X86InstrInfo::isStoreToStackSlotPostFE().
Test if the given register is a physical h register.
Definition at line 2925 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::copyPhysReg(), and getLoadStoreRegOpcode().
|
static |
Check if LoadMI
is a partial register load that we can't fold into MI
because the latter uses contents that wouldn't be defined in the folded version.
For instance, this transformation isn't legal: movss (rdi), xmm0 addps xmm0, xmm0 -> addps (rdi), xmm0
But this one is: movss (rdi), xmm0 addss xmm0, xmm0 -> addss (rdi), xmm0
Definition at line 5066 of file X86InstrInfo.cpp.
References llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetRegisterInfo::getRegSizeInBits(), llvm::MachineFunction::getSubtarget(), and TRI.
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
inlinestatic |
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 3424 of file X86InstrInfo.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), and llvm::MachineOperand::getReg().
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
Check whether the given shift count is appropriate can be represented by a LEA instruction.
Definition at line 731 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::convertToThreeAddress(), and isDefConvertible().
|
static |
Check whether the use can be converted to remove a comparison against zero.
Definition at line 3572 of file X86InstrInfo.cpp.
References llvm::X86::COND_B, llvm::X86::COND_E, llvm::X86::COND_INVALID, and llvm::MachineInstr::getOpcode().
Referenced by llvm::X86InstrInfo::optimizeCompareInstr().
|
static |
Definition at line 6414 of file X86InstrInfo.cpp.
Referenced by llvm::GVNExpression::Expression::dump(), llvm::orc::RemoteObjectClientLayer< RPCEndpoint >::emitAndFinalize(), llvm::MDGlobalAttachmentMap::empty(), llvm::DwarfCompileUnit::finishSubprogramDefinition(), llvm::DWARFDebugNames::Entry::getAbbrev(), llvm::DWARFDebugNames::Entry::getCUIndex(), llvm::AppleAcceleratorTable::Entry::getCUOffset(), llvm::AppleAcceleratorTable::Entry::getDIESectionOffset(), llvm::DWARFDebugNames::Entry::getDIEUnitOffset(), llvm::X86InstrInfo::getExecutionDomain(), llvm::Module::getNamedMetadata(), llvm::AMDGPULibFunc::getOrInsertFunction(), llvm::AppleAcceleratorTable::Entry::getTag(), llvm::isAtLeastOrStrongerThan(), isDebug(), llvm::isStrongerThan(), llvm::AMDGPUUnmangledLibFunc::parseFuncName(), llvm::GVN::ValueTable::phiTranslate(), llvm::orc::RemoteObjectClientLayer< RPCEndpoint >::RemoteObjectClientLayer(), llvm::orc::RemoteObjectServerLayer< BaseLayerT, RPCEndpoint >::RemoteObjectServerLayer(), llvm::X86InstrInfo::setExecutionDomain(), llvm::X86InstrInfo::setExecutionDomainCustom(), llvm::MDAttachmentMap::size(), and llvm::toCABI().
|
static |
Definition at line 6422 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::getExecutionDomain(), llvm::X86InstrInfo::setExecutionDomain(), and llvm::X86InstrInfo::setExecutionDomainCustom().
|
static |
Definition at line 4733 of file X86InstrInfo.cpp.
References llvm::MachineInstrBuilder::addImm(), addOperands(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::BuildMI(), FuseInst(), llvm::MCInstrInfo::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDesc(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), getRegClass(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetRegisterInfo::getRegSizeInBits(), llvm::MachineFunction::getSubtarget(), Size, and TRI.
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Return true if register is PIC base; i.e.g defined by X86::MOVPC32r.
Definition at line 461 of file X86InstrInfo.cpp.
References assert(), llvm::MachineRegisterInfo::def_instr_begin(), llvm::MachineRegisterInfo::def_instr_end(), DefMI, E, llvm::MachineInstr::getOpcode(), I, and llvm::TargetRegisterInfo::isVirtualRegister().
Referenced by llvm::X86InstrInfo::isReallyTriviallyReMaterializable().
|
static |
Definition at line 4802 of file X86InstrInfo.cpp.
References llvm::MachineFunction::getFunction(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::getUniqueVRegDef(), hasUndefRegUpdate(), llvm::MachineInstr::isImplicitDef(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isUndef(), and llvm::Function::optForSize().
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Definition at line 4648 of file X86InstrInfo.cpp.
References llvm::MachineRegisterInfo::constrainRegClass(), llvm::dbgs(), llvm::MachineInstr::dump(), llvm::MachineInstr::getDesc(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::TargetInstrInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::getTargetRegisterInfo(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, MRI, Reg, and TRI.
Referenced by FuseInst(), and FuseTwoAddrInst().
|
static |
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Referenced by llvm::X86InstrInfo::getPartialRegUpdateClearance().
|
static |
Referenced by llvm::X86InstrInfo::foldMemoryOperandImpl().
|
static |
Referenced by llvm::X86InstrInfo::isReallyTriviallyReMaterializable().
|
static |
Definition at line 6380 of file X86InstrInfo.cpp.
|
static |
Definition at line 6390 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomainCustom().
|
static |
Definition at line 6371 of file X86InstrInfo.cpp.
|
static |
Definition at line 5935 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomain().
|
static |
Definition at line 6098 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomain().
|
static |
Definition at line 6131 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomain().
|
static |
Definition at line 6139 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomain().
|
static |
Definition at line 6159 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomain().
|
static |
Definition at line 6188 of file X86InstrInfo.cpp.
Referenced by llvm::X86InstrInfo::setExecutionDomain().
|
static |
Referenced by llvm::X86InstrInfo::getUndefRegClearance().