LLVM 22.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/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 <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, ...) |
#define | VP_PROPERTY_BINARYOP return true; |
#define | END_REGISTER_VP_SDNODE(VPSD) |
#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, ...) |
#define | VP_PROPERTY_FUNCTIONAL_SDOPC(SDOPC) |
#define | END_REGISTER_VP_SDNODE(VPOPC) |
#define | BEGIN_REGISTER_VP_SDNODE(VPOPC, ...) |
#define | VP_PROPERTY_FUNCTIONAL_SDOPC(SDOPC) |
#define | END_REGISTER_VP_SDNODE(VPOPC) |
#define | DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) |
#define | CMP_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) |
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 | 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, BatchAAResults *BatchAA) |
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 bool | isInTailCallPositionWrapper (const CallInst *CI, const SelectionDAG *SelDAG, bool AllowReturnsFirstArg) |
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, | |
... ) |
#define BEGIN_REGISTER_VP_SDNODE | ( | VPOPC, | |
... ) |
#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, | |
... ) |
#define CMP_INSTRUCTION | ( | NAME, | |
NARG, | |||
ROUND_MODE, | |||
INTRINSIC, | |||
DAGN ) |
#define DAG_INSTRUCTION | ( | NAME, | |
NARG, | |||
ROUND_MODE, | |||
INTRINSIC, | |||
DAGN ) |
#define DEBUG_TYPE "selectiondag" |
Definition at line 102 of file SelectionDAG.cpp.
#define END_REGISTER_VP_SDNODE | ( | VPOPC | ) |
#define END_REGISTER_VP_SDNODE | ( | VPOPC | ) |
#define END_REGISTER_VP_SDNODE | ( | VPSD | ) |
#define VP_PROPERTY_BINARYOP return true; |
#define VP_PROPERTY_FUNCTIONAL_SDOPC | ( | SDOPC | ) |
#define VP_PROPERTY_FUNCTIONAL_SDOPC | ( | SDOPC | ) |
|
static |
If this is an SDNode with special info, add this info to the NodeID data.
Definition at line 743 of file SelectionDAG.cpp.
References llvm::ISD::AssertAlign, llvm::ISD::BasicBlock, llvm::ISD::BlockAddress, llvm::CallingConv::C, llvm::cast(), llvm::ISD::Constant, llvm::ISD::ConstantFP, llvm::ISD::ConstantPool, llvm::dyn_cast(), llvm::ISD::ExternalSymbol, llvm::ISD::FrameIndex, llvm::MachinePointerInfo::getAddrSpace(), llvm::getAlign(), llvm::SelectionDAG::getBasicBlock(), llvm::BlockAddressSDNode::getBlockAddress(), llvm::AddrSpaceCastSDNode::getDestAddressSpace(), llvm::MachineMemOperand::getFlags(), llvm::GlobalAddressSDNode::getGlobal(), llvm::TargetIndexSDNode::getIndex(), llvm::MemSDNode::getMemOperand(), llvm::MemSDNode::getMemoryVT(), llvm::BlockAddressSDNode::getOffset(), llvm::GlobalAddressSDNode::getOffset(), llvm::TargetIndexSDNode::getOffset(), llvm::MemSDNode::getPointerInfo(), llvm::EVT::getRawBits(), llvm::MemSDNode::getRawSubclassData(), getReg(), llvm::AddrSpaceCastSDNode::getSrcAddressSpace(), llvm::BlockAddressSDNode::getTargetFlags(), llvm::GlobalAddressSDNode::getTargetFlags(), llvm::TargetIndexSDNode::getTargetFlags(), llvm::ISD::GlobalAddress, llvm::ISD::GlobalTLSAddress, llvm::ISD::INTRINSIC_VOID, llvm::ISD::INTRINSIC_W_CHAIN, llvm::ISD::JumpTable, llvm_unreachable, llvm::ISD::MCSymbol, N, llvm::ISD::Register, llvm::ISD::RegisterMask, 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, and llvm::ISD::VECTOR_SHUFFLE.
Referenced by AddNodeIDNode().
|
static |
AddNodeIDNode - Generic routine for adding a nodes info to the NodeID data.
Definition at line 986 of file SelectionDAG.cpp.
References AddNodeIDCustom(), AddNodeIDOpcode(), AddNodeIDOperands(), AddNodeIDValueTypes(), and N.
|
static |
Definition at line 735 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::getConstantPool(), llvm::SelectionDAG::getFrameIndex(), llvm::SelectionDAG::getGatherVP(), llvm::SelectionDAG::getGetFPEnv(), llvm::SelectionDAG::getGlobalAddress(), llvm::SelectionDAG::getIndexedStoreVP(), llvm::SelectionDAG::getJumpTable(), llvm::SelectionDAG::getLabelNode(), llvm::SelectionDAG::getLifetimeNode(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getLoadFFVP(), 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::getNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), 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::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 707 of file SelectionDAG.cpp.
Referenced by AddNodeIDNode(), and AddNodeIDNode().
|
static |
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
Definition at line 727 of file SelectionDAG.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops.
|
static |
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
Definition at line 718 of file SelectionDAG.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops.
Referenced by AddNodeIDNode(), and AddNodeIDNode().
|
static |
AddNodeIDValueTypes - Value type lists are intern'd so we can represent them solely with their pointer.
Definition at line 713 of file SelectionDAG.cpp.
References llvm::SDVTList::VTs.
Referenced by AddNodeIDNode(), and 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 2473 of file SelectionDAG.cpp.
References _, llvm::SmallVectorTemplateCommon< T, typename >::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 8622 of file SelectionDAG.cpp.
References assert(), llvm::dyn_cast(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getTruncStore(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::ISD::TokenFactor.
Referenced by getMemcpyLoadsAndStores().
|
static |
Definition at line 9089 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 14269 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 2137 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 1002 of file SelectionDAG.cpp.
References N.
|
static |
Definition at line 6296 of file SelectionDAG.cpp.
References AbstractManglingParser< Derived, Alloc >::NumOps, AbstractManglingParser< Derived, Alloc >::Ops, llvm::all_of(), assert(), DL, llvm::ISD::EXTRACT_VECTOR_ELT, getOpcode(), llvm::SelectionDAG::getUNDEF(), getValueType(), llvm::EVT::getVectorNumElements(), llvm::isa(), llvm::EVT::isScalableVector(), and SDValue().
Referenced by llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), and llvm::SelectionDAG::getNode().
|
static |
Try to simplify vector concatenation to an input value, undef, or build vector.
Definition at line 6332 of file SelectionDAG.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, llvm::all_of(), llvm::SmallVectorImpl< T >::append(), assert(), llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), llvm::ISD::BUILD_VECTOR, DL, 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 SDValue().
Referenced by llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), and llvm::SelectionDAG::getNode().
Definition at line 6288 of file SelectionDAG.cpp.
References llvm::cast(), DL, llvm::SelectionDAG::getConstant(), isZero(), and SDValue().
Referenced by llvm::SelectionDAG::FoldConstantArithmetic().
Definition at line 6819 of file SelectionDAG.cpp.
References llvm::ISD::ABDS, llvm::APIntOps::abds(), llvm::ISD::ABDU, llvm::APIntOps::abdu(), llvm::ISD::ADD, llvm::ISD::AND, llvm::APInt::ashr(), llvm::ISD::AVGCEILS, llvm::APIntOps::avgCeilS(), llvm::ISD::AVGCEILU, llvm::APIntOps::avgCeilU(), llvm::ISD::AVGFLOORS, llvm::APIntOps::avgFloorS(), llvm::ISD::AVGFLOORU, llvm::APIntOps::avgFloorU(), llvm::APInt::lshr(), llvm::ISD::MUL, llvm::ISD::MULHS, llvm::APIntOps::mulhs(), llvm::ISD::MULHU, llvm::APIntOps::mulhu(), llvm::ISD::OR, llvm::ISD::ROTL, llvm::APInt::rotl(), llvm::ISD::ROTR, llvm::APInt::rotr(), llvm::APInt::sadd_sat(), llvm::ISD::SADDSAT, llvm::ISD::SDIV, llvm::APInt::sdiv(), llvm::APInt::sge(), llvm::ISD::SHL, llvm::APInt::sle(), llvm::ISD::SMAX, llvm::ISD::SMIN, llvm::ISD::SRA, llvm::ISD::SREM, llvm::APInt::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::ISD::UDIV, llvm::APInt::udiv(), llvm::APInt::uge(), llvm::APInt::ule(), llvm::ISD::UMAX, llvm::ISD::UMIN, llvm::ISD::UREM, llvm::APInt::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 6880 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 8647 of file SelectionDAG.cpp.
References llvm::ConstantDataArraySlice::Array, assert(), llvm::EVT::bitsGE(), llvm::CallingConv::C, chainLoadsAndStoresForMemcpy(), llvm::commonAlignment(), llvm::MemOp::Copy(), DL, llvm::dyn_cast(), llvm::dyn_cast_if_present(), 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::BatchAAResults::pointsToConstantMemory(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), SDValue(), llvm::MemOp::Set(), llvm::MachineFrameInfo::setObjectAlignment(), shouldLowerMemFuncForSize(), Size, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::AAMDNodes::TBAA, llvm::AAMDNodes::TBAAStruct, llvm::ISD::TokenFactor, TRI, and llvm::MachinePointerInfo::V.
Referenced by llvm::SelectionDAG::getMemcpy().
|
static |
Definition at line 8848 of file SelectionDAG.cpp.
References assert(), llvm::CallingConv::C, llvm::SmallVectorImpl< T >::clear(), llvm::MemOp::Copy(), DL, llvm::dyn_cast(), 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(), SDValue(), llvm::MachineFrameInfo::setObjectAlignment(), shouldLowerMemFuncForSize(), 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 8973 of file SelectionDAG.cpp.
References assert(), llvm::EVT::bitsLT(), llvm::CallingConv::C, DL, llvm::dyn_cast(), llvm::TargetLowering::findOptimalMemOpLowering(), llvm::MachinePointerInfo::getAddrSpace(), llvm::Function::getAttributes(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getExtractVectorElt(), 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::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(), SDValue(), 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 8534 of file SelectionDAG.cpp.
References assert(), llvm::EVT::changeTypeToInteger(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getNode(), llvm::EVT::getSizeInBits(), llvm::EVT::getTypeForEVT(), llvm::EVT::isInteger(), llvm::DataLayout::isLittleEndian(), llvm::EVT::isVector(), SDValue(), and llvm::TargetLoweringBase::shouldConvertConstantLoadToIntImm().
Referenced by getMemcpyLoadsAndStores().
getMemsetValue - Vectorized representation of the memset value operand.
Definition at line 8493 of file SelectionDAG.cpp.
References assert(), llvm::CallingConv::C, llvm::dyn_cast(), 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 615 of file SelectionDAG.cpp.
References Operation, and llvm::ISD::SETTRUE2.
Referenced by llvm::ISD::getSetCCInverse(), and llvm::ISD::GlobalISel::getSetCCInverse().
Return true if a glue output should propagate divergence information.
Definition at line 12448 of file SelectionDAG.cpp.
References llvm::ISD::CopyFromReg, llvm::ISD::CopyToReg, and llvm_unreachable.
Referenced by llvm::SelectionDAG::calculateDivergence().
Definition at line 6245 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 9708 of file SelectionDAG.cpp.
References llvm::ISD::ADD, llvm::cast(), llvm::dyn_cast(), llvm::MachinePointerInfo::getFixedStack(), llvm::SelectionDAG::getMachineFunction(), Info, llvm::isa(), 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 9732 of file SelectionDAG.cpp.
References llvm::dyn_cast(), InferPointerInfo(), Info, and Ptr.
|
static |
Definition at line 9099 of file SelectionDAG.cpp.
References llvm::funcReturnsFirstArgOfCall(), llvm::SelectionDAG::getTarget(), llvm::isInTailCallPosition(), and llvm::CallInst::isTailCall().
Referenced by llvm::SelectionDAG::getMemcmp(), llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getMemmove(), and llvm::SelectionDAG::getStrlen().
|
static |
Returns true if memcpy source is constant data.
Definition at line 8595 of file SelectionDAG.cpp.
References llvm::cast(), 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 640 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 89 of file SelectionDAG.cpp.
Referenced by llvm::SelectionDAG::getVTList().
|
static |
Convert ConstantRange OverflowResult into SelectionDAG::OverflowKind.
Definition at line 4494 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 117 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::getAtomic(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getGatherVP(), llvm::SelectionDAG::getGetFPEnv(), llvm::SelectionDAG::getIndexedStoreVP(), llvm::SelectionDAG::getLifetimeNode(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getLoadFFVP(), 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::getNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNode(), 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::getTruncStoreVP(), llvm::SelectionDAG::getTruncStridedStoreVP(), and llvm::SelectionDAG::getVectorShuffle().
|
static |
Definition at line 8613 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 |
Referenced by getMemcpyLoadsAndStores().
|
static |
Referenced by getMemcpyLoadsAndStores().
|
static |
Referenced by canFoldStoreIntoLibCallOutputPointers(), llvm::SelectionDAG::getHasPredecessorMaxSteps(), getPostIndexedLoadStoreOp(), llvm::SDNode::hasPredecessorHelper(), isValidBaseUpdate(), PerformMVEVLDCombine(), shouldCombineToPostInc(), shouldTransformMulToShiftsAddsSubs(), and StepOverPredicatedInstrs().