LLVM  10.0.0svn
Macros | Functions | Variables
X86ISelDAGToDAG.cpp File Reference
#include "X86.h"
#include "X86MachineFunctionInfo.h"
#include "X86RegisterInfo.h"
#include "X86Subtarget.h"
#include "X86TargetMachine.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include <stdint.h>
#include "X86GenDAGISel.inc"
Include dependency graph for X86ISelDAGToDAG.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "x86-isel"
 

Functions

 STATISTIC (NumLoadMoved, "Number of loads moved below TokenFactor")
 
static bool isLegalMaskCompare (SDNode *N, const X86Subtarget *Subtarget)
 
static void moveBelowOrigChain (SelectionDAG *CurDAG, SDValue Load, SDValue Call, SDValue OrigChain)
 Replace the original chain operand of the call with load's chain operand and move load below the call's chain operand. More...
 
static bool isCalleeLoad (SDValue Callee, SDValue &Chain, bool HasCallSeq)
 Return true if call address is a load and it can be moved below CALLSEQ_START and the chains leading up to the call. More...
 
static bool isDispSafeForFrameIndex (int64_t Val)
 
static void insertDAGNode (SelectionDAG &DAG, SDValue Pos, SDValue N)
 
static bool foldMaskAndShiftToExtract (SelectionDAG &DAG, SDValue N, uint64_t Mask, SDValue Shift, SDValue X, X86ISelAddressMode &AM)
 
static bool foldMaskedShiftToScaledMask (SelectionDAG &DAG, SDValue N, X86ISelAddressMode &AM)
 
static bool foldMaskAndShiftToScale (SelectionDAG &DAG, SDValue N, uint64_t Mask, SDValue Shift, SDValue X, X86ISelAddressMode &AM)
 
static bool foldMaskedShiftToBEXTR (SelectionDAG &DAG, SDValue N, uint64_t Mask, SDValue Shift, SDValue X, X86ISelAddressMode &AM, const X86Subtarget &Subtarget)
 
static bool hasSingleUsesFromRoot (SDNode *Root, SDNode *User)
 
static X86::CondCode getCondFromNode (SDNode *N)
 
static bool mayUseCarryFlag (X86::CondCode CC)
 
static bool isFusableLoadOpStorePattern (StoreSDNode *StoreNode, SDValue StoredVal, SelectionDAG *CurDAG, unsigned LoadOpNo, LoadSDNode *&LoadNode, SDValue &InputChain)
 Check whether or not the chain ending in StoreNode is suitable for doing the {load; op; store} to modify transformation. More...
 
static unsigned getVPTESTMOpc (MVT TestVT, bool IsTestN, bool FoldedLoad, bool FoldedBCast, bool Masked)
 

Variables

static cl::opt< boolAndImmShrink ("x86-and-imm-shrink", cl::init(true), cl::desc("Enable setting constant bits to reduce size of mask immediates"), cl::Hidden)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-isel"

Definition at line 39 of file X86ISelDAGToDAG.cpp.

Function Documentation

◆ foldMaskAndShiftToExtract()

static bool foldMaskAndShiftToExtract ( SelectionDAG DAG,
SDValue  N,
uint64_t  Mask,
SDValue  Shift,
SDValue  X,
X86ISelAddressMode &  AM 
)
static

◆ foldMaskAndShiftToScale()

static bool foldMaskAndShiftToScale ( SelectionDAG DAG,
SDValue  N,
uint64_t  Mask,
SDValue  Shift,
SDValue  X,
X86ISelAddressMode &  AM 
)
static

◆ foldMaskedShiftToBEXTR()

static bool foldMaskedShiftToBEXTR ( SelectionDAG DAG,
SDValue  N,
uint64_t  Mask,
SDValue  Shift,
SDValue  X,
X86ISelAddressMode &  AM,
const X86Subtarget Subtarget 
)
static

Definition at line 1783 of file X86ISelDAGToDAG.cpp.

