LLVM API Documentation
#include "llvm/CodeGen/SelectionDAG.h"#include "llvm/Constants.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/Function.h"#include "llvm/GlobalAlias.h"#include "llvm/GlobalVariable.h"#include "llvm/Intrinsics.h"#include "llvm/DerivedTypes.h"#include "llvm/Assembly/Writer.h"#include "llvm/CallingConv.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineConstantPool.h"#include "llvm/CodeGen/MachineFrameInfo.h"#include "llvm/CodeGen/MachineModuleInfo.h"#include "llvm/CodeGen/PseudoSourceValue.h"#include "llvm/Target/TargetRegisterInfo.h"#include "llvm/Target/TargetData.h"#include "llvm/Target/TargetLowering.h"#include "llvm/Target/TargetOptions.h"#include "llvm/Target/TargetInstrInfo.h"#include "llvm/Target/TargetMachine.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/ManagedStatic.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/raw_ostream.h"#include "llvm/System/Mutex.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringExtras.h"#include <algorithm>#include <cmath>
Go to the source code of this file.
| typedef SmallPtrSet<const SDNode *, 128> VisitedSDNodeSet |
Definition at line 5673 of file SelectionDAG.cpp.
| static void AddNodeIDCustom | ( | FoldingSetNodeID & | ID, | |
| const SDNode * | N | |||
| ) | [static] |
AddNodeIDCustom - If this is an SDNode with special info, add this info to the NodeID data.
Definition at line 364 of file SelectionDAG.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::MachineConstantPoolValue::AddSelectionDAGCSEId(), llvm::ISD::ATOMIC_CMP_SWAP, llvm::ISD::ATOMIC_LOAD_ADD, llvm::ISD::ATOMIC_LOAD_AND, 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_SWAP, llvm::ISD::BasicBlock, llvm::ISD::Constant, llvm::ISD::ConstantFP, llvm::ISD::ConstantPool, CP, llvm::ISD::DBG_STOPPOINT, llvm::ISD::ExternalSymbol, llvm::ISD::FrameIndex, llvm::ConstantPoolSDNode::getAlignment(), llvm::SelectionDAG::getBasicBlock(), llvm::DbgStopPointSDNode::getColumn(), llvm::DbgStopPointSDNode::getCompileUnit(), llvm::ConstantPoolSDNode::getConstVal(), llvm::GlobalAddressSDNode::getGlobal(), llvm::DbgStopPointSDNode::getLine(), llvm::ConstantPoolSDNode::getMachineCPVal(), llvm::ShuffleVectorSDNode::getMaskElt(), llvm::MemSDNode::getMemoryVT(), llvm::ConstantPoolSDNode::getOffset(), llvm::GlobalAddressSDNode::getOffset(), llvm::SDNode::getOpcode(), llvm::EVT::getRawBits(), llvm::MemSDNode::getRawSubclassData(), llvm::ConstantPoolSDNode::getTargetFlags(), llvm::GlobalAddressSDNode::getTargetFlags(), llvm::SDNode::getValueType(), llvm::EVT::getVectorNumElements(), llvm::ISD::GlobalAddress, llvm::ISD::GlobalTLSAddress, llvm::ConstantPoolSDNode::isMachineConstantPoolEntry(), llvm::ISD::JumpTable, llvm_unreachable, llvm::ISD::LOAD, llvm::ISD::MEMOPERAND, llvm::MachineMemOperand::Profile(), llvm::ISD::Register, llvm::ISD::SRCVALUE, llvm::ISD::STORE, llvm::ISD::TargetConstant, llvm::ISD::TargetConstantFP, llvm::ISD::TargetConstantPool, llvm::ISD::TargetExternalSymbol, llvm::ISD::TargetFrameIndex, llvm::ISD::TargetGlobalAddress, llvm::ISD::TargetGlobalTLSAddress, llvm::ISD::TargetJumpTable, and llvm::ISD::VECTOR_SHUFFLE.
Referenced by AddNodeIDNode().
| static void AddNodeIDNode | ( | FoldingSetNodeID & | ID, | |
| const SDNode * | N | |||
| ) | [static] |
AddNodeIDNode - Generic routine for adding a nodes info to the NodeID data.
Definition at line 472 of file SelectionDAG.cpp.
References AddNodeIDCustom(), AddNodeIDOpcode(), AddNodeIDOperands(), AddNodeIDValueTypes(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOpcode(), llvm::SDNode::getVTList(), and llvm::SDNode::op_begin().
| static void AddNodeIDNode | ( | FoldingSetNodeID & | ID, | |
| unsigned short | OpC, | |||
| SDVTList | VTList, | |||
| const SDValue * | OpList, | |||
| unsigned | N | |||
| ) | [static] |
Definition at line 354 of file SelectionDAG.cpp.
References AddNodeIDOpcode(), AddNodeIDOperands(), and AddNodeIDValueTypes().
Referenced by llvm::SelectionDAG::getAtomic(), llvm::SelectionDAG::getBasicBlock(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getFrameIndex(), llvm::SelectionDAG::getGlobalAddress(), llvm::SelectionDAG::getIndexedStore(), llvm::SelectionDAG::getJumpTable(), llvm::SelectionDAG::getLabel(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getMemIntrinsicNode(), llvm::SelectionDAG::getMemOperand(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNodeIfExists(), llvm::SelectionDAG::getRegister(), llvm::SelectionDAG::getSrcValue(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTruncStore(), llvm::SelectionDAG::getVectorShuffle(), llvm::SelectionDAG::MorphNodeTo(), and llvm::SDNode::Profile().
| static void AddNodeIDOpcode | ( | FoldingSetNodeID & | ID, | |
| unsigned | OpC | |||
| ) | [static] |
AddNodeIDOpcode - Add the node opcode to the NodeID data.
Definition at line 324 of file SelectionDAG.cpp.
References llvm::FoldingSetNodeID::AddInteger().
Referenced by AddNodeIDNode().
| static void AddNodeIDOperands | ( | FoldingSetNodeID & | ID, | |
| const SDUse * | Ops, | |||
| unsigned | NumOps | |||
| ) | [static] |
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
Definition at line 346 of file SelectionDAG.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::SDUse::getNode(), and llvm::SDUse::getResNo().
| static void AddNodeIDOperands | ( | FoldingSetNodeID & | ID, | |
| const SDValue * | Ops, | |||
| unsigned | NumOps | |||
| ) | [static] |
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
Definition at line 336 of file SelectionDAG.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), llvm::SDValue::getNode(), and llvm::SDValue::getResNo().
Referenced by AddNodeIDNode().
| static void AddNodeIDValueTypes | ( | FoldingSetNodeID & | ID, | |
| SDVTList | VTList | |||
| ) | [static] |
AddNodeIDValueTypes - Value type lists are intern'd so we can represent them solely with their pointer.
Definition at line 330 of file SelectionDAG.cpp.
References llvm::FoldingSetNodeID::AddPointer(), and llvm::SDVTList::VTs.
Referenced by AddNodeIDNode().
| static void commuteShuffle | ( | SDValue & | N1, | |
| SDValue & | N2, | |||
| SmallVectorImpl< int > & | M | |||
| ) | [static] |
Definition at line 1151 of file SelectionDAG.cpp.
References llvm::SmallVectorImpl< T >::size(), and std::swap().
Referenced by llvm::SelectionDAG::getVectorShuffle().
doNotCSE - Return true if CSE should not be performed for this node.
Definition at line 505 of file SelectionDAG.cpp.
References llvm::ISD::DBG_LABEL, llvm::ISD::DBG_STOPPOINT, llvm::ISD::DECLARE, llvm::ISD::EH_LABEL, llvm::MVT::Flag, llvm::SDNode::getNumValues(), llvm::SDNode::getOpcode(), llvm::SDNode::getValueType(), and llvm::ISD::HANDLENODE.
| static void DumpNodes | ( | const SDNode * | N, | |
| unsigned | indent, | |||
| const SelectionDAG * | G | |||
| ) | [static] |
Definition at line 5640 of file SelectionDAG.cpp.
| static void DumpNodesr | ( | raw_ostream & | OS, | |
| const SDNode * | N, | |||
| unsigned | indent, | |||
| const SelectionDAG * | G, | |||
| VisitedSDNodeSet & | once | |||
| ) | [static] |
| static unsigned encodeMemSDNodeFlags | ( | int | ConvType, | |
| ISD::MemIndexedMode | AM, | |||
| bool | isVolatile, | |||
| unsigned | Alignment | |||
| ) | [inline, static] |
encodeMemSDNodeFlags - Generic routine for computing a value for use in the CSE map that carries alignment, volatility, indexing mode, and extension/truncation information.
Definition at line 488 of file SelectionDAG.cpp.
References llvm::Log2_32().
Referenced by llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTruncStore(), and llvm::MemSDNode::MemSDNode().
| static const fltSemantics* EVTToAPFloatSemantics | ( | EVT | VT | ) | [static] |
Definition at line 56 of file SelectionDAG.cpp.
References llvm::EVT::getSimpleVT(), llvm_unreachable, and llvm::MVT::SimpleTy.
Referenced by llvm::SelectionDAG::getNode(), and llvm::ConstantFPSDNode::isValueValidForType().
| static void findPredecessor | ( | SDNode * | N, | |
| const SDNode * | P, | |||
| bool & | found, | |||
| SmallPtrSet< SDNode *, 32 > & | Visited | |||
| ) | [static] |
Definition at line 5129 of file SelectionDAG.cpp.
References llvm::SDValue::getNode(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), and llvm::SmallPtrSet< PtrType, SmallSize >::insert().
Referenced by llvm::SDNode::isPredecessorOf().
| static SDValue getMemBasePlusOffset | ( | SDValue | Base, | |
| unsigned | Offset, | |||
| SelectionDAG & | DAG | |||
| ) | [static] |
getMemBasePlusOffset - Returns base and offset node for the
Definition at line 3066 of file SelectionDAG.cpp.
References llvm::ISD::ADD, llvm::SelectionDAG::getConstant(), llvm::SDValue::getDebugLoc(), llvm::SelectionDAG::getNode(), and llvm::SDValue::getValueType().
Referenced by getMemcpyLoadsAndStores(), getMemmoveLoadsAndStores(), and getMemsetStores().
| static SDValue getMemcpyLoadsAndStores | ( | SelectionDAG & | DAG, | |
| DebugLoc | dl, | |||
| SDValue | Chain, | |||
| SDValue | Dst, | |||
| SDValue | Src, | |||
| uint64_t | Size, | |||
| unsigned | Align, | |||
| bool | AlwaysInline, | |||
| const Value * | DstSV, | |||
| uint64_t | DstSVOff, | |||
| const Value * | SrcSV, | |||
| uint64_t | SrcSVOff | |||
| ) | [static] |
Definition at line 3184 of file SelectionDAG.cpp.
References llvm::EVT::bitsGE(), llvm::ISD::EXTLOAD, llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getExtLoad(), llvm::TargetLowering::getMaxStoresPerMemcpy(), getMemBasePlusOffset(), getMemsetStringVal(), llvm::SelectionDAG::getNode(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::SelectionDAG::getTruncStore(), llvm::TargetLowering::getTypeToTransformTo(), llvm::EVT::isVector(), MeetsMaxMemopRequirement(), llvm::MVT::Other, llvm::SmallVectorImpl< T >::push_back(), llvm::SmallVectorImpl< T >::size(), llvm::SPII::Store, and llvm::ISD::TokenFactor.
Referenced by llvm::SelectionDAG::getMemcpy().
| static SDValue getMemmoveLoadsAndStores | ( | SelectionDAG & | DAG, | |
| DebugLoc | dl, | |||
| SDValue | Chain, | |||
| SDValue | Dst, | |||
| SDValue | Src, | |||
| uint64_t | Size, | |||
| unsigned | Align, | |||
| bool | AlwaysInline, | |||
| const Value * | DstSV, | |||
| uint64_t | DstSVOff, | |||
| const Value * | SrcSV, | |||
| uint64_t | SrcSVOff | |||
| ) | [static] |
Definition at line 3249 of file SelectionDAG.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::SelectionDAG::getLoad(), llvm::TargetLowering::getMaxStoresPerMemmove(), getMemBasePlusOffset(), llvm::SelectionDAG::getNode(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::SDValue::getValue(), MeetsMaxMemopRequirement(), llvm::MVT::Other, llvm::SmallVectorImpl< T >::push_back(), llvm::SmallVectorImpl< T >::size(), llvm::SPII::Store, and llvm::ISD::TokenFactor.
Referenced by llvm::SelectionDAG::getMemmove().
| static SDValue getMemsetStores | ( | SelectionDAG & | DAG, | |
| DebugLoc | dl, | |||
| SDValue | Chain, | |||
| SDValue | Dst, | |||
| SDValue | Src, | |||
| uint64_t | Size, | |||
| unsigned | Align, | |||
| const Value * | DstSV, | |||
| uint64_t | DstSVOff | |||
| ) | [static] |
Definition at line 3307 of file SelectionDAG.cpp.
References llvm::TargetLowering::getMaxStoresPerMemset(), getMemBasePlusOffset(), getMemsetValue(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getTargetLoweringInfo(), MeetsMaxMemopRequirement(), llvm::MVT::Other, llvm::SmallVectorImpl< T >::push_back(), llvm::SmallVectorImpl< T >::size(), llvm::SPII::Store, and llvm::ISD::TokenFactor.
Referenced by llvm::SelectionDAG::getMemset().
| static SDValue getMemsetStringVal | ( | EVT | VT, | |
| DebugLoc | dl, | |||
| SelectionDAG & | DAG, | |||
| const TargetLowering & | TLI, | |||
| std::string & | Str, | |||
| unsigned | Offset | |||
| ) | [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 3037 of file SelectionDAG.cpp.
References llvm::ISD::BIT_CONVERT, llvm::MVT::f32, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getNode(), llvm::EVT::getSizeInBits(), llvm::EVT::getVectorElementType(), llvm::EVT::getVectorNumElements(), llvm::EVT::getVectorVT(), llvm::MVT::i32, llvm::MVT::i64, llvm::EVT::isInteger(), llvm::TargetLowering::isLittleEndian(), llvm::EVT::isVector(), and Val.
Referenced by getMemcpyLoadsAndStores().
| static SDValue getMemsetValue | ( | SDValue | Value, | |
| EVT | VT, | |||
| SelectionDAG & | DAG, | |||
| DebugLoc | dl | |||
| ) | [static] |
getMemsetValue - Vectorized representation of the memset value operand.
Definition at line 3003 of file SelectionDAG.cpp.
References llvm::lltok::APFloat, llvm::CallingConv::C, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getNode(), llvm::TargetLowering::getShiftAmountTy(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::EVT::getVectorElementType(), llvm::EVT::isInteger(), llvm::EVT::isVector(), llvm::ISD::OR, llvm::ISD::SHL, Val, and llvm::ISD::ZERO_EXTEND.
Referenced by getMemsetStores().
isMemSrcFromString - Returns true if memcpy source is a string constant.
Definition at line 3075 of file SelectionDAG.cpp.
References llvm::ISD::ADD, llvm::ISD::Constant, llvm::dyn_cast(), G, llvm::GetConstantStringInfo(), llvm::GlobalAddressSDNode::getGlobal(), llvm::SDValue::getOpcode(), llvm::SDValue::getOperand(), llvm::ISD::GlobalAddress, and GV.
Referenced by MeetsMaxMemopRequirement().
| static int isSignedOp | ( | ISD::CondCode | Opcode | ) | [static] |
isSignedOp - 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 246 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 51 of file SelectionDAG.cpp.
Referenced by llvm::SelectionDAG::getMemIntrinsicNode(), llvm::SelectionDAG::getNode(), and llvm::SelectionDAG::getVTList().
| static bool MeetsMaxMemopRequirement | ( | std::vector< EVT > & | MemOps, | |
| SDValue | Dst, | |||
| SDValue | Src, | |||
| unsigned | Limit, | |||
| uint64_t | Size, | |||
| unsigned & | Align, | |||
| std::string & | Str, | |||
| bool & | isSrcStr, | |||
| SelectionDAG & | DAG, | |||
| const TargetLowering & | TLI | |||
| ) | [static] |
MeetsMaxMemopRequirement - Determines if the number of memory ops required to replace the memset / memcpy is below the threshold. It also returns the types of the sequence of memory ops to perform memset / memcpy.
Definition at line 3100 of file SelectionDAG.cpp.
References llvm::TargetLowering::allowsUnalignedMemoryAccesses(), FI, llvm::ISD::FrameIndex, llvm::TargetData::getABITypeAlignment(), llvm::SelectionDAG::getContext(), llvm::MachineFunction::getFrameInfo(), llvm::SelectionDAG::getMachineFunction(), llvm::MachineFrameInfo::getObjectAlignment(), llvm::SDValue::getOpcode(), llvm::TargetLowering::getOptimalMemOpType(), llvm::MVT::getSizeInBits(), llvm::TargetLowering::getTargetData(), llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i64, llvm::MVT::i8, llvm::MVT::iAny, llvm::MachineFrameInfo::isFixedObjectIndex(), llvm::MVT::isInteger(), isMemSrcFromString(), llvm::TargetLowering::isTypeLegal(), MFI, llvm::MachineFrameInfo::setObjectAlignment(), and llvm::MVT::SimpleTy.
Referenced by getMemcpyLoadsAndStores(), getMemmoveLoadsAndStores(), and getMemsetStores().
| bool @676::operator< | ( | const UseMemo & | L, | |
| const UseMemo & | R | |||
| ) | [static] |
ManagedStatic<std::set<EVT, EVT::compareRawBits> > EVTs [static] |
Definition at line 5018 of file SelectionDAG.cpp.
Definition at line 4799 of file SelectionDAG.cpp.
Definition at line 4800 of file SelectionDAG.cpp.
Definition at line 4798 of file SelectionDAG.cpp.
Referenced by ChangeCalleesToFastCall(), and RemoveNestAttribute().
ManagedStatic<sys::SmartMutex<true> > VTMutex [static] |
Definition at line 5020 of file SelectionDAG.cpp.
Definition at line 5019 of file SelectionDAG.cpp.
Referenced by llvm::SelectionDAG::getAtomic(), llvm::SelectionDAG::getCopyToReg(), llvm::SelectionDAG::getIndexedStore(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getMergeValues(), llvm::SelectionDAG::getNode(), llvm::PIC16TargetLowering::getPIC16Cmp(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTargetNode(), llvm::SelectionDAG::getTruncStore(), LowerBR_CC(), llvm::PIC16TargetLowering::LowerFormalArguments(), llvm::PIC16TargetLowering::LowerReturn(), llvm::SystemZTargetLowering::LowerSELECT_CC(), LowerSELECT_CC(), llvm::MSP430TargetLowering::LowerSELECT_CC(), llvm::SelectionDAG::MorphNodeTo(), llvm::SelectionDAG::SelectNodeTo(), and llvm::X86InstrInfo::unfoldMemoryOperand().