LLVM 20.0.0git
|
#include "llvm/CodeGen/SelectionDAG.h"
#include "SDNodeDbgValue.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/RuntimeLibcallUtil.h"
#include "llvm/CodeGen/SDPatternMatch.h"
#include "llvm/CodeGen/SelectionDAGAddressAnalysis.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/SizeOpts.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <limits>
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "llvm/IR/VPIntrinsics.def"
#include "llvm/IR/ConstrainedOps.def"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "selectiondag" |
#define | BEGIN_REGISTER_VP_SDNODE(VPSD, ...) |
#define | BEGIN_REGISTER_VP_SDNODE(VPSD, ...) case ISD::VPSD: |
#define | VP_PROPERTY_BINARYOP return true; |
#define | END_REGISTER_VP_SDNODE(VPSD) break; |
#define | BEGIN_REGISTER_VP_SDNODE(VPSD, LEGALPOS, TDNAME, MASKPOS, ...) |
#define | BEGIN_REGISTER_VP_SDNODE(VPSD, LEGALPOS, TDNAME, MASKPOS, EVLPOS) |
#define | BEGIN_REGISTER_VP_SDNODE(VPOPC, ...) case ISD::VPOPC: |
#define | VP_PROPERTY_FUNCTIONAL_SDOPC(SDOPC) return ISD::SDOPC; |
#define | END_REGISTER_VP_SDNODE(VPOPC) break; |
#define | BEGIN_REGISTER_VP_SDNODE(VPOPC, ...) break; |
#define | VP_PROPERTY_FUNCTIONAL_SDOPC(SDOPC) case ISD::SDOPC: |
#define | END_REGISTER_VP_SDNODE(VPOPC) return ISD::VPOPC; |
#define | DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) case ISD::STRICT_##DAGN: NewOpc = ISD::DAGN; break; |
#define | CMP_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) case ISD::STRICT_##DAGN: NewOpc = ISD::SETCC; break; |
Functions | |
static SDVTList | makeVTList (const EVT *VTs, unsigned NumVTs) |
makeVTList - Return an instance of the SDVTList struct initialized with the specified members. | |
static void | NewSDValueDbgMsg (SDValue V, StringRef Msg, SelectionDAG *G) |
static ISD::CondCode | getSetCCInverseImpl (ISD::CondCode Op, bool isIntegerLike) |
static int | isSignedOp (ISD::CondCode Opcode) |
For an integer comparison, return 1 if the comparison is a signed operation and 2 if the result is an unsigned comparison. | |
static void | AddNodeIDOpcode (FoldingSetNodeID &ID, unsigned OpC) |
AddNodeIDOpcode - Add the node opcode to the NodeID data. | |
static void | AddNodeIDValueTypes (FoldingSetNodeID &ID, SDVTList VTList) |
AddNodeIDValueTypes - Value type lists are intern'd so we can represent them solely with their pointer. | |
static void | AddNodeIDOperands (FoldingSetNodeID &ID, ArrayRef< SDValue > Ops) |
AddNodeIDOperands - Various routines for adding operands to the NodeID data. | |
static void | AddNodeIDOperands (FoldingSetNodeID &ID, ArrayRef< SDUse > Ops) |
AddNodeIDOperands - Various routines for adding operands to the NodeID data. | |
static void | AddNodeIDNode (FoldingSetNodeID &ID, unsigned OpC, SDVTList VTList, ArrayRef< SDValue > OpList) |
static void | AddNodeIDCustom (FoldingSetNodeID &ID, const SDNode *N) |
If this is an SDNode with special info, add this info to the NodeID data. | |
static void | AddNodeIDNode (FoldingSetNodeID &ID, const SDNode *N) |
AddNodeIDNode - Generic routine for adding a nodes info to the NodeID data. | |
static bool | doNotCSE (SDNode *N) |
doNotCSE - Return true if CSE should not be performed for this node. | |
static void | VerifySDNode (SDNode *N, const TargetLowering *TLI) |
VerifySDNode - Check the given SDNode. Aborts if it is invalid. | |
static void | commuteShuffle (SDValue &N1, SDValue &N2, MutableArrayRef< int > M) |
Swaps the values of N1 and N2. | |
static bool | canFoldStoreIntoLibCallOutputPointers (StoreSDNode *StoreNode, SDNode *FPNode) |
Given a store node StoreNode , return true if it is safe to fold that node into FPNode , which expands to a library call with output pointers. | |
static SelectionDAG::OverflowKind | mapOverflowResult (ConstantRange::OverflowResult OR) |
Convert ConstantRange OverflowResult into SelectionDAG::OverflowKind. | |
static bool | haveNoCommonBitsSetCommutative (SDValue A, SDValue B) |
static SDValue | FoldSTEP_VECTOR (const SDLoc &DL, EVT VT, SDValue Step, SelectionDAG &DAG) |
static SDValue | FoldBUILD_VECTOR (const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SelectionDAG &DAG) |
static SDValue | foldCONCAT_VECTORS (const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SelectionDAG &DAG) |
Try to simplify vector concatenation to an input value, undef, or build vector. | |
static std::optional< APInt > | FoldValue (unsigned Opcode, const APInt &C1, const APInt &C2) |
static std::optional< APInt > | FoldValueWithUndef (unsigned Opcode, const APInt &C1, bool IsUndef1, const APInt &C2, bool IsUndef2) |
static SDValue | getMemsetValue (SDValue Value, EVT VT, SelectionDAG &DAG, const SDLoc &dl) |
getMemsetValue - Vectorized representation of the memset value operand. | |
static SDValue | getMemsetStringVal (EVT VT, const SDLoc &dl, SelectionDAG &DAG, const TargetLowering &TLI, const ConstantDataArraySlice &Slice) |
getMemsetStringVal - Similar to getMemsetValue. | |
static bool | isMemSrcFromConstant (SDValue Src, ConstantDataArraySlice &Slice) |
Returns true if memcpy source is constant data. | |
static bool | shouldLowerMemFuncForSize (const MachineFunction &MF, SelectionDAG &DAG) |
static void | chainLoadsAndStoresForMemcpy (SelectionDAG &DAG, const SDLoc &dl, SmallVector< SDValue, 32 > &OutChains, unsigned From, unsigned To, SmallVector< SDValue, 16 > &OutLoadChains, SmallVector< SDValue, 16 > &OutStoreChains) |
static SDValue | getMemcpyLoadsAndStores (SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, Align Alignment, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo, AAResults *AA) |
static SDValue | getMemmoveLoadsAndStores (SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, Align Alignment, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo) |
static SDValue | getMemsetStores (SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, Align Alignment, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, const AAMDNodes &AAInfo) |
Lower the call to 'memset' intrinsic function into a series of store operations. | |
static void | checkAddrSpaceIsValidForLibcall (const TargetLowering *TLI, unsigned AS) |
static MachinePointerInfo | InferPointerInfo (const MachinePointerInfo &Info, SelectionDAG &DAG, SDValue Ptr, int64_t Offset=0) |
InferPointerInfo - If the specified ptr/offset is a frame index, infer a MachinePointerInfo record from it. | |
static MachinePointerInfo | InferPointerInfo (const MachinePointerInfo &Info, SelectionDAG &DAG, SDValue Ptr, SDValue OffsetOp) |
InferPointerInfo - If the specified ptr/offset is a frame index, infer a MachinePointerInfo record from it. | |
static bool | gluePropagatesDivergence (const SDNode *Node) |
Return true if a glue output should propagate divergence information. | |
static void | checkForCyclesHelper (const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallPtrSetImpl< const SDNode * > &Checked, const llvm::SelectionDAG *DAG) |
Variables | |
static cl::opt< bool > | EnableMemCpyDAGOpt ("enable-memcpy-dag-opt", cl::Hidden, cl::init(true), cl::desc("Gang up loads and stores generated by inlining of memcpy")) |
static cl::opt< int > | MaxLdStGlue ("ldstmemcpy-glue-max", cl::desc("Number limit for gluing ld/st of memcpy."), cl::Hidden, cl::init(0)) |
static cl::opt< unsigned > | MaxSteps ("has-predecessor-max-steps", cl::Hidden, cl::init(8192), cl::desc("DAG combiner limit number of steps when searching DAG " "for predecessor nodes")) |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPOPC, | |
... | |||
) | case ISD::VPOPC: |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPOPC, | |
... | |||
) | break; |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPSD, | |
LEGALPOS, | |||
TDNAME, | |||
MASKPOS, | |||
EVLPOS | |||
) |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPSD, | |
LEGALPOS, | |||
TDNAME, | |||
MASKPOS, | |||
... | |||
) |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPSD, | |
... | |||
) |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPSD, | |
... | |||
) | case ISD::VPSD: |
#define CMP_INSTRUCTION | ( | NAME, | |
NARG, | |||
ROUND_MODE, | |||
INTRINSIC, | |||
DAGN | |||
) | case ISD::STRICT_##DAGN: NewOpc = ISD::SETCC; break; |
#define DAG_INSTRUCTION | ( | NAME, | |
NARG, | |||
ROUND_MODE, | |||
INTRINSIC, | |||
DAGN | |||
) | case ISD::STRICT_##DAGN: NewOpc = ISD::DAGN; break; |
#define DEBUG_TYPE "selectiondag" |
Definition at line 104 of file SelectionDAG.cpp.
#define END_REGISTER_VP_SDNODE | ( | VPOPC | ) | break; |
#define END_REGISTER_VP_SDNODE | ( | VPOPC | ) | return ISD::VPOPC; |
#define END_REGISTER_VP_SDNODE | ( | VPSD | ) | break; |
#define VP_PROPERTY_BINARYOP return true; |
#define VP_PROPERTY_FUNCTIONAL_SDOPC | ( | SDOPC | ) | return ISD::SDOPC; |
#define VP_PROPERTY_FUNCTIONAL_SDOPC | ( | SDOPC | ) | case ISD::SDOPC: |
|
static |
If this is an SDNode with special info, add this info to the NodeID data.
Definition at line 754 of file SelectionDAG.cpp.
References llvm::ISD::AssertAlign, llvm::ISD::ATOMIC_CMP_SWAP, llvm::ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS, llvm::ISD::ATOMIC_LOAD, llvm::ISD::ATOMIC_LOAD_ADD, llvm::ISD::ATOMIC_LOAD_AND, llvm::ISD::ATOMIC_LOAD_CLR, llvm::ISD::ATOMIC_LOAD_MAX, llvm::ISD::ATOMIC_LOAD_MIN, llvm::ISD::ATOMIC_LOAD_NAND, llvm::ISD::ATOMIC_LOAD_OR, llvm::ISD::ATOMIC_LOAD_SUB, llvm::ISD::ATOMIC_LOAD_UMAX, llvm::ISD::ATOMIC_LOAD_UMIN, llvm::ISD::ATOMIC_LOAD_XOR, llvm::ISD::ATOMIC_STORE, llvm::ISD::ATOMIC_SWAP, llvm::ISD::BasicBlock, llvm::ISD::BlockAddress, llvm::CallingConv::C, llvm::ISD::Constant, llvm::ISD::ConstantFP, llvm::ISD::ConstantPool, llvm::ISD::ExternalSymbol, llvm::ISD::FrameIndex, llvm::MachinePointerInfo::getAddrSpace(), llvm::getAlign(), llvm::SelectionDAG::getBasicBlock(), llvm::BlockAddressSDNode::getBlockAddress(), llvm::MachineMemOperand::getFlags(), llvm::GlobalAddressSDNode::getGlobal(), llvm::TargetIndexSDNode::getIndex(), llvm::MemSDNode::getMemOperand(), llvm::MemSDNode::getMemoryVT(), llvm::GlobalAddressSDNode::getOffset(), llvm::TargetIndexSDNode::getOffset(), llvm::BlockAddressSDNode::getOffset(), llvm::getOffset(), llvm::MemSDNode::getPointerInfo(), llvm::EVT::getRawBits(), llvm::MemSDNode::getRawSubclassData(), getReg(), getSize(), llvm::GlobalAddressSDNode::getTargetFlags(), llvm::TargetIndexSDNode::getTargetFlags(), llvm::BlockAddressSDNode::getTargetFlags(), llvm::ISD::GlobalAddress, llvm::ISD::GlobalTLSAddress, llvm::ISD::INTRINSIC_VOID, llvm::ISD::INTRINSIC_W_CHAIN, llvm::ISD::JumpTable, llvm::ISD::LIFETIME_END, llvm::ISD::LIFETIME_START, llvm_unreachable, llvm::ISD::LOAD, llvm::ISD::MCSymbol, llvm::ISD::MGATHER, llvm::ISD::MLOAD, llvm::ISD::MSCATTER, llvm::ISD::MSTORE, N, llvm::ISD::PREFETCH, llvm::ISD::PSEUDO_PROBE, llvm::ISD::Register, llvm::ISD::RegisterMask, llvm::ISD::SRCVALUE, llvm::ISD::STORE, llvm::ISD::TargetBlockAddress, llvm::ISD::TargetConstant, llvm::ISD::TargetConstantFP, llvm::ISD::TargetConstantPool, llvm::ISD::TargetExternalSymbol, llvm::ISD::TargetFrameIndex, llvm::ISD::TargetGlobalAddress, llvm::ISD::TargetGlobalTLSAddress, llvm::ISD::TargetIndex, llvm::ISD::TargetJumpTable, value, and llvm::ISD::VECTOR_SHUFFLE.
Referenced by AddNodeIDNode().
|
static |
AddNodeIDNode - Generic routine for adding a nodes info to the NodeID data.
Definition at line 987 of file SelectionDAG.cpp.
References AddNodeIDCustom(), AddNodeIDOpcode(), AddNodeIDOperands(), AddNodeIDValueTypes(), and N.
|
static |
Definition at line 746 of file SelectionDAG.cpp.
References AddNodeIDOpcode(), AddNodeIDOperands(), and AddNodeIDValueTypes().
Referenced by llvm::SelectionDAG::doesNodeExist(), llvm::SelectionDAG::getAddrSpaceCast(), llvm::SelectionDAG::getAssertAlign(), llvm::SelectionDAG::getAtomic(), llvm::SelectionDAG::getBasicBlock(), llvm::SelectionDAG::getBlockAddress(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getFrameIndex(), llvm::SelectionDAG::getGatherVP(), llvm::SelectionDAG::getGetFPEnv(), llvm::SelectionDAG::getGlobalAddress(), llvm::SelectionDAG::getIndexedStore(), llvm::SelectionDAG::getIndexedStoreVP(), llvm::SelectionDAG::getJumpTable(), llvm::SelectionDAG::getLabelNode(), llvm::SelectionDAG::getLifetimeNode(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getLoadVP(), llvm::SelectionDAG::getMachineNode(), llvm::SelectionDAG::getMaskedGather(), llvm::SelectionDAG::getMaskedHistogram(), llvm::SelectionDAG::getMaskedLoad(), llvm::SelectionDAG::getMaskedScatter(), llvm::SelectionDAG::getMaskedStore(), llvm::SelectionDAG::getMDNode(), llvm::SelectionDAG::getMemIntrinsicNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNodeIfExists(), llvm::SelectionDAG::getPseudoProbeNode(), llvm::SelectionDAG::getRegister(), llvm::SelectionDAG::getRegisterMask(), llvm::SelectionDAG::getScatterVP(), llvm::SelectionDAG::getSetFPEnv(), llvm::SelectionDAG::getSrcValue(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getStoreVP(), llvm::SelectionDAG::getStridedLoadVP(), llvm::SelectionDAG::getStridedStoreVP(), llvm::SelectionDAG::getTruncStore(), llvm::SelectionDAG::getTruncStoreVP(), llvm::SelectionDAG::getTruncStridedStoreVP(), llvm::SelectionDAG::getVectorShuffle(), llvm::SelectionDAG::MorphNodeTo(), and llvm::SDNode::Profile().
|
static |
AddNodeIDOpcode - Add the node opcode to the NodeID data.
Definition at line 718 of file SelectionDAG.cpp.
Referenced by AddNodeIDNode().
|
static |
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
Definition at line 738 of file SelectionDAG.cpp.
|
static |
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
Definition at line 729 of file SelectionDAG.cpp.
Referenced by AddNodeIDNode().
|
static |
AddNodeIDValueTypes - Value type lists are intern'd so we can represent them solely with their pointer.
Definition at line 724 of file SelectionDAG.cpp.
References llvm::SDVTList::VTs.
Referenced by AddNodeIDNode().
|
static |
Given a store node StoreNode
, return true if it is safe to fold that node into FPNode
, which expands to a library call with output pointers.
Definition at line 2501 of file SelectionDAG.cpp.
References _, llvm::ISD::CALLSEQ_END, llvm::ISD::CALLSEQ_START, llvm::SmallVectorBase< Size_T >::empty(), llvm::SelectionDAG::getHasPredecessorMaxSteps(), llvm::SDNode::hasPredecessorHelper(), llvm::SmallPtrSetImpl< PtrType >::insert(), MaxSteps, llvm::SDNode::ops(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallPtrSetImplBase::size().
Referenced by llvm::SelectionDAG::expandMultipleResultFPLibCall().
|
static |
Definition at line 8098 of file SelectionDAG.cpp.
References assert(), From, llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getTruncStore(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and llvm::ISD::TokenFactor.
Referenced by getMemcpyLoadsAndStores().
|
static |
Definition at line 8567 of file SelectionDAG.cpp.
References llvm::TargetLoweringBase::getTargetMachine(), llvm::TargetMachine::isNoopAddrSpaceCast(), and llvm::report_fatal_error().
Referenced by llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getMemmove(), and llvm::SelectionDAG::getMemset().
|
static |
Definition at line 13718 of file SelectionDAG.cpp.
References checkForCyclesHelper(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::SmallPtrSetImpl< PtrType >::erase(), llvm::errs(), llvm::SmallPtrSetImpl< PtrType >::insert(), and N.
Referenced by llvm::checkForCycles(), and checkForCyclesHelper().
|
static |
Swaps the values of N1 and N2.
Swaps all indices in the shuffle mask M that point at N1 to point at N2 and indices that point at N2 to point at N1.
Definition at line 2136 of file SelectionDAG.cpp.
References llvm::ShuffleVectorSDNode::commuteMask(), and std::swap().
Referenced by llvm::SelectionDAG::getVectorShuffle().
doNotCSE - Return true if CSE should not be performed for this node.
Definition at line 1003 of file SelectionDAG.cpp.
References llvm::ISD::EH_LABEL, llvm::ISD::HANDLENODE, and N.
|
static |
Definition at line 6053 of file SelectionDAG.cpp.
References llvm::all_of(), assert(), llvm::ISD::EXTRACT_VECTOR_ELT, getOpcode(), llvm::SelectionDAG::getUNDEF(), getValueType(), llvm::EVT::getVectorNumElements(), llvm::EVT::isScalableVector(), and llvm::ArrayRef< T >::size().
Referenced by llvm::SelectionDAG::getNode().
|
static |
Try to simplify vector concatenation to an input value, undef, or build vector.
Definition at line 6089 of file SelectionDAG.cpp.
References llvm::all_of(), llvm::SmallVectorImpl< T >::append(), assert(), llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), llvm::ISD::BUILD_VECTOR, DL, llvm::ArrayRef< T >::empty(), llvm::ISD::EXTRACT_SUBVECTOR, llvm::SelectionDAG::getBuildVector(), llvm::EVT::getScalarType(), llvm::SelectionDAG::getSExtOrTrunc(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::SelectionDAG::getUNDEF(), getValueType(), llvm::EVT::getVectorElementCount(), llvm::EVT::getVectorNumElements(), llvm::SelectionDAG::getZExtOrTrunc(), llvm::EVT::isScalableVector(), llvm::TargetLoweringBase::isZExtFree(), NewSDValueDbgMsg(), and llvm::ArrayRef< T >::size().
Referenced by llvm::SelectionDAG::getNode().
|
static |
Definition at line 6045 of file SelectionDAG.cpp.
References DL, llvm::SelectionDAG::getConstant(), and isZero().
Referenced by llvm::SelectionDAG::FoldConstantArithmetic().
|
static |
Definition at line 6546 of file SelectionDAG.cpp.
References llvm::APIntOps::abds(), llvm::ISD::ABDS, llvm::APIntOps::abdu(), llvm::ISD::ABDU, llvm::ISD::ADD, llvm::ISD::AND, llvm::APInt::ashr(), llvm::APIntOps::avgCeilS(), llvm::ISD::AVGCEILS, llvm::APIntOps::avgCeilU(), llvm::ISD::AVGCEILU, llvm::APIntOps::avgFloorS(), llvm::ISD::AVGFLOORS, llvm::APIntOps::avgFloorU(), llvm::ISD::AVGFLOORU, llvm::APInt::lshr(), llvm::ISD::MUL, llvm::APIntOps::mulhs(), llvm::ISD::MULHS, llvm::APIntOps::mulhu(), llvm::ISD::MULHU, llvm::ISD::OR, llvm::APInt::rotl(), llvm::ISD::ROTL, llvm::APInt::rotr(), llvm::ISD::ROTR, llvm::APInt::sadd_sat(), llvm::ISD::SADDSAT, llvm::APInt::sdiv(), llvm::ISD::SDIV, llvm::APInt::sge(), llvm::ISD::SHL, llvm::APInt::sle(), llvm::ISD::SMAX, llvm::ISD::SMIN, llvm::ISD::SRA, llvm::APInt::srem(), llvm::ISD::SREM, llvm::ISD::SRL, llvm::APInt::sshl_sat(), llvm::ISD::SSHLSAT, llvm::APInt::ssub_sat(), llvm::ISD::SSUBSAT, llvm::ISD::SUB, llvm::APInt::uadd_sat(), llvm::ISD::UADDSAT, llvm::APInt::udiv(), llvm::ISD::UDIV, llvm::APInt::uge(), llvm::APInt::ule(), llvm::ISD::UMAX, llvm::ISD::UMIN, llvm::APInt::urem(), llvm::ISD::UREM, llvm::APInt::ushl_sat(), llvm::ISD::USHLSAT, llvm::APInt::usub_sat(), llvm::ISD::USUBSAT, and llvm::ISD::XOR.
Referenced by llvm::SelectionDAG::FoldConstantArithmetic(), and FoldValueWithUndef().
|
static |
Definition at line 6607 of file SelectionDAG.cpp.
References llvm::ISD::AND, FoldValue(), llvm::APInt::getBitWidth(), llvm::APInt::getZero(), and llvm::ISD::MUL.
Referenced by llvm::SelectionDAG::FoldConstantArithmetic().
|
static |
Definition at line 8123 of file SelectionDAG.cpp.
References llvm::ConstantDataArraySlice::Array, assert(), llvm::EVT::bitsGE(), llvm::CallingConv::C, chainLoadsAndStoresForMemcpy(), llvm::commonAlignment(), llvm::MemOp::Copy(), DL, EnableMemCpyDAGOpt, llvm::ISD::EXTLOAD, llvm::TargetLowering::findOptimalMemOpLowering(), llvm::MachinePointerInfo::getAddrSpace(), llvm::Function::getAttributes(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getExtLoad(), llvm::TypeSize::getFixed(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::FrameIndexSDNode::getIndex(), llvm::SelectionDAG::getMachineFunction(), llvm::TargetLoweringBase::getMaxGluedStoresPerMemcpy(), llvm::TargetLoweringBase::getMaxStoresPerMemcpy(), llvm::SelectionDAG::getMemBasePlusOffset(), getMemsetStringVal(), llvm::SelectionDAG::getNode(), llvm::MachineFrameInfo::getObjectAlign(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getStore(), llvm::MachineFunction::getSubtarget(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::SelectionDAG::getTruncStore(), llvm::TargetLoweringBase::getTypeToTransformTo(), llvm::MachinePointerInfo::getWithOffset(), llvm::SelectionDAG::InferPtrAlign(), isConstant(), llvm::MachinePointerInfo::isDereferenceable(), llvm::MachineFrameInfo::isFixedObjectIndex(), llvm::EVT::isInteger(), isMemSrcFromConstant(), llvm::EVT::isVector(), llvm::ConstantDataArraySlice::Length, MaxLdStGlue, llvm::MachineMemOperand::MODereferenceable, llvm::MachineMemOperand::MOInvariant, llvm::MachineMemOperand::MONone, llvm::ConstantDataArraySlice::move(), llvm::MachineMemOperand::MOVolatile, llvm::ConstantDataArraySlice::Offset, llvm::AAResults::pointsToConstantMemory(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MemOp::Set(), llvm::MachineFrameInfo::setObjectAlignment(), shouldLowerMemFuncForSize(), llvm::SmallVectorBase< Size_T >::size(), Size, llvm::AAMDNodes::TBAA, llvm::AAMDNodes::TBAAStruct, llvm::ISD::TokenFactor, TRI, and llvm::MachinePointerInfo::V.
Referenced by llvm::SelectionDAG::getMemcpy().
|
static |
Definition at line 8326 of file SelectionDAG.cpp.
References assert(), llvm::CallingConv::C, llvm::SmallVectorImpl< T >::clear(), llvm::MemOp::Copy(), DL, llvm::TargetLowering::findOptimalMemOpLowering(), llvm::MachinePointerInfo::getAddrSpace(), llvm::Function::getAttributes(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getDataLayout(), llvm::TypeSize::getFixed(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::FrameIndexSDNode::getIndex(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getMachineFunction(), llvm::TargetLoweringBase::getMaxStoresPerMemmove(), llvm::SelectionDAG::getMemBasePlusOffset(), llvm::SelectionDAG::getNode(), llvm::MachineFrameInfo::getObjectAlign(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getStore(), llvm::MachineFunction::getSubtarget(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::MachinePointerInfo::getWithOffset(), llvm::SelectionDAG::InferPtrAlign(), llvm::MachinePointerInfo::isDereferenceable(), llvm::MachineFrameInfo::isFixedObjectIndex(), llvm::MachineMemOperand::MODereferenceable, llvm::MachineMemOperand::MONone, llvm::MachineMemOperand::MOVolatile, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MachineFrameInfo::setObjectAlignment(), shouldLowerMemFuncForSize(), llvm::SmallVectorBase< Size_T >::size(), Size, llvm::AAMDNodes::TBAA, llvm::AAMDNodes::TBAAStruct, llvm::ISD::TokenFactor, and TRI.
Referenced by llvm::SelectionDAG::getMemmove().
|
static |
Lower the call to 'memset' intrinsic function into a series of store operations.
DAG | Selection DAG where lowered code is placed. |
dl | Link to corresponding IR location. |
Chain | Control flow dependency. |
Dst | Pointer to destination memory location. |
Src | Value of byte to write into the memory. |
Size | Number of bytes to write. |
Alignment | Alignment of the destination in bytes. |
isVol | True if destination is volatile. |
AlwaysInline | Makes sure no function call is generated. |
DstPtrInfo | IR information on the memory pointer. |
The function tries to replace 'llvm.memset' intrinsic with several store operations and value calculation code. This is usually profitable for small memory size or when the semantic requires inlining.
Definition at line 8451 of file SelectionDAG.cpp.
References assert(), llvm::ISD::BITCAST, llvm::EVT::bitsLT(), DL, llvm::ISD::EXTRACT_VECTOR_ELT, llvm::TargetLowering::findOptimalMemOpLowering(), llvm::MachinePointerInfo::getAddrSpace(), llvm::Function::getAttributes(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getDataLayout(), llvm::TypeSize::getFixed(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::FrameIndexSDNode::getIndex(), llvm::SelectionDAG::getMachineFunction(), llvm::TargetLoweringBase::getMaxStoresPerMemset(), llvm::SelectionDAG::getMemBasePlusOffset(), getMemsetValue(), llvm::SelectionDAG::getNode(), llvm::MachineFrameInfo::getObjectAlign(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::EVT::getScalarType(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getStore(), llvm::MachineFunction::getSubtarget(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::EVT::getTypeForEVT(), llvm::SelectionDAG::getVectorIdxConstant(), llvm::EVT::getVectorVT(), llvm::MachinePointerInfo::getWithOffset(), llvm::MachineFrameInfo::isFixedObjectIndex(), llvm::isNullConstant(), llvm::TargetLoweringBase::isTruncateFree(), llvm::TargetLoweringBase::isTypeLegal(), llvm::EVT::isVector(), llvm::MachineMemOperand::MONone, llvm::MachineMemOperand::MOVolatile, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MemOp::Set(), llvm::MachineFrameInfo::setObjectAlignment(), llvm::TargetLoweringBase::shallExtractConstSplatVectorElementToStore(), shouldLowerMemFuncForSize(), Size, llvm::AAMDNodes::TBAA, llvm::AAMDNodes::TBAAStruct, llvm::ISD::TokenFactor, TRI, and llvm::ISD::TRUNCATE.
Referenced by llvm::SelectionDAG::getMemset().
|
static |
getMemsetStringVal - Similar to getMemsetValue.
Except this is only used when a memcpy is turned into a memset when the source is a constant string ptr.
Definition at line 8004 of file SelectionDAG.cpp.
References llvm::ConstantDataArraySlice::Array, assert(), llvm::ISD::BITCAST, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getNode(), llvm::EVT::getSizeInBits(), llvm::EVT::getTypeForEVT(), llvm::EVT::getVectorElementType(), llvm::EVT::getVectorNumElements(), llvm::EVT::getVectorVT(), llvm::EVT::isInteger(), llvm::DataLayout::isLittleEndian(), llvm::EVT::isVector(), llvm::ConstantDataArraySlice::Length, llvm_unreachable, and llvm::TargetLoweringBase::shouldConvertConstantLoadToIntImm().
Referenced by getMemcpyLoadsAndStores().
|
static |
getMemsetValue - Vectorized representation of the memset value operand.
Definition at line 7963 of file SelectionDAG.cpp.
References assert(), llvm::CallingConv::C, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getContext(), llvm::EVT::getFltSemantics(), llvm::EVT::getIntegerVT(), llvm::SelectionDAG::getNode(), llvm::EVT::getScalarSizeInBits(), llvm::EVT::getScalarType(), llvm::EVT::getSizeInBits(), llvm::APInt::getSplat(), llvm::SelectionDAG::getSplatBuildVector(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::EVT::isInteger(), llvm::TargetLoweringBase::isLegalStoreImmediate(), llvm::ISD::MUL, and llvm::ISD::ZERO_EXTEND.
|
static |
Definition at line 626 of file SelectionDAG.cpp.
References Operation, and llvm::ISD::SETTRUE2.
Referenced by llvm::ISD::GlobalISel::getSetCCInverse(), and llvm::ISD::getSetCCInverse().
Return true if a glue output should propagate divergence information.
Definition at line 11906 of file SelectionDAG.cpp.
References llvm::ISD::CopyFromReg, llvm::ISD::CopyToReg, and llvm_unreachable.
Referenced by llvm::SelectionDAG::calculateDivergence().
Definition at line 6002 of file SelectionDAG.cpp.
References A, llvm::ISD::AND, B, llvm::getBitwiseNotOperand(), llvm::Other, llvm::ISD::TRUNCATE, and llvm::ISD::ZERO_EXTEND.
Referenced by llvm::SelectionDAG::haveNoCommonBitsSet().
|
static |
InferPointerInfo - If the specified ptr/offset is a frame index, infer a MachinePointerInfo record from it.
This is particularly useful because the code generator has many cases where it doesn't bother passing in a MachinePointerInfo to getLoad or getStore when it has "FI+Cst".
Definition at line 9155 of file SelectionDAG.cpp.
References llvm::ISD::ADD, llvm::MachinePointerInfo::getFixedStack(), llvm::SelectionDAG::getMachineFunction(), Info, llvm::Offset, and Ptr.
Referenced by llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getLoadVP(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTruncStore(), llvm::SelectionDAG::getTruncStoreVP(), and InferPointerInfo().
|
static |
InferPointerInfo - If the specified ptr/offset is a frame index, infer a MachinePointerInfo record from it.
This is particularly useful because the code generator has many cases where it doesn't bother passing in a MachinePointerInfo to getLoad or getStore when it has "FI+Cst".
Definition at line 9179 of file SelectionDAG.cpp.
References InferPointerInfo(), Info, llvm::SDValue::isUndef(), and Ptr.
|
static |
Returns true if memcpy source is constant data.
Definition at line 8071 of file SelectionDAG.cpp.
References llvm::ISD::ADD, llvm::ISD::Constant, G, llvm::getConstantDataArrayInfo(), and llvm::ISD::GlobalAddress.
Referenced by getMemcpyLoadsAndStores().
|
static |
For an integer comparison, return 1 if the comparison is a signed operation and 2 if the result is an unsigned comparison.
Return zero if the operation does not depend on the sign of the input (setne and seteq).
Definition at line 651 of file SelectionDAG.cpp.
References llvm_unreachable, llvm::ISD::SETEQ, llvm::ISD::SETGE, llvm::ISD::SETGT, llvm::ISD::SETLE, llvm::ISD::SETLT, llvm::ISD::SETNE, llvm::ISD::SETUGE, llvm::ISD::SETUGT, llvm::ISD::SETULE, and llvm::ISD::SETULT.
Referenced by llvm::ISD::getSetCCAndOperation(), and llvm::ISD::getSetCCOrOperation().
makeVTList - Return an instance of the SDVTList struct initialized with the specified members.
Definition at line 91 of file SelectionDAG.cpp.
Referenced by llvm::SelectionDAG::getVTList().
|
static |
Convert ConstantRange OverflowResult into SelectionDAG::OverflowKind.
Definition at line 4514 of file SelectionDAG.cpp.
References llvm::ConstantRange::AlwaysOverflowsHigh, llvm::ConstantRange::AlwaysOverflowsLow, llvm_unreachable, llvm::ConstantRange::MayOverflow, llvm::ConstantRange::NeverOverflows, llvm::SelectionDAG::OFK_Always, llvm::SelectionDAG::OFK_Never, and llvm::SelectionDAG::OFK_Sometime.
|
static |
Definition at line 119 of file SelectionDAG.cpp.
References llvm::dbgs(), llvm::SelectionDAG::dump(), G, and LLVM_DEBUG.
Referenced by foldCONCAT_VECTORS(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::SelectionDAG::getAssertAlign(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getGatherVP(), llvm::SelectionDAG::getGetFPEnv(), llvm::SelectionDAG::getIndexedStore(), llvm::SelectionDAG::getIndexedStoreVP(), llvm::SelectionDAG::getLifetimeNode(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getLoadVP(), llvm::SelectionDAG::getMachineNode(), llvm::SelectionDAG::getMaskedGather(), llvm::SelectionDAG::getMaskedHistogram(), llvm::SelectionDAG::getMaskedLoad(), llvm::SelectionDAG::getMaskedScatter(), llvm::SelectionDAG::getMaskedStore(), llvm::SelectionDAG::getMemIntrinsicNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getPseudoProbeNode(), llvm::SelectionDAG::getScatterVP(), llvm::SelectionDAG::getSetFPEnv(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getStoreVP(), llvm::SelectionDAG::getStridedLoadVP(), llvm::SelectionDAG::getStridedStoreVP(), llvm::SelectionDAG::getTruncStore(), llvm::SelectionDAG::getTruncStoreVP(), llvm::SelectionDAG::getTruncStridedStoreVP(), and llvm::SelectionDAG::getVectorShuffle().
|
static |
Definition at line 8089 of file SelectionDAG.cpp.
References llvm::MachineFunction::getFunction(), llvm::MachineFunction::getTarget(), llvm::TargetMachine::getTargetTriple(), llvm::Function::hasMinSize(), llvm::Triple::isOSDarwin(), and llvm::SelectionDAG::shouldOptForSize().
|
static |
VerifySDNode - Check the given SDNode. Aborts if it is invalid.
Definition at line 1152 of file SelectionDAG.cpp.
References assert(), llvm::EVT::bitsLE(), llvm::ISD::BUILD_PAIR, llvm::ISD::BUILD_VECTOR, llvm::ISD::BUILTIN_OP_END, llvm::EVT::getSizeInBits(), llvm::EVT::isFloatingPoint(), llvm::EVT::isInteger(), llvm::EVT::isVector(), N, and llvm::TargetLowering::verifyTargetSDNode().
|
static |
Referenced by getMemcpyLoadsAndStores().
|
static |
Referenced by getMemcpyLoadsAndStores().
|
static |