References llvm::ISD::ADD, llvm::ISD::AND, llvm::ISD::ANY_EXTEND, assert(), llvm::ISD::Constant, llvm::ISD::CopyFromReg, llvm::countTrailingZeros(), llvm::dbgs(), llvm::dyn_cast(), llvm::X86ISD::EH_SJLJ_LONGJMP, llvm::X86ISD::EH_SJLJ_SETJMP, llvm::X86ISD::ENQCMD, llvm::X86ISD::ENQCMDS, foldMaskAndShiftToExtract(), foldMaskAndShiftToScale(), foldMaskedShiftToScaledMask(), llvm::ISD::FrameIndex, llvm::SelectionDAG::getConstant(), llvm::SDValue::getConstantOperandVal(), llvm::APInt::getHighBitsSet(), llvm::SDValue::getNode(), llvm::SelectionDAG::getNode(), llvm::SDValue::getOpcode(), llvm::SDNode::getOpcode(), llvm::SDValue::getOperand(), llvm::SDValue::getResNo(), llvm::ConstantSDNode::getSExtValue(), llvm::SDValue::getSimpleValueType(), llvm::MVT::getSizeInBits(), llvm::HandleSDNode::getValue(), llvm::SDValue::getValueSizeInBits(), llvm::SDValue::getValueType(), llvm::X86Subtarget::hasBMI(), llvm::X86Subtarget::hasFastBEXTR(), llvm::SDValue::hasOneUse(), llvm::SDNode::hasOneUse(), llvm::X86Subtarget::hasTBM(), llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i8, insertDAGNode(), llvm::ISD::INTRINSIC_VOID, llvm::ISD::INTRINSIC_W_CHAIN, isDispSafeForFrameIndex(), llvm::isShiftedMask_64(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm::ISD::LOAD, llvm::ISD::LOCAL_RECOVER, llvm::ISD::MUL, llvm::X86ISD::MUL_IMM, N, llvm::ISD::OR, Reg, llvm::SelectionDAG::RemoveDeadNode(), llvm::SelectionDAG::ReplaceAllUsesWith(), llvm::ISD::SHL, llvm::ISD::SMUL_LOHI, llvm::ISD::SRL, llvm::ISD::SUB, llvm::X86ISD::TLSCALL, llvm::ISD::TRUNCATE, llvm::ISD::UMUL_LOHI, llvm::X86ISD::Wrapper, llvm::X86ISD::WrapperRIP, X, and llvm::ISD::ZERO_EXTEND.

◆ foldMaskedShiftToScaledMask()

static bool foldMaskedShiftToScaledMask ( SelectionDAG DAG,
SDValue  N,
X86ISelAddressMode &  AM 
)
static

◆ getCondFromNode()

static X86::CondCode getCondFromNode ( SDNode N)
static

◆ getVPTESTMOpc()

static unsigned getVPTESTMOpc ( MVT  TestVT,
bool  IsTestN,
bool  FoldedLoad,
bool  FoldedBCast,
bool  Masked 
)
static

Definition at line 3895 of file X86ISelDAGToDAG.cpp.

References llvm::ISD::ADD, llvm::AArch64CC::AL, llvm::ISD::AND, AndImmShrink, assert(), llvm::X86ISD::BEXTR, llvm::ISD::BITCAST, llvm::X86ISD::BLENDV, llvm::ISD::BRIND, C, llvm::X86ISD::CMP, llvm::InlineAsm::Constraint_i, llvm::InlineAsm::Constraint_m, llvm::InlineAsm::Constraint_o, llvm::InlineAsm::Constraint_v, llvm::InlineAsm::Constraint_X, llvm::countLeadingZeros(), llvm::countTrailingZeros(), llvm::dbgs(), llvm::SDNode::dump(), llvm::dyn_cast(), llvm::N86::EAX, llvm::N86::ECX, llvm::N86::EDX, llvm::MVT::f128, llvm::ISD::FCEIL, llvm::ISD::FFLOOR, llvm::ISD::FNEARBYINT, llvm::ISD::FRINT, llvm::ISD::FTRUNC, llvm::SDNode::getConstantOperandVal(), llvm::SDValue::getNode(), llvm::SDValue::getOpcode(), llvm::SDNode::getOpcode(), llvm::SDValue::getOperand(), llvm::SDNode::getOperand(), llvm::ConstantSDNode::getSExtValue(), llvm::SDValue::getSimpleValueType(), llvm::SDNode::getSimpleValueType(), llvm::SDValue::getValue(), llvm::SDValue::getValueType(), llvm::SDNode::getValueType(), llvm::EVT::getVectorElementType(), llvm::MVT::getVectorElementType(), llvm::MVT::getVectorNumElements(), llvm::MVT::getVectorVT(), llvm::ConstantSDNode::getZExtValue(), llvm::X86ISD::GlobalBaseReg, llvm::MVT::Glue, llvm::SDValue::hasOneUse(), llvm::SDNode::hasOneUse(), llvm::MVT::i1, llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i64, llvm::MVT::i8, llvm::ISD::INTRINSIC_VOID, llvm::MVT::is128BitVector(), llvm::MVT::is256BitVector(), llvm::MVT::is512BitVector(), llvm::ISD::isBuildVectorAllZeros(), llvm::isInt< 32 >(), llvm::isInt< 8 >(), llvm::SDNode::isMachineOpcode(), llvm::isMask_64(), IsMasked(), llvm::isNullConstant(), llvm::isUInt< 16 >(), llvm::isUInt< 32 >(), llvm::isUInt< 8 >(), llvm::MVT::isVector(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm_unreachable, llvm::SPII::Load, llvm::ISD::OR, llvm::MVT::Other, llvm::X86ISD::PCMPESTR, llvm::X86ISD::PCMPISTR, Reg, llvm::ISD::SDIVREM, llvm::MCID::Select, llvm::ISD::SETCC, llvm::ISD::SETEQ, llvm::ISD::SETNE, llvm::SDNode::setNodeId(), llvm::ISD::SHL, llvm::MVT::SimpleTy, llvm::X86ISD::SMUL, llvm::ISD::SMUL_LOHI, llvm::ISD::SRA, llvm::ISD::SRL, llvm::ISD::STORE, llvm::ISD::SUB, SubReg, std::swap(), llvm::ISD::TRUNCATE, llvm::ISD::UDIVREM, llvm::X86ISD::UMUL, llvm::ISD::UMUL_LOHI, llvm::SDValue::use_empty(), llvm::MVT::v16i1, llvm::MVT::v16i16, llvm::MVT::v16i32, llvm::MVT::v16i8, llvm::MVT::v2i1, llvm::MVT::v2i64, llvm::MVT::v32i1, llvm::MVT::v32i16, llvm::MVT::v32i8, llvm::MVT::v4i1, llvm::MVT::v4i32, llvm::MVT::v4i64, llvm::MVT::v64i1, llvm::MVT::v64i8, llvm::MVT::v8i1, llvm::MVT::v8i16, llvm::MVT::v8i32, llvm::MVT::v8i64, llvm::X86ISD::VBROADCAST, llvm::X86ISD::VRNDSCALE, llvm::ISD::VSELECT, Widen(), and llvm::ISD::XOR.

◆ hasSingleUsesFromRoot()

static bool hasSingleUsesFromRoot ( SDNode Root,
SDNode User 
)
static

◆ insertDAGNode()

static void insertDAGNode ( SelectionDAG DAG,
SDValue  Pos,
SDValue  N 
)
static

◆ isCalleeLoad()

static bool isCalleeLoad ( SDValue  Callee,
SDValue Chain,
bool  HasCallSeq 
)
static

Return true if call address is a load and it can be moved below CALLSEQ_START and the chains leading up to the call.

Return the CALLSEQ_START by reference as a second output. In the case of a tail call, there isn't a callseq node between the call chain and the load.

Definition at line 746 of file X86ISelDAGToDAG.cpp.

References llvm::X86ISD::AND, llvm::ISD::AND, llvm::X86ISD::ANDNP, llvm::ISD::ANY_EXTEND, llvm::ISD::ANY_EXTEND_VECTOR_INREG, llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::ISD::BITCAST, llvm::CallingConv::C, llvm::X86ISD::CALL, llvm::ISD::CALLSEQ_START, llvm::EVT::changeVectorElementTypeToInteger(), llvm::X86ISD::CVTTP2SI, llvm::X86ISD::CVTTP2UI, llvm::dyn_cast(), E, llvm::X86II::EncodingMask, llvm::X86II::EVEX, llvm::ISD::EXTLOAD, llvm::ISD::EXTRACT_VECTOR_ELT, F(), llvm::MVT::f128, llvm::MVT::f64, llvm::X86ISD::FAND, llvm::X86ISD::FANDN, llvm::ISD::FCEIL, llvm::ISD::FFLOOR, llvm::ISD::FNEARBYINT, llvm::X86ISD::FOR, llvm::ISD::FP_EXTEND, llvm::ISD::FP_ROUND, llvm::ISD::FP_TO_SINT, llvm::ISD::FP_TO_UINT, llvm::ISD::FRINT, llvm::ISD::FTRUNC, llvm::X86ISD::FXOR, llvm::LSBaseSDNode::getAddressingMode(), llvm::SDValue::getConstantOperandVal(), llvm::SDNode::getConstantOperandVal(), llvm::LoadSDNode::getExtensionType(), llvm::MachineFunction::getFunction(), llvm::SDValue::getMachineOpcode(), llvm::SDNode::getMachineOpcode(), llvm::Value::getName(), llvm::SDValue::getNode(), llvm::SDValue::getNumOperands(), llvm::SDValue::getOpcode(), llvm::SDNode::getOpcode(), llvm::SDValue::getOperand(), llvm::SDNode::getOperand(), llvm::SDValue::getScalarValueSizeInBits(), llvm::SDValue::getSimpleValueType(), llvm::SDNode::getSimpleValueType(), llvm::SDValue::getValue(), llvm::SDNode::getValueType(), llvm::Type::getVoidTy(), llvm::SDNode::hasAnyUseOfValue(), llvm::GlobalValue::hasExternalLinkage(), llvm::SDValue::hasOneUse(), I, llvm::MVT::i32, llvm::MVT::i64, llvm::MVT::i8, llvm::tgtok::In, llvm::SDValue::isMachineOpcode(), llvm::SDNode::isMachineOpcode(), llvm::SDNode::isOnlyUserOf(), llvm::SDValue::isOperandOf(), llvm::X86TargetLowering::isScalarFPTypeInSSEReg(), llvm::MemSDNode::isSimple(), llvm::EVT::isVector(), llvm::MVT::isVector(), llvm::ARM_MB::LD, llvm_unreachable, llvm::SPII::Load, llvm::TargetLowering::LowerCallTo(), moveBelowOrigChain(), llvm::ISD::NON_EXTLOAD, llvm::CodeGenOpt::None, llvm::ISD::OR, llvm::MVT::Other, llvm::ISD::SCALAR_TO_VECTOR, llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::ISD::SHL, llvm::ISD::SRA, llvm::ISD::SRL, llvm::SPII::Store, llvm::ISD::STRICT_FP_EXTEND, llvm::ISD::STRICT_FP_ROUND, llvm::X86ISD::TC_RETURN, llvm::SystemZISD::TM, llvm::ISD::TokenFactor, llvm::ISD::UNINDEXED, llvm::SDNode::use_empty(), llvm::MVT::v2f64, llvm::MVT::v4f32, llvm::X86II::VEX, llvm::X86ISD::VRNDSCALE, llvm::X86ISD::VSHLV, llvm::X86ISD::VSRAV, llvm::X86ISD::VSRLV, llvm::X86II::XOP, llvm::ISD::XOR, llvm::ISD::ZERO_EXTEND, and llvm::ISD::ZERO_EXTEND_VECTOR_INREG.

◆ isDispSafeForFrameIndex()

static bool isDispSafeForFrameIndex ( int64_t  Val)
static

◆ isFusableLoadOpStorePattern()

static bool isFusableLoadOpStorePattern ( StoreSDNode StoreNode,
SDValue  StoredVal,
SelectionDAG CurDAG,
unsigned  LoadOpNo,
LoadSDNode *&  LoadNode,
SDValue InputChain 
)
static

◆ isLegalMaskCompare()

static bool isLegalMaskCompare ( SDNode N,
const X86Subtarget Subtarget 
)
static

◆ mayUseCarryFlag()

static bool mayUseCarryFlag ( X86::CondCode  CC)
static

◆ moveBelowOrigChain()

static void moveBelowOrigChain ( SelectionDAG CurDAG,
SDValue  Load,
SDValue  Call,
SDValue  OrigChain 
)
static

◆ STATISTIC()

STATISTIC ( NumLoadMoved  ,
"Number of loads moved below TokenFactor"   
)

Variable Documentation

◆ AndImmShrink

cl::opt<bool> AndImmShrink("x86-and-imm-shrink", cl::init(true), cl::desc("Enable setting constant bits to reduce size of mask immediates"), cl::Hidden)
static

Referenced by getVPTESTMOpc().