LLVM  6.0.0svn
Macros | Functions
X86ISelDAGToDAG.cpp File Reference
#include "X86.h"
#include "X86InstrBuilder.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/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAGISel.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, uint64_t Mask, SDValue Shift, SDValue X, X86ISelAddressMode &AM)
 
static bool foldMaskAndShiftToScale (SelectionDAG &DAG, SDValue N, uint64_t Mask, SDValue Shift, SDValue X, X86ISelAddressMode &AM)
 
static bool hasSingleUsesFromRoot (SDNode *Root, SDNode *N)
 
static bool hasNoSignedComparisonUses (SDNode *N)
 Test whether the given X86ISD::CMP node has any uses which require the SF or OF bits to be accurate. More...
 
static bool hasNoCarryFlagUses (SDNode *N)
 Test whether the given node which sets flags has any uses which require the CF flag to be accurate. More...
 
static bool isFusableLoadOpStorePattern (StoreSDNode *StoreNode, SDValue StoredVal, SelectionDAG *CurDAG, 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...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-isel"

Definition at line 42 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

Definition at line 1109 of file X86ISelDAGToDAG.cpp.

References llvm::ISD::ADD, llvm::ISD::AND, llvm::ISD::ANY_EXTEND, assert(), llvm::SelectionDAG::computeKnownBits(), llvm::ISD::Constant, llvm::ISD::CopyFromReg, llvm::countLeadingZeros(), llvm::countTrailingOnes(), llvm::countTrailingZeros(), llvm::dbgs(), DEBUG, llvm::ISD::DELETED_NODE, llvm::X86ISD::EH_SJLJ_LONGJMP, llvm::X86ISD::EH_SJLJ_SETJMP, foldMaskAndShiftToExtract(), 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::getValueType(), llvm::SDValue::hasOneUse(), llvm::SDNode::hasOneUse(), llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i8, insertDAGNode(), llvm::ISD::INTRINSIC_VOID, llvm::ISD::INTRINSIC_W_CHAIN, isDispSafeForFrameIndex(), LLVM_FALLTHROUGH, llvm::ISD::LOAD, llvm::ISD::LOCAL_RECOVER, llvm::BitmaskEnumDetail::Mask(), llvm::ISD::MUL, llvm::X86ISD::MUL_IMM, N, llvm::ISD::OR, 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,
uint64_t  Mask,
SDValue  Shift,
SDValue  X,
X86ISelAddressMode &  AM 
)
static

◆ hasNoCarryFlagUses()

static bool hasNoCarryFlagUses ( SDNode N)
static

Test whether the given node which sets flags has any uses which require the CF flag to be accurate.

Definition at line 1990 of file X86ISelDAGToDAG.cpp.

References llvm::ISD::CopyToReg, getReg(), llvm::SDNode::use_begin(), and llvm::SDNode::use_end().

Referenced by isFusableLoadOpStorePattern().

◆ hasNoSignedComparisonUses()

static bool hasNoSignedComparisonUses ( SDNode N)
static

Test whether the given X86ISD::CMP node has any uses which require the SF or OF bits to be accurate.

Definition at line 1928 of file X86ISelDAGToDAG.cpp.

References llvm::ISD::CopyToReg, getReg(), llvm::SDNode::use_begin(), and llvm::SDNode::use_end().

Referenced by isFusableLoadOpStorePattern().

◆ hasSingleUsesFromRoot()

static bool hasSingleUsesFromRoot ( SDNode Root,
SDNode N 
)
static

◆ insertDAGNode()

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

◆ isCalleeLoad()

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

◆ isDispSafeForFrameIndex()

static bool isDispSafeForFrameIndex ( int64_t  Val)
static

◆ isFusableLoadOpStorePattern()

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

Check whether or not the chain ending in StoreNode is suitable for doing the {load; op; store} to modify transformation.

Definition at line 2057 of file X86ISelDAGToDAG.cpp.

References llvm::X86ISD::ADD, llvm::AArch64CC::AL, llvm::X86ISD::AND, llvm::ISD::AND, assert(), 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::countPopulation(), llvm::dbgs(), DEBUG, llvm::X86ISD::DEC, llvm::SDNode::dump(), llvm::dyn_cast(), llvm::N86::EAX, llvm::N86::EDX, llvm::LoadSDNode::getBasePtr(), llvm::StoreSDNode::getBasePtr(), llvm::MemSDNode::getChain(), llvm::MemSDNode::getMemOperand(), llvm::MemSDNode::getMemoryVT(), llvm::SDValue::getNode(), llvm::SelectionDAG::getNode(), llvm::SDNode::getNodeId(), llvm::SDValue::getNumOperands(), llvm::LoadSDNode::getOffset(), llvm::StoreSDNode::getOffset(), llvm::SDValue::getOpcode(), llvm::SDNode::getOpcode(), llvm::SDValue::getOperand(), llvm::SDNode::getOperand(), llvm::SDValue::getResNo(), llvm::ConstantSDNode::getSExtValue(), llvm::SDValue::getSimpleValueType(), llvm::SDNode::getSimpleValueType(), llvm::EVT::getSimpleVT(), llvm::EVT::getSizeInBits(), llvm::MVT::getSizeInBits(), llvm::SDValue::getValue(), llvm::SDValue::getValueType(), llvm::SDNode::getValueType(), llvm::ConstantSDNode::getZExtValue(), llvm::X86ISD::GlobalBaseReg, llvm::MVT::Glue, llvm::SDNode::hasAnyUseOfValue(), hasNoCarryFlagUses(), hasNoSignedComparisonUses(), llvm::SDNode::hasNUsesOfValue(), llvm::SDValue::hasOneUse(), llvm::SDNode::hasOneUse(), llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i64, llvm::MVT::i8, llvm::X86ISD::INC, llvm::isInt< 32 >(), llvm::isInt< 8 >(), llvm::SDNode::isMachineOpcode(), llvm::isMask_64(), llvm::MemSDNode::isNonTemporal(), llvm::ISD::isNormalLoad(), llvm::ISD::isNormalStore(), llvm::isUInt< 16 >(), llvm::isUInt< 32 >(), llvm::isUInt< 8 >(), llvm::X86::isZeroNode(), LLVM_FALLTHROUGH, llvm_unreachable, llvm::SPII::Load, llvm::BitmaskEnumDetail::Mask(), llvm::X86ISD::OR, llvm::ISD::OR, llvm::MVT::Other, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::ISD::SDIVREM, llvm::X86ISD::SDIVREM8_SEXT_HREG, llvm::X86ISD::SELECT, llvm::MCID::Select, llvm::MachineSDNode::setMemRefs(), llvm::SDNode::setNodeId(), llvm::ISD::SHL, llvm::X86ISD::SHRUNKBLEND, llvm::MVT::SimpleTy, llvm::X86ISD::SMUL8, llvm::ISD::SMUL_LOHI, llvm::ISD::SRA, llvm::ISD::SRL, llvm::ISD::STORE, llvm::X86ISD::SUB, std::swap(), llvm::ISD::TokenFactor, llvm::ISD::TRUNCATE, llvm::ISD::UDIVREM, llvm::X86ISD::UDIVREM8_ZEXT_HREG, llvm::X86ISD::UMUL, llvm::X86ISD::UMUL8, llvm::ISD::UMUL_LOHI, llvm::SDNode::use_begin(), llvm::SDValue::use_empty(), llvm::SDNode::use_end(), llvm::ISD::VSELECT, llvm::X86ISD::XOR, and llvm::ISD::XOR.

◆ isLegalMaskCompare()

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

◆ moveBelowOrigChain()

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

◆ STATISTIC()

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