#include "SelectionDAGBuilder.h"
#include "SDNodeDbgValue.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/AssignmentTrackingAnalysis.h"
#include "llvm/CodeGen/CodeGenCommonISel.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundleIterator.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RuntimeLibcallUtil.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/CodeGen/SwiftErrorValueTracking.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MemoryModelRelaxationAnnotations.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/InstructionCost.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cstddef>
#include <deque>
#include <iterator>
#include <limits>
#include <optional>
#include <tuple>
usingnamespacellvm;
usingnamespacePatternMatch;
usingnamespaceSwitchCG;
#define DEBUG_TYPE …
static unsigned LimitFloatPrecision;
static cl::opt<bool>
InsertAssertAlign("insert-assert-align", cl::init(true),
cl::desc("Insert the experimental `assertalign` node."),
cl::ReallyHidden);
static cl::opt<unsigned, true>
LimitFPPrecision("limit-float-precision",
cl::desc("Generate low-precision inline sequences "
"for some float libcalls"),
cl::location(LimitFloatPrecision), cl::Hidden,
cl::init(0));
static cl::opt<unsigned> SwitchPeelThreshold(
"switch-peel-threshold", cl::Hidden, cl::init(66),
cl::desc("Set the case probability threshold for peeling the case from a "
"switch statement. A value greater than 100 will void this "
"optimization"));
static const unsigned MaxParallelChains = …;
static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL,
const SDValue *Parts, unsigned NumParts,
MVT PartVT, EVT ValueVT, const Value *V,
SDValue InChain,
std::optional<CallingConv::ID> CC);
static SDValue
getCopyFromParts(SelectionDAG &DAG, const SDLoc &DL, const SDValue *Parts,
unsigned NumParts, MVT PartVT, EVT ValueVT, const Value *V,
SDValue InChain,
std::optional<CallingConv::ID> CC = std::nullopt,
std::optional<ISD::NodeType> AssertOp = std::nullopt) { … }
static void diagnosePossiblyInvalidConstraint(LLVMContext &Ctx, const Value *V,
const Twine &ErrMsg) { … }
static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL,
const SDValue *Parts, unsigned NumParts,
MVT PartVT, EVT ValueVT, const Value *V,
SDValue InChain,
std::optional<CallingConv::ID> CallConv) { … }
static void getCopyToPartsVector(SelectionDAG &DAG, const SDLoc &dl,
SDValue Val, SDValue *Parts, unsigned NumParts,
MVT PartVT, const Value *V,
std::optional<CallingConv::ID> CallConv);
static void
getCopyToParts(SelectionDAG &DAG, const SDLoc &DL, SDValue Val, SDValue *Parts,
unsigned NumParts, MVT PartVT, const Value *V,
std::optional<CallingConv::ID> CallConv = std::nullopt,
ISD::NodeType ExtendKind = ISD::ANY_EXTEND) { … }
static SDValue widenVectorToPartType(SelectionDAG &DAG, SDValue Val,
const SDLoc &DL, EVT PartVT) { … }
static void getCopyToPartsVector(SelectionDAG &DAG, const SDLoc &DL,
SDValue Val, SDValue *Parts, unsigned NumParts,
MVT PartVT, const Value *V,
std::optional<CallingConv::ID> CallConv) { … }
RegsForValue::RegsForValue(const SmallVector<Register, 4> ®s, MVT regvt,
EVT valuevt, std::optional<CallingConv::ID> CC)
: … { … }
RegsForValue::RegsForValue(LLVMContext &Context, const TargetLowering &TLI,
const DataLayout &DL, Register Reg, Type *Ty,
std::optional<CallingConv::ID> CC) { … }
SDValue RegsForValue::getCopyFromRegs(SelectionDAG &DAG,
FunctionLoweringInfo &FuncInfo,
const SDLoc &dl, SDValue &Chain,
SDValue *Glue, const Value *V) const { … }
void RegsForValue::getCopyToRegs(SDValue Val, SelectionDAG &DAG,
const SDLoc &dl, SDValue &Chain, SDValue *Glue,
const Value *V,
ISD::NodeType PreferredExtendType) const { … }
void RegsForValue::AddInlineAsmOperands(InlineAsm::Kind Code, bool HasMatching,
unsigned MatchingIdx, const SDLoc &dl,
SelectionDAG &DAG,
std::vector<SDValue> &Ops) const { … }
SmallVector<std::pair<Register, TypeSize>, 4>
RegsForValue::getRegsAndSizes() const { … }
void SelectionDAGBuilder::init(GCFunctionInfo *gfi, AliasAnalysis *aa,
AssumptionCache *ac,
const TargetLibraryInfo *li) { … }
void SelectionDAGBuilder::clear() { … }
void SelectionDAGBuilder::clearDanglingDebugInfo() { … }
SDValue SelectionDAGBuilder::updateRoot(SmallVectorImpl<SDValue> &Pending) { … }
SDValue SelectionDAGBuilder::getMemoryRoot() { … }
SDValue SelectionDAGBuilder::getRoot() { … }
SDValue SelectionDAGBuilder::getControlRoot() { … }
void SelectionDAGBuilder::handleDebugDeclare(Value *Address,
DILocalVariable *Variable,
DIExpression *Expression,
DebugLoc DL) { … }
void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) { … }
void SelectionDAGBuilder::visit(const Instruction &I) { … }
void SelectionDAGBuilder::visitPHI(const PHINode &) { … }
void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) { … }
static bool handleDanglingVariadicDebugInfo(SelectionDAG &DAG,
DILocalVariable *Variable,
DebugLoc DL, unsigned Order,
SmallVectorImpl<Value *> &Values,
DIExpression *Expression) { … }
void SelectionDAGBuilder::addDanglingDebugInfo(SmallVectorImpl<Value *> &Values,
DILocalVariable *Var,
DIExpression *Expr,
bool IsVariadic, DebugLoc DL,
unsigned Order) { … }
void SelectionDAGBuilder::dropDanglingDebugInfo(const DILocalVariable *Variable,
const DIExpression *Expr) { … }
void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V,
SDValue Val) { … }
void SelectionDAGBuilder::salvageUnresolvedDbgValue(const Value *V,
DanglingDebugInfo &DDI) { … }
void SelectionDAGBuilder::handleKillDebugValue(DILocalVariable *Var,
DIExpression *Expr,
DebugLoc DbgLoc,
unsigned Order) { … }
bool SelectionDAGBuilder::handleDebugValue(ArrayRef<const Value *> Values,
DILocalVariable *Var,
DIExpression *Expr, DebugLoc DbgLoc,
unsigned Order, bool IsVariadic) { … }
void SelectionDAGBuilder::resolveOrClearDbgInfo() { … }
SDValue SelectionDAGBuilder::getCopyFromRegs(const Value *V, Type *Ty) { … }
SDValue SelectionDAGBuilder::getValue(const Value *V) { … }
SDValue SelectionDAGBuilder::getNonRegisterValue(const Value *V) { … }
SDValue SelectionDAGBuilder::getValueImpl(const Value *V) { … }
void SelectionDAGBuilder::visitCatchPad(const CatchPadInst &I) { … }
void SelectionDAGBuilder::visitCatchRet(const CatchReturnInst &I) { … }
void SelectionDAGBuilder::visitCleanupPad(const CleanupPadInst &CPI) { … }
static void findWasmUnwindDestinations(
FunctionLoweringInfo &FuncInfo, const BasicBlock *EHPadBB,
BranchProbability Prob,
SmallVectorImpl<std::pair<MachineBasicBlock *, BranchProbability>>
&UnwindDests) { … }
static void findUnwindDestinations(
FunctionLoweringInfo &FuncInfo, const BasicBlock *EHPadBB,
BranchProbability Prob,
SmallVectorImpl<std::pair<MachineBasicBlock *, BranchProbability>>
&UnwindDests) { … }
void SelectionDAGBuilder::visitCleanupRet(const CleanupReturnInst &I) { … }
void SelectionDAGBuilder::visitCatchSwitch(const CatchSwitchInst &CSI) { … }
void SelectionDAGBuilder::visitRet(const ReturnInst &I) { … }
void SelectionDAGBuilder::CopyToExportRegsIfNeeded(const Value *V) { … }
void SelectionDAGBuilder::ExportFromCurrentBlock(const Value *V) { … }
bool SelectionDAGBuilder::isExportableFromCurrentBlock(const Value *V,
const BasicBlock *FromBB) { … }
BranchProbability
SelectionDAGBuilder::getEdgeProbability(const MachineBasicBlock *Src,
const MachineBasicBlock *Dst) const { … }
void SelectionDAGBuilder::addSuccessorWithProb(MachineBasicBlock *Src,
MachineBasicBlock *Dst,
BranchProbability Prob) { … }
static bool InBlock(const Value *V, const BasicBlock *BB) { … }
void
SelectionDAGBuilder::EmitBranchForMergedCondition(const Value *Cond,
MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
MachineBasicBlock *CurBB,
MachineBasicBlock *SwitchBB,
BranchProbability TProb,
BranchProbability FProb,
bool InvertCond) { … }
static bool collectInstructionDeps(
SmallMapVector<const Instruction *, bool, 8> *Deps, const Value *V,
SmallMapVector<const Instruction *, bool, 8> *Necessary = nullptr,
unsigned Depth = 0) { … }
bool SelectionDAGBuilder::shouldKeepJumpConditionsTogether(
const FunctionLoweringInfo &FuncInfo, const BranchInst &I,
Instruction::BinaryOps Opc, const Value *Lhs, const Value *Rhs,
TargetLoweringBase::CondMergingParams Params) const { … }
void SelectionDAGBuilder::FindMergedConditions(const Value *Cond,
MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
MachineBasicBlock *CurBB,
MachineBasicBlock *SwitchBB,
Instruction::BinaryOps Opc,
BranchProbability TProb,
BranchProbability FProb,
bool InvertCond) { … }
bool
SelectionDAGBuilder::ShouldEmitAsBranches(const std::vector<CaseBlock> &Cases) { … }
void SelectionDAGBuilder::visitBr(const BranchInst &I) { … }
void SelectionDAGBuilder::visitSwitchCase(CaseBlock &CB,
MachineBasicBlock *SwitchBB) { … }
void SelectionDAGBuilder::visitJumpTable(SwitchCG::JumpTable &JT) { … }
void SelectionDAGBuilder::visitJumpTableHeader(SwitchCG::JumpTable &JT,
JumpTableHeader &JTH,
MachineBasicBlock *SwitchBB) { … }
static SDValue getLoadStackGuard(SelectionDAG &DAG, const SDLoc &DL,
SDValue &Chain) { … }
void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
MachineBasicBlock *ParentBB) { … }
void
SelectionDAGBuilder::visitSPDescriptorFailure(StackProtectorDescriptor &SPD) { … }
void SelectionDAGBuilder::visitBitTestHeader(BitTestBlock &B,
MachineBasicBlock *SwitchBB) { … }
void SelectionDAGBuilder::visitBitTestCase(BitTestBlock &BB,
MachineBasicBlock *NextMBB,
BranchProbability BranchProbToNext,
Register Reg, BitTestCase &B,
MachineBasicBlock *SwitchBB) { … }
void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) { … }
void SelectionDAGBuilder::visitCallBr(const CallBrInst &I) { … }
void SelectionDAGBuilder::visitResume(const ResumeInst &RI) { … }
void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &LP) { … }
void SelectionDAGBuilder::UpdateSplitBlock(MachineBasicBlock *First,
MachineBasicBlock *Last) { … }
void SelectionDAGBuilder::visitIndirectBr(const IndirectBrInst &I) { … }
void SelectionDAGBuilder::visitUnreachable(const UnreachableInst &I) { … }
void SelectionDAGBuilder::visitUnary(const User &I, unsigned Opcode) { … }
void SelectionDAGBuilder::visitBinary(const User &I, unsigned Opcode) { … }
void SelectionDAGBuilder::visitShift(const User &I, unsigned Opcode) { … }
void SelectionDAGBuilder::visitSDiv(const User &I) { … }
void SelectionDAGBuilder::visitICmp(const ICmpInst &I) { … }
void SelectionDAGBuilder::visitFCmp(const FCmpInst &I) { … }
static bool hasOnlySelectUsers(const Value *Cond) { … }
void SelectionDAGBuilder::visitSelect(const User &I) { … }
void SelectionDAGBuilder::visitTrunc(const User &I) { … }
void SelectionDAGBuilder::visitZExt(const User &I) { … }
void SelectionDAGBuilder::visitSExt(const User &I) { … }
void SelectionDAGBuilder::visitFPTrunc(const User &I) { … }
void SelectionDAGBuilder::visitFPExt(const User &I) { … }
void SelectionDAGBuilder::visitFPToUI(const User &I) { … }
void SelectionDAGBuilder::visitFPToSI(const User &I) { … }
void SelectionDAGBuilder::visitUIToFP(const User &I) { … }
void SelectionDAGBuilder::visitSIToFP(const User &I) { … }
void SelectionDAGBuilder::visitPtrToInt(const User &I) { … }
void SelectionDAGBuilder::visitIntToPtr(const User &I) { … }
void SelectionDAGBuilder::visitBitCast(const User &I) { … }
void SelectionDAGBuilder::visitAddrSpaceCast(const User &I) { … }
void SelectionDAGBuilder::visitInsertElement(const User &I) { … }
void SelectionDAGBuilder::visitExtractElement(const User &I) { … }
void SelectionDAGBuilder::visitShuffleVector(const User &I) { … }
void SelectionDAGBuilder::visitInsertValue(const InsertValueInst &I) { … }
void SelectionDAGBuilder::visitExtractValue(const ExtractValueInst &I) { … }
void SelectionDAGBuilder::visitGetElementPtr(const User &I) { … }
void SelectionDAGBuilder::visitAlloca(const AllocaInst &I) { … }
static const MDNode *getRangeMetadata(const Instruction &I) { … }
static std::optional<ConstantRange> getRange(const Instruction &I) { … }
void SelectionDAGBuilder::visitLoad(const LoadInst &I) { … }
void SelectionDAGBuilder::visitStoreToSwiftError(const StoreInst &I) { … }
void SelectionDAGBuilder::visitLoadFromSwiftError(const LoadInst &I) { … }
void SelectionDAGBuilder::visitStore(const StoreInst &I) { … }
void SelectionDAGBuilder::visitMaskedStore(const CallInst &I,
bool IsCompressing) { … }
static bool getUniformBase(const Value *Ptr, SDValue &Base, SDValue &Index,
ISD::MemIndexType &IndexType, SDValue &Scale,
SelectionDAGBuilder *SDB, const BasicBlock *CurBB,
uint64_t ElemSize) { … }
void SelectionDAGBuilder::visitMaskedScatter(const CallInst &I) { … }
void SelectionDAGBuilder::visitMaskedLoad(const CallInst &I, bool IsExpanding) { … }
void SelectionDAGBuilder::visitMaskedGather(const CallInst &I) { … }
void SelectionDAGBuilder::visitAtomicCmpXchg(const AtomicCmpXchgInst &I) { … }
void SelectionDAGBuilder::visitAtomicRMW(const AtomicRMWInst &I) { … }
void SelectionDAGBuilder::visitFence(const FenceInst &I) { … }
void SelectionDAGBuilder::visitAtomicLoad(const LoadInst &I) { … }
void SelectionDAGBuilder::visitAtomicStore(const StoreInst &I) { … }
void SelectionDAGBuilder::visitTargetIntrinsic(const CallInst &I,
unsigned Intrinsic) { … }
static SDValue GetSignificand(SelectionDAG &DAG, SDValue Op, const SDLoc &dl) { … }
static SDValue GetExponent(SelectionDAG &DAG, SDValue Op,
const TargetLowering &TLI, const SDLoc &dl) { … }
static SDValue getF32Constant(SelectionDAG &DAG, unsigned Flt,
const SDLoc &dl) { … }
static SDValue getLimitedPrecisionExp2(SDValue t0, const SDLoc &dl,
SelectionDAG &DAG) { … }
static SDValue expandExp(const SDLoc &dl, SDValue Op, SelectionDAG &DAG,
const TargetLowering &TLI, SDNodeFlags Flags) { … }
static SDValue expandLog(const SDLoc &dl, SDValue Op, SelectionDAG &DAG,
const TargetLowering &TLI, SDNodeFlags Flags) { … }
static SDValue expandLog2(const SDLoc &dl, SDValue Op, SelectionDAG &DAG,
const TargetLowering &TLI, SDNodeFlags Flags) { … }
static SDValue expandLog10(const SDLoc &dl, SDValue Op, SelectionDAG &DAG,
const TargetLowering &TLI, SDNodeFlags Flags) { … }
static SDValue expandExp2(const SDLoc &dl, SDValue Op, SelectionDAG &DAG,
const TargetLowering &TLI, SDNodeFlags Flags) { … }
static SDValue expandPow(const SDLoc &dl, SDValue LHS, SDValue RHS,
SelectionDAG &DAG, const TargetLowering &TLI,
SDNodeFlags Flags) { … }
static SDValue ExpandPowI(const SDLoc &DL, SDValue LHS, SDValue RHS,
SelectionDAG &DAG) { … }
static SDValue expandDivFix(unsigned Opcode, const SDLoc &DL,
SDValue LHS, SDValue RHS, SDValue Scale,
SelectionDAG &DAG, const TargetLowering &TLI) { … }
static void
getUnderlyingArgRegs(SmallVectorImpl<std::pair<Register, TypeSize>> &Regs,
const SDValue &N) { … }
bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
const Value *V, DILocalVariable *Variable, DIExpression *Expr,
DILocation *DL, FuncArgumentDbgValueKind Kind, const SDValue &N) { … }
SDDbgValue *SelectionDAGBuilder::getDbgValue(SDValue N,
DILocalVariable *Variable,
DIExpression *Expr,
const DebugLoc &dl,
unsigned DbgSDNodeOrder) { … }
static unsigned FixedPointIntrinsicToOpcode(unsigned Intrinsic) { … }
void SelectionDAGBuilder::lowerCallToExternalSymbol(const CallInst &I,
const char *FunctionName) { … }
static const CallBase *FindPreallocatedCall(const Value *PreallocatedSetup) { … }
bool SelectionDAGBuilder::visitEntryValueDbgValue(
ArrayRef<const Value *> Values, DILocalVariable *Variable,
DIExpression *Expr, DebugLoc DbgLoc) { … }
void SelectionDAGBuilder::visitConvergenceControl(const CallInst &I,
unsigned Intrinsic) { … }
void SelectionDAGBuilder::visitVectorHistogram(const CallInst &I,
unsigned IntrinsicID) { … }
void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
unsigned Intrinsic) { … }
void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
const ConstrainedFPIntrinsic &FPI) { … }
static unsigned getISDForVPIntrinsic(const VPIntrinsic &VPIntrin) { … }
void SelectionDAGBuilder::visitVPLoad(
const VPIntrinsic &VPIntrin, EVT VT,
const SmallVectorImpl<SDValue> &OpValues) { … }
void SelectionDAGBuilder::visitVPGather(
const VPIntrinsic &VPIntrin, EVT VT,
const SmallVectorImpl<SDValue> &OpValues) { … }
void SelectionDAGBuilder::visitVPStore(
const VPIntrinsic &VPIntrin, const SmallVectorImpl<SDValue> &OpValues) { … }
void SelectionDAGBuilder::visitVPScatter(
const VPIntrinsic &VPIntrin, const SmallVectorImpl<SDValue> &OpValues) { … }
void SelectionDAGBuilder::visitVPStridedLoad(
const VPIntrinsic &VPIntrin, EVT VT,
const SmallVectorImpl<SDValue> &OpValues) { … }
void SelectionDAGBuilder::visitVPStridedStore(
const VPIntrinsic &VPIntrin, const SmallVectorImpl<SDValue> &OpValues) { … }
void SelectionDAGBuilder::visitVPCmp(const VPCmpIntrinsic &VPIntrin) { … }
void SelectionDAGBuilder::visitVectorPredicationIntrinsic(
const VPIntrinsic &VPIntrin) { … }
SDValue SelectionDAGBuilder::lowerStartEH(SDValue Chain,
const BasicBlock *EHPadBB,
MCSymbol *&BeginLabel) { … }
SDValue SelectionDAGBuilder::lowerEndEH(SDValue Chain, const InvokeInst *II,
const BasicBlock *EHPadBB,
MCSymbol *BeginLabel) { … }
std::pair<SDValue, SDValue>
SelectionDAGBuilder::lowerInvokable(TargetLowering::CallLoweringInfo &CLI,
const BasicBlock *EHPadBB) { … }
void SelectionDAGBuilder::LowerCallTo(const CallBase &CB, SDValue Callee,
bool isTailCall, bool isMustTailCall,
const BasicBlock *EHPadBB,
const TargetLowering::PtrAuthInfo *PAI) { … }
static SDValue getMemCmpLoad(const Value *PtrVal, MVT LoadVT,
SelectionDAGBuilder &Builder) { … }
void SelectionDAGBuilder::processIntegerCallValue(const Instruction &I,
SDValue Value,
bool IsSigned) { … }
bool SelectionDAGBuilder::visitMemCmpBCmpCall(const CallInst &I) { … }
bool SelectionDAGBuilder::visitMemChrCall(const CallInst &I) { … }
bool SelectionDAGBuilder::visitMemPCpyCall(const CallInst &I) { … }
bool SelectionDAGBuilder::visitStrCpyCall(const CallInst &I, bool isStpcpy) { … }
bool SelectionDAGBuilder::visitStrCmpCall(const CallInst &I) { … }
bool SelectionDAGBuilder::visitStrLenCall(const CallInst &I) { … }
bool SelectionDAGBuilder::visitStrNLenCall(const CallInst &I) { … }
bool SelectionDAGBuilder::visitUnaryFloatCall(const CallInst &I,
unsigned Opcode) { … }
bool SelectionDAGBuilder::visitBinaryFloatCall(const CallInst &I,
unsigned Opcode) { … }
void SelectionDAGBuilder::visitCall(const CallInst &I) { … }
void SelectionDAGBuilder::LowerCallSiteWithPtrAuthBundle(
const CallBase &CB, const BasicBlock *EHPadBB) { … }
namespace {
class SDISelAsmOperandInfo : public TargetLowering::AsmOperandInfo { … };
}
static void patchMatchingInput(const SDISelAsmOperandInfo &OpInfo,
SDISelAsmOperandInfo &MatchingOpInfo,
SelectionDAG &DAG) { … }
static SDValue getAddressForMemoryInput(SDValue Chain, const SDLoc &Location,
SDISelAsmOperandInfo &OpInfo,
SelectionDAG &DAG) { … }
static std::optional<unsigned>
getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
SDISelAsmOperandInfo &OpInfo,
SDISelAsmOperandInfo &RefOpInfo) { … }
static unsigned
findMatchingInlineAsmOperand(unsigned OperandNo,
const std::vector<SDValue> &AsmNodeOperands) { … }
namespace {
class ExtraFlags { … };
}
static bool isFunction(SDValue Op) { … }
void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call,
const BasicBlock *EHPadBB) { … }
void SelectionDAGBuilder::emitInlineAsmError(const CallBase &Call,
const Twine &Message) { … }
void SelectionDAGBuilder::visitVAStart(const CallInst &I) { … }
void SelectionDAGBuilder::visitVAArg(const VAArgInst &I) { … }
void SelectionDAGBuilder::visitVAEnd(const CallInst &I) { … }
void SelectionDAGBuilder::visitVACopy(const CallInst &I) { … }
SDValue SelectionDAGBuilder::lowerRangeToAssertZExt(SelectionDAG &DAG,
const Instruction &I,
SDValue Op) { … }
void SelectionDAGBuilder::populateCallLoweringInfo(
TargetLowering::CallLoweringInfo &CLI, const CallBase *Call,
unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy,
AttributeSet RetAttrs, bool IsPatchPoint) { … }
static void addStackMapLiveVars(const CallBase &Call, unsigned StartIdx,
const SDLoc &DL, SmallVectorImpl<SDValue> &Ops,
SelectionDAGBuilder &Builder) { … }
void SelectionDAGBuilder::visitStackmap(const CallInst &CI) { … }
void SelectionDAGBuilder::visitPatchpoint(const CallBase &CB,
const BasicBlock *EHPadBB) { … }
void SelectionDAGBuilder::visitVectorReduce(const CallInst &I,
unsigned Intrinsic) { … }
static AttributeList getReturnAttrs(TargetLowering::CallLoweringInfo &CLI) { … }
std::pair<SDValue, SDValue>
TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { … }
void TargetLowering::LowerOperationWrapper(SDNode *N,
SmallVectorImpl<SDValue> &Results,
SelectionDAG &DAG) const { … }
SDValue TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const { … }
void SelectionDAGBuilder::CopyValueToVirtualRegister(const Value *V,
unsigned Reg,
ISD::NodeType ExtendType) { … }
#include "llvm/CodeGen/SelectionDAGISel.h"
static bool isOnlyUsedInEntryBlock(const Argument *A, bool FastISel) { … }
ArgCopyElisionMapTy;
static void
findArgumentCopyElisionCandidates(const DataLayout &DL,
FunctionLoweringInfo *FuncInfo,
ArgCopyElisionMapTy &ArgCopyElisionCandidates) { … }
static void tryToElideArgumentCopy(
FunctionLoweringInfo &FuncInfo, SmallVectorImpl<SDValue> &Chains,
DenseMap<int, int> &ArgCopyElisionFrameIndexMap,
SmallPtrSetImpl<const Instruction *> &ElidedArgCopyInstrs,
ArgCopyElisionMapTy &ArgCopyElisionCandidates, const Argument &Arg,
ArrayRef<SDValue> ArgVals, bool &ArgHasUses) { … }
void SelectionDAGISel::LowerArguments(const Function &F) { … }
void
SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB) { … }
MachineBasicBlock *SelectionDAGBuilder::NextBlock(MachineBasicBlock *MBB) { … }
void SelectionDAGBuilder::updateDAGForMaybeTailCall(SDValue MaybeTC) { … }
void SelectionDAGBuilder::lowerWorkItem(SwitchWorkListItem W, Value *Cond,
MachineBasicBlock *SwitchMBB,
MachineBasicBlock *DefaultMBB) { … }
void SelectionDAGBuilder::splitWorkItem(SwitchWorkList &WorkList,
const SwitchWorkListItem &W,
Value *Cond,
MachineBasicBlock *SwitchMBB) { … }
static BranchProbability scaleCaseProbality(BranchProbability CaseProb,
BranchProbability PeeledCaseProb) { … }
MachineBasicBlock *SelectionDAGBuilder::peelDominantCaseCluster(
const SwitchInst &SI, CaseClusterVector &Clusters,
BranchProbability &PeeledCaseProb) { … }
void SelectionDAGBuilder::visitSwitch(const SwitchInst &SI) { … }
void SelectionDAGBuilder::visitStepVector(const CallInst &I) { … }
void SelectionDAGBuilder::visitVectorReverse(const CallInst &I) { … }
void SelectionDAGBuilder::visitVectorDeinterleave(const CallInst &I) { … }
void SelectionDAGBuilder::visitVectorInterleave(const CallInst &I) { … }
void SelectionDAGBuilder::visitFreeze(const FreezeInst &I) { … }
void SelectionDAGBuilder::visitVectorSplice(const CallInst &I) { … }
static Register FollowCopyChain(MachineRegisterInfo &MRI, Register Reg) { … }
void SelectionDAGBuilder::visitCallBrLandingPad(const CallInst &I) { … }