80#include "llvm/IR/IntrinsicsWebAssembly.h"
116#define DEBUG_TYPE "isel"
117#define ISEL_DUMP_DEBUG_TYPE DEBUG_TYPE "-dump"
119STATISTIC(NumFastIselFailures,
"Number of instructions fast isel failed on");
120STATISTIC(NumFastIselSuccess,
"Number of instructions fast isel selected");
121STATISTIC(NumFastIselBlocks,
"Number of blocks selected entirely by fast isel");
122STATISTIC(NumDAGBlocks,
"Number of blocks selected using DAG");
123STATISTIC(NumDAGIselRetries,
"Number of times dag isel has to try another path");
124STATISTIC(NumEntryBlocks,
"Number of entry blocks encountered");
126 "Number of entry blocks where fast isel failed to lower arguments");
130 cl::desc(
"Enable abort calls when \"fast\" instruction selection "
131 "fails to lower an instruction: 0 disable the abort, 1 will "
132 "abort but for args, calls and terminators, 2 will also "
133 "abort for argument lowering, and 3 will never fallback "
134 "to SelectionDAG."));
138 cl::desc(
"Emit a diagnostic when \"fast\" instruction selection "
139 "falls back to SelectionDAG."));
143 cl::desc(
"use Machine Branch Probability Info"),
149 cl::desc(
"Only display the basic block whose name "
150 "matches this for all view-*-dags options"));
153 cl::desc(
"Pop up a window to show dags before the first "
154 "dag combine pass"));
157 cl::desc(
"Pop up a window to show dags before legalize types"));
160 cl::desc(
"Pop up a window to show dags before the post "
161 "legalize types dag combine pass"));
164 cl::desc(
"Pop up a window to show dags before legalize"));
167 cl::desc(
"Pop up a window to show dags before the second "
168 "dag combine pass"));
171 cl::desc(
"Pop up a window to show isel dags as they are selected"));
174 cl::desc(
"Pop up a window to show sched dags as they are processed"));
177 cl::desc(
"Pop up a window to show SUnit dags after they are processed"));
186#define ISEL_DUMP(X) \
188 if (llvm::DebugFlag && \
189 (isCurrentDebugType(DEBUG_TYPE) || \
190 (isCurrentDebugType(ISEL_DUMP_DEBUG_TYPE) && MatchFilterFuncName))) { \
195#define ISEL_DUMP(X) do { } while (false)
215 cl::desc(
"Instruction schedulers available (before register"
228 return Arg.hasAttribute(Attribute::AttrKind::SwiftAsync);
247 if (NewOptLevel != SavedOptLevel) {
250 LLVM_DEBUG(
dbgs() <<
"\nChanging optimization level for Function "
252 LLVM_DEBUG(
dbgs() <<
"\tBefore: -O" <<
static_cast<int>(SavedOptLevel)
253 <<
" ; After: -O" <<
static_cast<int>(NewOptLevel)
261 dbgs() <<
"\tFastISel is "
269 LLVM_DEBUG(
dbgs() <<
"\nRestoring optimization level for Function "
272 <<
" ; After: -O" <<
static_cast<int>(SavedOptLevel) <<
"\n");
288 if (
auto *SchedulerCtor = ST.getDAGScheduler(OptLevel)) {
289 return SchedulerCtor(IS, OptLevel);
293 (ST.enableMachineScheduler() && ST.enableMachineSchedDefaultSched()) ||
307 "Unknown sched type!");
317 dbgs() <<
"If a target marks an instruction with "
318 "'usesCustomInserter', it must implement "
319 "TargetLowering::EmitInstrWithCustomInserter!\n";
327 "If a target marks an instruction with 'hasPostISelHook', "
328 "it must implement TargetLowering::AdjustInstrPostInstrSelection!");
336 char &
ID, std::unique_ptr<SelectionDAGISel> S)
367 : Selector->OptLevel;
371 Selector->initializeAnalysisResults(*
this);
372 return Selector->runOnMachineFunction(MF);
440 : Selector->OptLevel;
443 Selector->initializeAnalysisResults(MFAM);
444 Selector->runOnMachineFunction(MF);
467 ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn);
502#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
522 ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn);
535 UA = &UAPass->getUniformityInfo();
560#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
592 if (isa<UnreachableInst>(Term) || isa<ReturnInst>(Term))
606 SelectAllBasicBlocks(Fn);
634 MRI.constrainRegClass(To,
MRI.getRegClass(
From));
640 if (!
MRI.use_empty(To))
660 if (Term !=
MBB.
end() && Term->isReturn()) {
669 if (!
FuncInfo->ArgDbgValues.empty())
675 for (
unsigned i = 0, e =
FuncInfo->ArgDbgValues.size(); i != e; ++i) {
677 assert(
MI->getOpcode() != TargetOpcode::DBG_VALUE_LIST &&
678 "Function parameters should not be described by DBG_VALUE_LIST.");
679 bool hasFI =
MI->getDebugOperand(0).isFI();
681 hasFI ?
TRI.getFrameRegister(*
MF) :
MI->getDebugOperand(0).getReg();
682 if (Reg.isPhysical())
689 Def->getParent()->insert(std::next(InsertPos),
MI);
700 if (!Reg.isPhysical())
703 if (LDI != LiveInMap.
end()) {
704 assert(!hasFI &&
"There's no handling of frame pointer updating here yet "
708 const MDNode *Variable =
MI->getDebugVariable();
709 const MDNode *Expr =
MI->getDebugExpression();
711 bool IsIndirect =
MI->isIndirectDebugValue();
713 assert(
MI->getDebugOffset().getImm() == 0 &&
714 "DBG_VALUE with nonzero offset");
715 assert(cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(
DL) &&
716 "Expected inlined-at fields to agree");
717 assert(
MI->getOpcode() != TargetOpcode::DBG_VALUE_LIST &&
718 "Didn't expect to see a DBG_VALUE_LIST here");
721 IsIndirect, LDI->second, Variable, Expr);
728 if (
UseMI.isDebugValue())
730 if (
UseMI.isCopy() && !CopyUseMI &&
UseMI.getParent() == EntryMBB) {
739 TRI.getRegSizeInBits(LDI->second,
MRI) ==
759 for (
const auto &
MBB : *
MF) {
763 for (
const auto &
MI :
MBB) {
766 MI.isStackAligningInlineAsm()) {
769 if (
MI.isInlineAsm()) {
779 ISEL_DUMP(
dbgs() <<
"*** MachineFunction at end of ISel ***\n");
791 if (!R.getLocation().isValid() || ShouldAbort)
792 R << (
" (in function: " + MF.
getName() +
")").str();
807 if (--
I == Begin || !isa<ReturnInst>(*
I))
810 bool HaveFakeUse =
false;
811 bool HaveTailCall =
false;
813 if (
const CallInst *CI = dyn_cast<CallInst>(--
I))
814 if (CI->isTailCall()) {
819 if (
II->getIntrinsicID() == Intrinsic::fake_use)
821 }
while (
I != Begin);
824 if (!HaveTailCall || !HaveFakeUse)
834 if (
auto UsedDef = dyn_cast<Instruction>(FakeUse->getOperand(0));
835 !UsedDef || UsedDef->getParent() !=
I->getParent() ||
836 UsedDef->comesBefore(&*
I))
841 for (
auto *Inst : FakeUses)
842 Inst->moveBefore(*Inst->getParent(),
I);
858 SDB->visitDbgInfo(*
I);
863 HadTailCall =
SDB->HasTailCall;
864 SDB->resolveOrClearDbgInfo();
871void SelectionDAGISel::ComputeLiveOutVRegInfo() {
885 if (
Op.getValueType() == MVT::Other &&
Added.insert(
Op.getNode()).second)
892 Register DestReg = cast<RegisterSDNode>(
N->getOperand(1))->getReg();
898 EVT SrcVT = Src.getValueType();
904 FuncInfo->AddLiveOutRegInfo(DestReg, NumSignBits, Known);
905 }
while (!Worklist.
empty());
908void SelectionDAGISel::CodeGenAndEmitDAG() {
910 StringRef GroupDescription =
"Instruction Selection and Scheduling";
911 std::string BlockName;
912 bool MatchFilterBB =
false;
921 FuncInfo->MBB->getBasicBlock()->getName());
937#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
939 CurDAG->VerifyDAGDivergence();
957#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
959 CurDAG->VerifyDAGDivergence();
979#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
981 CurDAG->VerifyDAGDivergence();
998 ISEL_DUMP(
dbgs() <<
"\nOptimized type-legalized selection DAG: "
1003#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
1005 CurDAG->VerifyDAGDivergence();
1021#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
1023 CurDAG->VerifyDAGDivergence();
1032 ISEL_DUMP(
dbgs() <<
"\nVector/type-legalized selection DAG: "
1037#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
1039 CurDAG->VerifyDAGDivergence();
1052 ISEL_DUMP(
dbgs() <<
"\nOptimized vector-legalized selection DAG: "
1057#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
1059 CurDAG->VerifyDAGDivergence();
1077#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
1079 CurDAG->VerifyDAGDivergence();
1097#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
1099 CurDAG->VerifyDAGDivergence();
1103 ComputeLiveOutVRegInfo();
1113 DoInstructionSelection();
1149 if (FirstMBB != LastMBB)
1150 SDB->UpdateSplitBlock(FirstMBB, LastMBB);
1172 :
SelectionDAG::DAGUpdateListener(DAG), ISelPosition(isp) {}
1185 void NodeInserted(
SDNode *
N)
override {
1186 SDNode *CurNode = &*ISelPosition;
1187 if (
MDNode *MD = DAG.getPCSections(CurNode))
1188 DAG.addPCSections(
N, MD);
1189 if (
MDNode *MMRA = DAG.getMMRAMetadata(CurNode))
1190 DAG.addMMRAMetadata(
N, MMRA);
1220 while (!Nodes.
empty()) {
1222 for (
auto *U :
N->users()) {
1223 auto UId = U->getNodeId();
1236 int InvalidId = -(
N->getNodeId() + 1);
1237 N->setNodeId(InvalidId);
1242 int Id =
N->getNodeId();
1248void SelectionDAGISel::DoInstructionSelection() {
1251 <<
FuncInfo->MBB->getName() <<
"'\n");
1269 ISelUpdater ISU(*
CurDAG, ISelPosition);
1276 SDNode *Node = &*--ISelPosition;
1280 if (Node->use_empty())
1287 while (!Nodes.
empty()) {
1304 "Node has already selected predecessor node");
1321 switch (
Node->getOpcode()) {
1330 ActionVT =
Node->getOperand(1).getValueType();
1333 ActionVT =
Node->getValueType(0);
1341 LLVM_DEBUG(
dbgs() <<
"\nISEL: Starting selection on root node: ";
1357 if (
const IntrinsicInst *EHPtrCall = dyn_cast<IntrinsicInst>(U)) {
1359 if (IID == Intrinsic::eh_exceptionpointer ||
1360 IID == Intrinsic::eh_exceptioncode)
1375 bool IsSingleCatchAllClause =
1380 bool IsCatchLongjmp = CPI->
arg_size() == 0;
1381 if (!IsSingleCatchAllClause && !IsCatchLongjmp) {
1383 bool IntrFound =
false;
1385 if (
const auto *Call = dyn_cast<IntrinsicInst>(U)) {
1387 if (IID == Intrinsic::wasm_landingpad_index) {
1388 Value *IndexArg = Call->getArgOperand(1);
1389 int Index = cast<ConstantInt>(IndexArg)->getZExtValue();
1396 assert(IntrFound &&
"wasm.landingpad.index intrinsic not found!");
1403bool SelectionDAGISel::PrepareEHLandingPad() {
1415 if (
const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->
getFirstNonPHIIt())) {
1420 assert(EHPhysReg &&
"target lacks exception pointer register");
1424 TII->
get(TargetOpcode::COPY), VReg)
1442 if (
auto *RegMask =
TRI.getCustomEHPadPreservedMask(*
MF))
1486 TII->
get(TargetOpcode::EH_LABEL))
1495 TII->
get(TargetOpcode::EH_LABEL))
1506 return !
I->mayWriteToMemory() &&
1507 !
I->isTerminator() &&
1519 auto ArgIt = FuncInfo.
ValueMap.find(Arg);
1520 if (ArgIt == FuncInfo.
ValueMap.end())
1522 Register ArgVReg = ArgIt->getSecond();
1526 if (VirtReg == ArgVReg) {
1530 LLVM_DEBUG(
dbgs() <<
"processDbgDeclare: setVariableDbgInfo Var=" << *Var
1531 <<
", Expr=" << *Expr <<
", MCRegister=" << PhysReg
1532 <<
", DbgLoc=" << DbgLoc <<
"\n");
1543 <<
" (bad address)\n");
1550 if (!
Address->getType()->isPointerTy())
1556 assert(Var &&
"Missing variable");
1557 assert(DbgLoc &&
"Missing location");
1567 int FI = std::numeric_limits<int>::max();
1568 if (
const auto *AI = dyn_cast<AllocaInst>(
Address)) {
1572 }
else if (
const auto *Arg = dyn_cast<Argument>(
Address))
1575 if (FI == std::numeric_limits<int>::max())
1578 if (
Offset.getBoolValue())
1582 LLVM_DEBUG(
dbgs() <<
"processDbgDeclare: setVariableDbgInfo Var=" << *Var
1583 <<
", Expr=" << *Expr <<
", FI=" << FI
1584 <<
", DbgLoc=" << DbgLoc <<
"\n");
1596 DVR.getExpression(), DVR.getVariable(),
1611 assert(!It->Values.hasArgList() &&
"Single loc variadic ops not supported");
1617void SelectionDAGISel::SelectAllBasicBlocks(
const Function &Fn) {
1647 ++NumFastIselFailLowerArguments;
1652 R <<
"FastISel didn't lower all arguments: "
1660 CodeGenAndEmitDAG();
1674 if (FastIS && Inserted)
1679 "expected AssignmentTrackingAnalysis pass results");
1689 bool AllPredsVisited =
true;
1691 if (!
FuncInfo->VisitedBBs[Pred->getNumber()]) {
1692 AllPredsVisited =
false;
1697 if (AllPredsVisited) {
1699 FuncInfo->ComputePHILiveOutRegInfo(&PN);
1702 FuncInfo->InvalidatePHILiveOutRegInfo(&PN);
1713 const_cast<BasicBlock *
>(LLVMBB)->getFirstNonPHIIt();
1733 if (!PrepareEHLandingPad())
1741 unsigned NumFastIselRemaining = std::distance(Begin,
End);
1747 for (; BI != Begin; --BI) {
1753 --NumFastIselRemaining;
1764 --NumFastIselRemaining;
1765 ++NumFastIselSuccess;
1772 while (BeforeInst != &*Begin) {
1777 if (BeforeInst != Inst && isa<LoadInst>(BeforeInst) &&
1782 <<
"FastISel folded load: " << *BeforeInst <<
"\n");
1785 --NumFastIselRemaining;
1786 ++NumFastIselSuccess;
1798 if (isa<CallInst>(Inst) && !isa<GCStatepointInst>(Inst) &&
1799 !isa<GCRelocateInst>(Inst) && !isa<GCResultInst>(Inst)) {
1803 R <<
"FastISel missed call";
1806 std::string InstStrStorage;
1810 R <<
": " << InstStrStorage;
1822 bool HadTailCall =
false;
1824 SelectBasicBlock(Inst->
getIterator(), BI, HadTailCall);
1836 unsigned RemainingNow = std::distance(Begin, BI);
1837 NumFastIselFailures += NumFastIselRemaining - RemainingNow;
1838 NumFastIselRemaining = RemainingNow;
1848 R <<
"FastISel missed terminator";
1852 R <<
"FastISel missed";
1856 std::string InstStrStorage;
1859 R <<
": " << InstStrStorage;
1864 NumFastIselFailures += NumFastIselRemaining;
1872 bool FunctionBasedInstrumentation =
1874 SDB->SPDescriptor.initialize(LLVMBB,
FuncInfo->getMBB(LLVMBB),
1875 FunctionBasedInstrumentation);
1881 ++NumFastIselBlocks;
1888 SelectBasicBlock(Begin, BI, HadTailCall);
1900 FuncInfo->PHINodesToUpdate.clear();
1906 reportIPToStateForBlocks(
MF);
1913 SDB->clearDanglingDebugInfo();
1914 SDB->SPDescriptor.resetPerFunctionState();
1918SelectionDAGISel::FinishBasicBlock() {
1920 <<
FuncInfo->PHINodesToUpdate.size() <<
"\n";
1921 for (
unsigned i = 0, e =
FuncInfo->PHINodesToUpdate.size(); i != e;
1923 <<
"Node " << i <<
" : (" <<
FuncInfo->PHINodesToUpdate[i].first
1929 for (
unsigned i = 0, e =
FuncInfo->PHINodesToUpdate.size(); i != e; ++i) {
1932 "This is not a machine PHI node that we are updating!");
1933 if (!
FuncInfo->MBB->isSuccessor(
PHI->getParent()))
1939 if (
SDB->SPDescriptor.shouldEmitFunctionBasedCheckStackProtector()) {
1947 SDB->visitSPDescriptorParent(
SDB->SPDescriptor, ParentMBB);
1950 CodeGenAndEmitDAG();
1953 SDB->SPDescriptor.resetPerBBState();
1954 }
else if (
SDB->SPDescriptor.shouldEmitStackProtector()) {
1968 SuccessMBB->
splice(SuccessMBB->
end(), ParentMBB, SplitPoint,
1974 SDB->visitSPDescriptorParent(
SDB->SPDescriptor, ParentMBB);
1977 CodeGenAndEmitDAG();
1981 if (FailureMBB->
empty()) {
1984 SDB->visitSPDescriptorFailure(
SDB->SPDescriptor);
1987 CodeGenAndEmitDAG();
1991 SDB->SPDescriptor.resetPerBBState();
1995 for (
auto &BTB :
SDB->SL->BitTestCases) {
2005 CodeGenAndEmitDAG();
2009 for (
unsigned j = 0, ej = BTB.Cases.size(); j != ej; ++j) {
2010 UnhandledProb -= BTB.Cases[
j].ExtraProb;
2025 if ((BTB.ContiguousRange || BTB.FallthroughUnreachable) && j + 2 == ej) {
2028 NextMBB = BTB.Cases[
j + 1].TargetBB;
2029 }
else if (j + 1 == ej) {
2031 NextMBB = BTB.Default;
2034 NextMBB = BTB.Cases[
j + 1].ThisBB;
2037 SDB->visitBitTestCase(BTB, NextMBB, UnhandledProb, BTB.Reg, BTB.Cases[j],
2042 CodeGenAndEmitDAG();
2044 if ((BTB.ContiguousRange || BTB.FallthroughUnreachable) && j + 2 == ej) {
2046 BTB.Cases.pop_back();
2052 for (
const std::pair<MachineInstr *, Register> &
P :
2057 "This is not a machine PHI node that we are updating!");
2060 if (PHIBB == BTB.Default) {
2061 PHI.addReg(
P.second).addMBB(BTB.Parent);
2062 if (!BTB.ContiguousRange) {
2063 PHI.addReg(
P.second).addMBB(BTB.Cases.back().ThisBB);
2070 PHI.addReg(
P.second).addMBB(cBB);
2074 SDB->SL->BitTestCases.clear();
2079 for (
unsigned i = 0, e =
SDB->SL->JTCases.size(); i != e; ++i) {
2081 if (!
SDB->SL->JTCases[i].first.Emitted) {
2083 FuncInfo->MBB =
SDB->SL->JTCases[i].first.HeaderBB;
2086 SDB->visitJumpTableHeader(
SDB->SL->JTCases[i].second,
2090 CodeGenAndEmitDAG();
2097 SDB->visitJumpTable(
SDB->SL->JTCases[i].second);
2100 CodeGenAndEmitDAG();
2103 for (
unsigned pi = 0, pe =
FuncInfo->PHINodesToUpdate.size();
2108 "This is not a machine PHI node that we are updating!");
2110 if (PHIBB ==
SDB->SL->JTCases[i].second.Default)
2112 .addMBB(
SDB->SL->JTCases[i].first.HeaderBB);
2114 if (
FuncInfo->MBB->isSuccessor(PHIBB))
2118 SDB->SL->JTCases.clear();
2122 for (
unsigned i = 0, e =
SDB->SL->SwitchCases.size(); i != e; ++i) {
2130 if (
SDB->SL->SwitchCases[i].TrueBB !=
SDB->SL->SwitchCases[i].FalseBB)
2137 CodeGenAndEmitDAG();
2158 for (
unsigned pn = 0; ; ++pn) {
2160 "Didn't find PHI entry!");
2161 if (
FuncInfo->PHINodesToUpdate[pn].first ==
PHI) {
2162 PHI.addReg(
FuncInfo->PHINodesToUpdate[pn].second).addMBB(ThisBB);
2170 SDB->SL->SwitchCases.clear();
2191 int64_t DesiredMaskS)
const {
2192 const APInt &ActualMask =
RHS->getAPIntValue();
2195 const APInt &DesiredMask =
APInt(
LHS.getValueSizeInBits(), DesiredMaskS,
2199 if (ActualMask == DesiredMask)
2208 APInt NeededMask = DesiredMask & ~ActualMask;
2223 int64_t DesiredMaskS)
const {
2224 const APInt &ActualMask =
RHS->getAPIntValue();
2227 const APInt &DesiredMask =
APInt(
LHS.getValueSizeInBits(), DesiredMaskS,
2231 if (ActualMask == DesiredMask)
2240 APInt NeededMask = DesiredMask & ~ActualMask;
2260 std::list<HandleSDNode> Handles;
2265 Handles.emplace_back(
2274 if (!Flags.isMemKind() && !Flags.isFuncKind()) {
2276 Handles.insert(Handles.end(), Ops.begin() + i,
2277 Ops.begin() + i + Flags.getNumOperandRegisters() + 1);
2278 i += Flags.getNumOperandRegisters() + 1;
2280 assert(Flags.getNumOperandRegisters() == 1 &&
2281 "Memory operand with multiple values?");
2283 unsigned TiedToOperand;
2284 if (Flags.isUseOperandTiedToDef(TiedToOperand)) {
2288 for (; TiedToOperand; --TiedToOperand) {
2289 CurOp += Flags.getNumOperandRegisters() + 1;
2295 std::vector<SDValue> SelOps;
2297 Flags.getMemoryConstraintID();
2306 Flags.setMemConstraint(ConstraintID);
2314 if (e != Ops.size())
2315 Handles.emplace_back(Ops.back());
2318 for (
auto &handle : Handles)
2319 Ops.push_back(handle.getValue());
2325 bool IgnoreChains) {
2334 Visited.
insert(ImmedUse);
2339 if ((
Op.getValueType() == MVT::Other && IgnoreChains) ||
N == Def)
2341 if (!Visited.
insert(
N).second)
2347 if (Root != ImmedUse) {
2351 if ((
Op.getValueType() == MVT::Other && IgnoreChains) ||
N == Def)
2353 if (!Visited.
insert(
N).second)
2368 return N.hasOneUse();
2375 bool IgnoreChains) {
2424 while (VT == MVT::Glue) {
2435 IgnoreChains =
false;
2441void SelectionDAGISel::Select_INLINEASM(
SDNode *
N) {
2444 std::vector<SDValue> Ops(
N->op_begin(),
N->op_end());
2447 const EVT VTs[] = {MVT::Other, MVT::Glue};
2454void SelectionDAGISel::Select_READ_REGISTER(
SDNode *
Op) {
2459 EVT VT =
Op->getValueType(0);
2470 "\" for llvm.read_register",
2471 Fn,
Op->getDebugLoc()));
2485void SelectionDAGISel::Select_WRITE_REGISTER(
SDNode *
Op) {
2490 EVT VT =
Op->getOperand(2).getValueType();
2500 "\" for llvm.write_register",
2501 Fn,
Op->getDebugLoc()));
2513void SelectionDAGISel::Select_UNDEF(
SDNode *
N) {
2519void SelectionDAGISel::Select_FAKE_USE(
SDNode *
N) {
2521 N->getOperand(1),
N->getOperand(0));
2524void SelectionDAGISel::Select_FREEZE(
SDNode *
N) {
2532void SelectionDAGISel::Select_ARITH_FENCE(
SDNode *
N) {
2537void SelectionDAGISel::Select_MEMBARRIER(
SDNode *
N) {
2542void SelectionDAGISel::Select_CONVERGENCECTRL_ANCHOR(
SDNode *
N) {
2544 N->getValueType(0));
2547void SelectionDAGISel::Select_CONVERGENCECTRL_ENTRY(
SDNode *
N) {
2549 N->getValueType(0));
2552void SelectionDAGISel::Select_CONVERGENCECTRL_LOOP(
SDNode *
N) {
2554 N->getValueType(0),
N->getOperand(0));
2575void SelectionDAGISel::Select_STACKMAP(
SDNode *
N) {
2577 auto *It =
N->op_begin();
2586 assert(
ID.getValueType() == MVT::i64);
2595 for (; It !=
N->op_end(); It++)
2596 pushStackMapLiveVariable(Ops, *It,
DL);
2605void SelectionDAGISel::Select_PATCHPOINT(
SDNode *
N) {
2607 auto *It =
N->op_begin();
2612 std::optional<SDValue> Glue;
2613 if (It->getValueType() == MVT::Glue)
2619 assert(
ID.getValueType() == MVT::i64);
2643 for (; It !=
N->op_end(); It++)
2644 pushStackMapLiveVariable(Ops, *It,
DL);
2649 if (Glue.has_value())
2659 assert(Val >= 128 &&
"Not a VBR");
2665 NextBits = MatcherTable[
Idx++];
2666 Val |= (NextBits&127) << Shift;
2668 }
while (NextBits & 128);
2676getSimpleVT(
const unsigned char *MatcherTable,
unsigned &MatcherIndex) {
2677 unsigned SimpleVT = MatcherTable[MatcherIndex++];
2679 SimpleVT =
GetVBR(SimpleVT, MatcherTable, MatcherIndex);
2684void SelectionDAGISel::Select_JUMP_TABLE_DEBUG_INFO(
SDNode *
N) {
2688 dl, MVT::i64,
true));
2693void SelectionDAGISel::UpdateChains(
2700 if (!ChainNodesMatched.
empty()) {
2702 "Matched input chains but didn't produce a chain");
2705 for (
unsigned i = 0, e = ChainNodesMatched.
size(); i != e; ++i) {
2706 SDNode *ChainNode = ChainNodesMatched[i];
2713 "Deleted node left in chain");
2717 if (ChainNode == NodeToMatch && isMorphNodeTo)
2732 if (ChainNode != NodeToMatch && ChainNode->
use_empty() &&
2738 if (!NowDeadNodes.
empty())
2757 unsigned int Max = 8192;
2760 if (ChainNodesMatched.
size() == 1)
2761 return ChainNodesMatched[0]->getOperand(0);
2765 std::function<void(
const SDValue)> AddChains = [&](
const SDValue V) {
2766 if (V.getValueType() != MVT::Other)
2770 if (!Visited.
insert(V.getNode()).second)
2773 for (
const SDValue &
Op : V->op_values())
2779 for (
auto *
N : ChainNodesMatched) {
2784 while (!Worklist.
empty())
2788 if (InputChains.
size() == 0)
2798 for (
auto *
N : ChainNodesMatched)
2803 if (InputChains.
size() == 1)
2804 return InputChains[0];
2806 MVT::Other, InputChains);
2810SDNode *SelectionDAGISel::
2819 int OldGlueResultNo = -1, OldChainResultNo = -1;
2821 unsigned NTMNumResults =
Node->getNumValues();
2822 if (
Node->getValueType(NTMNumResults-1) == MVT::Glue) {
2823 OldGlueResultNo = NTMNumResults-1;
2824 if (NTMNumResults != 1 &&
2825 Node->getValueType(NTMNumResults-2) == MVT::Other)
2826 OldChainResultNo = NTMNumResults-2;
2827 }
else if (
Node->getValueType(NTMNumResults-1) == MVT::Other)
2828 OldChainResultNo = NTMNumResults-1;
2846 static_cast<unsigned>(OldGlueResultNo) != ResNumResults - 1)
2848 SDValue(Res, ResNumResults - 1));
2854 if ((EmitNodeInfo &
OPFL_Chain) && OldChainResultNo != -1 &&
2855 static_cast<unsigned>(OldChainResultNo) != ResNumResults - 1)
2857 SDValue(Res, ResNumResults - 1));
2875 unsigned RecNo = MatcherTable[MatcherIndex++];
2876 assert(RecNo < RecordedNodes.size() &&
"Invalid CheckSame");
2877 return N == RecordedNodes[RecNo].first;
2882 const unsigned char *MatcherTable,
unsigned &MatcherIndex,
SDValue N,
2885 if (ChildNo >=
N.getNumOperands())
2887 return ::CheckSame(MatcherTable, MatcherIndex,
N.getOperand(ChildNo),
2895 bool TwoBytePredNo =
2899 ? MatcherTable[MatcherIndex++]
2902 PredNo |= MatcherTable[MatcherIndex++] << 8;
2912 ? MatcherTable[MatcherIndex++]
2921 Opc |=
static_cast<uint16_t>(MatcherTable[MatcherIndex++]) << 8;
2922 return N->getOpcode() ==
Opc;
2929 if (
N.getValueType() == VT)
2939 if (ChildNo >=
N.getNumOperands())
2941 return ::CheckType(VT,
N.getOperand(ChildNo), TLI,
DL);
2947 return cast<CondCodeSDNode>(
N)->get() ==
2954 if (2 >=
N.getNumOperands())
2956 return ::CheckCondCode(MatcherTable, MatcherIndex,
N.getOperand(2));
2963 if (cast<VTSDNode>(
N)->getVT() == VT)
2967 return VT == MVT::iPTR && cast<VTSDNode>(
N)->getVT() == TLI->
getPointerTy(
DL);
2984 int64_t Val = MatcherTable[MatcherIndex++];
2986 Val =
GetVBR(Val, MatcherTable, MatcherIndex);
2991 return C &&
C->getAPIntValue().trySExtValue() == Val;
2997 if (ChildNo >=
N.getNumOperands())
2999 return ::CheckInteger(MatcherTable, MatcherIndex,
N.getOperand(ChildNo));
3005 int64_t Val = MatcherTable[MatcherIndex++];
3007 Val =
GetVBR(Val, MatcherTable, MatcherIndex);
3009 if (
N->getOpcode() !=
ISD::AND)
return false;
3018 int64_t Val = MatcherTable[MatcherIndex++];
3020 Val =
GetVBR(Val, MatcherTable, MatcherIndex);
3022 if (
N->getOpcode() !=
ISD::OR)
return false;
3039 unsigned Opcode = Table[Index++];
3099 unsigned Res = Table[Index++];
3186 unsigned NumRecordedNodes;
3189 unsigned NumMatchedMemRefs;
3192 SDValue InputChain, InputGlue;
3195 bool HasChainNodesMatched;
3212 :
SelectionDAG::DAGUpdateListener(DAG), NodeToMatch(NodeToMatch),
3213 RecordedNodes(
RN), MatchScopes(MS) {}
3221 if (!
E ||
E->isMachineOpcode())
3224 if (
N == *NodeToMatch)
3229 for (
auto &
I : RecordedNodes)
3230 if (
I.first.getNode() ==
N)
3233 for (
auto &
I : MatchScopes)
3234 for (
auto &J :
I.NodeStack)
3235 if (J.getNode() ==
N)
3243 const unsigned char *MatcherTable,
3244 unsigned TableSize) {
3284 Select_INLINEASM(NodeToMatch);
3287 Select_READ_REGISTER(NodeToMatch);
3290 Select_WRITE_REGISTER(NodeToMatch);
3294 Select_UNDEF(NodeToMatch);
3297 Select_FAKE_USE(NodeToMatch);
3300 Select_FREEZE(NodeToMatch);
3303 Select_ARITH_FENCE(NodeToMatch);
3306 Select_MEMBARRIER(NodeToMatch);
3309 Select_STACKMAP(NodeToMatch);
3312 Select_PATCHPOINT(NodeToMatch);
3315 Select_JUMP_TABLE_DEBUG_INFO(NodeToMatch);
3318 Select_CONVERGENCECTRL_ANCHOR(NodeToMatch);
3321 Select_CONVERGENCECTRL_ENTRY(NodeToMatch);
3324 Select_CONVERGENCECTRL_LOOP(NodeToMatch);
3351 SDValue InputChain, InputGlue;
3365 unsigned MatcherIndex = 0;
3367 if (!OpcodeOffset.empty()) {
3369 if (
N.getOpcode() < OpcodeOffset.size())
3370 MatcherIndex = OpcodeOffset[
N.getOpcode()];
3371 LLVM_DEBUG(
dbgs() <<
" Initial Opcode index to " << MatcherIndex <<
"\n");
3380 unsigned CaseSize = MatcherTable[
Idx++];
3382 CaseSize =
GetVBR(CaseSize, MatcherTable,
Idx);
3383 if (CaseSize == 0)
break;
3388 if (
Opc >= OpcodeOffset.size())
3389 OpcodeOffset.resize((
Opc+1)*2);
3395 if (
N.getOpcode() < OpcodeOffset.size())
3396 MatcherIndex = OpcodeOffset[
N.getOpcode()];
3400 assert(MatcherIndex < TableSize &&
"Invalid index");
3402 unsigned CurrentOpcodeIndex = MatcherIndex;
3416 unsigned NumToSkip = MatcherTable[MatcherIndex++];
3417 if (NumToSkip & 128)
3418 NumToSkip =
GetVBR(NumToSkip, MatcherTable, MatcherIndex);
3420 if (NumToSkip == 0) {
3425 FailIndex = MatcherIndex+NumToSkip;
3427 unsigned MatcherIndexOfPredicate = MatcherIndex;
3428 (void)MatcherIndexOfPredicate;
3435 Result, *
this, RecordedNodes);
3440 dbgs() <<
" Skipped scope entry (due to false predicate) at "
3441 <<
"index " << MatcherIndexOfPredicate <<
", continuing at "
3442 << FailIndex <<
"\n");
3443 ++NumDAGIselRetries;
3447 MatcherIndex = FailIndex;
3451 if (FailIndex == 0)
break;
3455 MatchScope NewEntry;
3456 NewEntry.FailIndex = FailIndex;
3457 NewEntry.NodeStack.append(NodeStack.
begin(), NodeStack.
end());
3458 NewEntry.NumRecordedNodes = RecordedNodes.
size();
3459 NewEntry.NumMatchedMemRefs = MatchedMemRefs.
size();
3460 NewEntry.InputChain = InputChain;
3461 NewEntry.InputGlue = InputGlue;
3462 NewEntry.HasChainNodesMatched = !ChainNodesMatched.
empty();
3468 SDNode *Parent =
nullptr;
3469 if (NodeStack.
size() > 1)
3470 Parent = NodeStack[NodeStack.
size()-2].getNode();
3471 RecordedNodes.
push_back(std::make_pair(
N, Parent));
3480 if (ChildNo >=
N.getNumOperands())
3483 RecordedNodes.
push_back(std::make_pair(
N->getOperand(ChildNo),
3488 if (
auto *MN = dyn_cast<MemSDNode>(
N))
3489 MatchedMemRefs.
push_back(MN->getMemOperand());
3499 if (
N->getNumOperands() != 0 &&
3500 N->getOperand(
N->getNumOperands()-1).getValueType() == MVT::Glue)
3501 InputGlue =
N->getOperand(
N->getNumOperands()-1);
3505 unsigned ChildNo = MatcherTable[MatcherIndex++];
3506 if (ChildNo >=
N.getNumOperands())
3508 N =
N.getOperand(ChildNo);
3518 if (ChildNo >=
N.getNumOperands())
3520 N =
N.getOperand(ChildNo);
3536 assert(!NodeStack.
empty() &&
"Node stack imbalance!");
3537 N = NodeStack.
back();
3540 ? MatcherTable[MatcherIndex++]
3542 if (SiblingNo >=
N.getNumOperands())
3544 N =
N.getOperand(SiblingNo);
3551 assert(!NodeStack.
empty() &&
"Node stack imbalance!");
3552 N = NodeStack.
back();
3556 if (!
::CheckSame(MatcherTable, MatcherIndex,
N, RecordedNodes))
break;
3592 unsigned OpNum = MatcherTable[MatcherIndex++];
3595 for (
unsigned i = 0; i < OpNum; ++i)
3596 Operands.push_back(RecordedNodes[MatcherTable[MatcherIndex++]].first);
3598 unsigned PredNo = MatcherTable[MatcherIndex++];
3613 ? MatcherTable[MatcherIndex++]
3615 unsigned RecNo = MatcherTable[MatcherIndex++];
3616 assert(RecNo < RecordedNodes.
size() &&
"Invalid CheckComplexPat");
3620 std::unique_ptr<MatchStateUpdater> MSU;
3622 MSU.reset(
new MatchStateUpdater(*
CurDAG, &NodeToMatch, RecordedNodes,
3626 RecordedNodes[RecNo].first, CPNum,
3632 if (!
::CheckOpcode(MatcherTable, MatcherIndex,
N.getNode()))
break;
3655 unsigned Res = MatcherTable[MatcherIndex++];
3663 unsigned CurNodeOpcode =
N.getOpcode();
3664 unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;
3668 CaseSize = MatcherTable[MatcherIndex++];
3670 CaseSize =
GetVBR(CaseSize, MatcherTable, MatcherIndex);
3671 if (CaseSize == 0)
break;
3674 Opc |=
static_cast<uint16_t>(MatcherTable[MatcherIndex++]) << 8;
3677 if (CurNodeOpcode ==
Opc)
3681 MatcherIndex += CaseSize;
3685 if (CaseSize == 0)
break;
3688 LLVM_DEBUG(
dbgs() <<
" OpcodeSwitch from " << SwitchStart <<
" to "
3689 << MatcherIndex <<
"\n");
3694 MVT CurNodeVT =
N.getSimpleValueType();
3695 unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;
3699 CaseSize = MatcherTable[MatcherIndex++];
3701 CaseSize =
GetVBR(CaseSize, MatcherTable, MatcherIndex);
3702 if (CaseSize == 0)
break;
3705 if (CaseVT == MVT::iPTR)
3709 if (CurNodeVT == CaseVT)
3713 MatcherIndex += CaseSize;
3717 if (CaseSize == 0)
break;
3721 <<
"] from " << SwitchStart <<
" to " << MatcherIndex
3791 if (!
::CheckOrImm(MatcherTable, MatcherIndex,
N, *
this))
break;
3803 assert(NodeStack.
size() != 1 &&
"No parent node");
3806 bool HasMultipleUses =
false;
3807 for (
unsigned i = 1, e = NodeStack.
size()-1; i != e; ++i) {
3808 unsigned NNonChainUses = 0;
3809 SDNode *NS = NodeStack[i].getNode();
3811 if (U.getValueType() != MVT::Other)
3812 if (++NNonChainUses > 1) {
3813 HasMultipleUses =
true;
3816 if (HasMultipleUses)
break;
3818 if (HasMultipleUses)
break;
3857 int64_t Val = MatcherTable[MatcherIndex++];
3859 Val =
GetVBR(Val, MatcherTable, MatcherIndex);
3862 RecordedNodes.
push_back(std::pair<SDValue, SDNode *>(
3883 unsigned RegNo = MatcherTable[MatcherIndex++];
3884 RecordedNodes.
push_back(std::pair<SDValue, SDNode *>(
3893 unsigned RegNo = MatcherTable[MatcherIndex++];
3894 RegNo |= MatcherTable[MatcherIndex++] << 8;
3895 RecordedNodes.
push_back(std::pair<SDValue, SDNode*>(
3911 ? MatcherTable[MatcherIndex++]
3913 assert(RecNo < RecordedNodes.
size() &&
"Invalid EmitConvertToTarget");
3914 SDValue Imm = RecordedNodes[RecNo].first;
3917 const ConstantInt *Val=cast<ConstantSDNode>(Imm)->getConstantIntValue();
3919 Imm.getValueType());
3921 const ConstantFP *Val=cast<ConstantFPSDNode>(Imm)->getConstantFPValue();
3923 Imm.getValueType());
3926 RecordedNodes.
push_back(std::make_pair(Imm, RecordedNodes[RecNo].second));
3935 "EmitMergeInputChains should be the first chain producing node");
3937 "Should only have one EmitMergeInputChains per match");
3941 assert(RecNo < RecordedNodes.
size() &&
"Invalid EmitMergeInputChains");
3942 ChainNodesMatched.
push_back(RecordedNodes[RecNo].first.getNode());
3948 if (ChainNodesMatched.
back() != NodeToMatch &&
3949 !RecordedNodes[RecNo].first.hasOneUse()) {
3950 ChainNodesMatched.
clear();
3964 "EmitMergeInputChains should be the first chain producing node");
3971 unsigned NumChains = MatcherTable[MatcherIndex++];
3972 assert(NumChains != 0 &&
"Can't TF zero chains");
3975 "Should only have one EmitMergeInputChains per match");
3978 for (
unsigned i = 0; i != NumChains; ++i) {
3979 unsigned RecNo = MatcherTable[MatcherIndex++];
3980 assert(RecNo < RecordedNodes.
size() &&
"Invalid EmitMergeInputChains");
3981 ChainNodesMatched.
push_back(RecordedNodes[RecNo].first.getNode());
3987 if (ChainNodesMatched.
back() != NodeToMatch &&
3988 !RecordedNodes[RecNo].first.hasOneUse()) {
3989 ChainNodesMatched.
clear();
3995 if (ChainNodesMatched.
empty())
4020 : MatcherTable[MatcherIndex++];
4021 assert(RecNo < RecordedNodes.
size() &&
"Invalid EmitCopyToReg");
4022 unsigned DestPhysReg = MatcherTable[MatcherIndex++];
4024 DestPhysReg |= MatcherTable[MatcherIndex++] << 8;
4030 DestPhysReg, RecordedNodes[RecNo].first,
4033 InputGlue = InputChain.
getValue(1);
4038 unsigned XFormNo = MatcherTable[MatcherIndex++];
4039 unsigned RecNo = MatcherTable[MatcherIndex++];
4040 assert(RecNo < RecordedNodes.
size() &&
"Invalid EmitNodeXForm");
4042 RecordedNodes.
push_back(std::pair<SDValue,SDNode*>(Res,
nullptr));
4048 unsigned index = MatcherTable[MatcherIndex++];
4049 index |= (MatcherTable[MatcherIndex++] << 8);
4050 index |= (MatcherTable[MatcherIndex++] << 16);
4051 index |= (MatcherTable[MatcherIndex++] << 24);
4083 uint16_t TargetOpc = MatcherTable[MatcherIndex++];
4084 TargetOpc |=
static_cast<uint16_t>(MatcherTable[MatcherIndex++]) << 8;
4085 unsigned EmitNodeInfo;
4104 EmitNodeInfo = MatcherTable[MatcherIndex++];
4129 NumVTs = MatcherTable[MatcherIndex++];
4131 for (
unsigned i = 0; i != NumVTs; ++i) {
4133 if (VT == MVT::iPTR)
4146 if (VTs.
size() == 1)
4148 else if (VTs.
size() == 2)
4154 unsigned NumOps = MatcherTable[MatcherIndex++];
4156 for (
unsigned i = 0; i != NumOps; ++i) {
4157 unsigned RecNo = MatcherTable[MatcherIndex++];
4159 RecNo =
GetVBR(RecNo, MatcherTable, MatcherIndex);
4161 assert(RecNo < RecordedNodes.
size() &&
"Invalid EmitNode");
4162 Ops.
push_back(RecordedNodes[RecNo].first);
4169 FirstOpToCopy += (EmitNodeInfo &
OPFL_Chain) ? 1 : 0;
4171 "Invalid variadic node");
4174 for (
unsigned i = FirstOpToCopy, e = NodeToMatch->
getNumOperands();
4177 if (V.getValueType() == MVT::Glue)
break;
4192 bool MayRaiseFPException =
4199 bool IsMorphNodeTo =
4202 if (!IsMorphNodeTo) {
4209 for (
unsigned i = 0, e = VTs.
size(); i != e; ++i) {
4210 if (VTs[i] == MVT::Other || VTs[i] == MVT::Glue)
break;
4216 "NodeToMatch was removed partway through selection");
4220 auto &Chain = ChainNodesMatched;
4222 "Chain node replaced during MorphNode");
4225 Res = cast<MachineSDNode>(MorphNode(NodeToMatch, TargetOpc, VTList,
4226 Ops, EmitNodeInfo));
4253 bool mayLoad = MCID.
mayLoad();
4260 if (MMO->isLoad()) {
4263 }
else if (MMO->isStore()) {
4275 if (!MatchedMemRefs.
empty() && Res->memoperands_empty())
4276 dbgs() <<
" Dropping mem operands\n";
4277 dbgs() <<
" " << (IsMorphNodeTo ?
"Morphed" :
"Created") <<
" node: ";
4282 if (IsMorphNodeTo) {
4284 UpdateChains(Res, InputChain, ChainNodesMatched,
true);
4294 unsigned NumResults = MatcherTable[MatcherIndex++];
4296 for (
unsigned i = 0; i != NumResults; ++i) {
4297 unsigned ResSlot = MatcherTable[MatcherIndex++];
4299 ResSlot =
GetVBR(ResSlot, MatcherTable, MatcherIndex);
4301 assert(ResSlot < RecordedNodes.
size() &&
"Invalid CompleteMatch");
4302 SDValue Res = RecordedNodes[ResSlot].first;
4304 assert(i < NodeToMatch->getNumValues() &&
4307 "Invalid number of results to complete!");
4313 "invalid replacement");
4318 UpdateChains(NodeToMatch, InputChain, ChainNodesMatched,
false);
4331 "Didn't replace all uses of the node?");
4341 LLVM_DEBUG(
dbgs() <<
" Match failed at index " << CurrentOpcodeIndex
4343 ++NumDAGIselRetries;
4345 if (MatchScopes.
empty()) {
4346 CannotYetSelect(NodeToMatch);
4352 MatchScope &LastScope = MatchScopes.
back();
4353 RecordedNodes.
resize(LastScope.NumRecordedNodes);
4355 NodeStack.
append(LastScope.NodeStack.begin(), LastScope.NodeStack.end());
4356 N = NodeStack.
back();
4358 if (LastScope.NumMatchedMemRefs != MatchedMemRefs.
size())
4359 MatchedMemRefs.
resize(LastScope.NumMatchedMemRefs);
4360 MatcherIndex = LastScope.FailIndex;
4364 InputChain = LastScope.InputChain;
4365 InputGlue = LastScope.InputGlue;
4366 if (!LastScope.HasChainNodesMatched)
4367 ChainNodesMatched.
clear();
4372 unsigned NumToSkip = MatcherTable[MatcherIndex++];
4373 if (NumToSkip & 128)
4374 NumToSkip =
GetVBR(NumToSkip, MatcherTable, MatcherIndex);
4378 if (NumToSkip != 0) {
4379 LastScope.FailIndex = MatcherIndex+NumToSkip;
4393 if (
N->isMachineOpcode()) {
4400 if (
N->isTargetOpcode()) {
4404 return N->isStrictFPOpcode();
4409 auto *
C = dyn_cast<ConstantSDNode>(
N->getOperand(1));
4414 if (
auto *FN = dyn_cast<FrameIndexSDNode>(
N->getOperand(0))) {
4417 int32_t Off =
C->getSExtValue();
4420 return (Off >= 0) && (((
A.value() - 1) & Off) ==
unsigned(Off));
4425void SelectionDAGISel::CannotYetSelect(
SDNode *
N) {
4428 Msg <<
"Cannot select: ";
4430 Msg.enable_colors(
errs().has_colors());
4436 Msg <<
"\nIn function: " <<
MF->
getName();
4438 bool HasInputChain =
N->getOperand(0).getValueType() == MVT::Other;
4439 unsigned iid =
N->getConstantOperandVal(HasInputChain);
4440 if (iid < Intrinsic::num_intrinsics)
4443 Msg <<
"unknown intrinsic #" << iid;
unsigned const MachineRegisterInfo * MRI
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
MachineInstrBuilder & UseMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Register Bank Select
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
Expand Atomic instructions
BlockVerifier::State From
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
This file defines the FastISel class.
Module.h This file contains the declarations for the Module class.
mir Rename Register Operands
Machine Instruction Scheduler
Register const TargetRegisterInfo * TRI
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
static Type * getValueType(Value *V)
Returns the type of the given value/instruction V.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckValueType(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL)
static cl::opt< bool > ViewSUnitDAGs("view-sunit-dags", cl::Hidden, cl::desc("Pop up a window to show SUnit dags after they are processed"))
static cl::opt< bool > ViewDAGCombineLT("view-dag-combine-lt-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the post " "legalize types dag combine pass"))
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckPatternPredicate(unsigned Opcode, const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel)
CheckPatternPredicate - Implements OP_CheckPatternPredicate.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildSame(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SmallVectorImpl< std::pair< SDValue, SDNode * > > &RecordedNodes, unsigned ChildNo)
CheckChildSame - Implements OP_CheckChildXSame.
static uint64_t decodeSignRotatedValue(uint64_t V)
Decode a signed value stored with the sign bit in the LSB for dense VBR encoding.
static cl::opt< bool > ViewISelDAGs("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected"))
static LLVM_ATTRIBUTE_ALWAYS_INLINE uint64_t GetVBR(uint64_t Val, const unsigned char *MatcherTable, unsigned &Idx)
GetVBR - decode a vbr encoding whose top bit is set.
static void reportFastISelFailure(MachineFunction &MF, OptimizationRemarkEmitter &ORE, OptimizationRemarkMissed &R, bool ShouldAbort)
static cl::opt< bool > ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the second " "dag combine pass"))
static RegisterScheduler defaultListDAGScheduler("default", "Best scheduler for the target", createDefaultScheduler)
static unsigned IsPredicateKnownToFail(const unsigned char *Table, unsigned Index, SDValue N, bool &Result, const SelectionDAGISel &SDISel, SmallVectorImpl< std::pair< SDValue, SDNode * > > &RecordedNodes)
IsPredicateKnownToFail - If we know how and can do so without pushing a scope, evaluate the current n...
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckNodePredicate(unsigned Opcode, const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel, SDValue Op)
CheckNodePredicate - Implements OP_CheckNodePredicate.
static cl::opt< int > EnableFastISelAbort("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection " "fails to lower an instruction: 0 disable the abort, 1 will " "abort but for args, calls and terminators, 2 will also " "abort for argument lowering, and 3 will never fallback " "to SelectionDAG."))
static void mapWasmLandingPadIndex(MachineBasicBlock *MBB, const CatchPadInst *CPI)
static void processSingleLocVars(FunctionLoweringInfo &FuncInfo, FunctionVarLocs const *FnVarLocs)
Collect single location variable information generated with assignment tracking.
static LLVM_ATTRIBUTE_ALWAYS_INLINE MVT::SimpleValueType getSimpleVT(const unsigned char *MatcherTable, unsigned &MatcherIndex)
getSimpleVT - Decode a value in MatcherTable, if it's a VBR encoded value, use GetVBR to decode it.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckInteger(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckAndImm(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SelectionDAGISel &SDISel)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOrImm(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SelectionDAGISel &SDISel)
static cl::opt< bool > UseMBPI("use-mbpi", cl::desc("use Machine Branch Probability Info"), cl::init(true), cl::Hidden)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildType(MVT::SimpleValueType VT, SDValue N, const TargetLowering *TLI, const DataLayout &DL, unsigned ChildNo)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckSame(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SmallVectorImpl< std::pair< SDValue, SDNode * > > &RecordedNodes)
CheckSame - Implements OP_CheckSame.
static bool dontUseFastISelFor(const Function &Fn)
static bool findNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse, bool IgnoreChains)
findNonImmUse - Return true if "Def" is a predecessor of "Root" via a path beyond "ImmedUse".
static cl::opt< bool > ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the first " "dag combine pass"))
static bool processIfEntryValueDbgDeclare(FunctionLoweringInfo &FuncInfo, const Value *Arg, DIExpression *Expr, DILocalVariable *Var, DebugLoc DbgLoc)
static cl::opt< bool > ViewSchedDAGs("view-sched-dags", cl::Hidden, cl::desc("Pop up a window to show sched dags as they are processed"))
static void processDbgDeclares(FunctionLoweringInfo &FuncInfo)
Collect llvm.dbg.declare information.
static void preserveFakeUses(BasicBlock::iterator Begin, BasicBlock::iterator End)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckCondCode(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N)
static bool hasExceptionPointerOrCodeUser(const CatchPadInst *CPI)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChild2CondCode(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N)
static cl::opt< bool > ViewLegalizeDAGs("view-legalize-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize"))
static cl::opt< bool > ViewLegalizeTypesDAGs("view-legalize-types-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize types"))
static cl::opt< RegisterScheduler::FunctionPassCtor, false, RegisterPassParser< RegisterScheduler > > ISHeuristic("pre-RA-sched", cl::init(&createDefaultScheduler), cl::Hidden, cl::desc("Instruction schedulers available (before register" " allocation):"))
ISHeuristic command line option for instruction schedulers.
static cl::opt< bool > EnableFastISelFallbackReport("fast-isel-report-on-fallback", cl::Hidden, cl::desc("Emit a diagnostic when \"fast\" instruction selection " "falls back to SelectionDAG."))
static bool processDbgDeclare(FunctionLoweringInfo &FuncInfo, const Value *Address, DIExpression *Expr, DILocalVariable *Var, DebugLoc DbgLoc)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDNode *N)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildInteger(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, unsigned ChildNo)
static cl::opt< std::string > FilterDAGBasicBlockName("filter-view-dags", cl::Hidden, cl::desc("Only display the basic block whose name " "matches this for all view-*-dags options"))
static SDValue HandleMergeInputChains(SmallVectorImpl< SDNode * > &ChainNodesMatched, SelectionDAG *CurDAG)
HandleMergeInputChains - This implements the OPC_EmitMergeInputChains operation for when the pattern ...
static bool isFoldedOrDeadInstruction(const Instruction *I, const FunctionLoweringInfo &FuncInfo)
isFoldedOrDeadInstruction - Return true if the specified instruction is side-effect free and is eithe...
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This file describes how to lower LLVM code to machine code.
DEMANGLE_DUMP_METHOD void dump() const
A manager for alias analyses.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
AAResults & getAAResults()
Class for arbitrary precision integers.
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
A container for analyses that lazily runs them and caches their results.
PassT::Result * getCachedResult(IRUnitT &IR) const
Get the cached result of an analysis pass for a given IR unit.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A function analysis which provides an AssumptionCache.
An immutable pass that tracks lazily created AssumptionCache objects.
LLVM Basic Block Representation.
unsigned getNumber() const
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
LLVM_ABI InstListType::const_iterator getFirstNonPHIIt() const
Returns an iterator to the first instruction in this block that is not a PHINode instruction.
InstListType::const_iterator const_iterator
InstListType::iterator iterator
Instruction iterators...
bool isEHPad() const
Return true if this basic block is an exception handling block.
LLVM_ABI const Instruction * getFirstMayFaultInst() const
Returns the first potential AsynchEH faulty instruction currently it checks for loads/stores (which m...
Analysis pass which computes BlockFrequencyInfo.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Analysis pass which computes BranchProbabilityInfo.
Legacy analysis pass which computes BranchProbabilityInfo.
This class represents a function call, abstracting a target machine's calling convention.
ConstantFP - Floating Point Values [float, double].
This is the shared class of boolean and integer constants.
This is an important base class in LLVM.
LLVM_ABI bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
static LLVM_ABI DIExpression * append(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Append the opcodes Ops to DIExpr.
static LLVM_ABI DIExpression * prepend(const DIExpression *Expr, uint8_t Flags, int64_t Offset=0)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an ...
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Diagnostic information for ISel fallback path.
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
void setLastLocalValue(MachineInstr *I)
Update the position of the last instruction emitted for materializing constants for use in the curren...
void handleDbgInfo(const Instruction *II)
Target-independent lowering of non-instruction debug info associated with this instruction.
bool tryToFoldLoad(const LoadInst *LI, const Instruction *FoldInst)
We're checking to see if we can fold LI into FoldInst.
void removeDeadCode(MachineBasicBlock::iterator I, MachineBasicBlock::iterator E)
Remove all dead instructions between the I and E.
void startNewBlock()
Set the current block to which generated machine instructions will be appended.
bool selectInstruction(const Instruction *I)
Do "fast" instruction selection for the given LLVM IR instruction and append the generated machine in...
void finishBasicBlock()
Flush the local value map.
void recomputeInsertPt()
Reset InsertPt to prepare for inserting instructions into the current block.
bool lowerArguments()
Do "fast" instruction selection for function arguments and append the machine instructions to the cur...
unsigned arg_size() const
arg_size - Return the number of funcletpad arguments.
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th funcletpad argument.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
SmallPtrSet< const DbgVariableRecord *, 8 > PreprocessedDVRDeclares
Collection of dbg_declare instructions handled after argument lowering and before ISel proper.
DenseMap< const AllocaInst *, int > StaticAllocaMap
StaticAllocaMap - Keep track of frame indices for fixed sized allocas in the entry block.
int getArgumentFrameIndex(const Argument *A)
getArgumentFrameIndex - Get frame index for the byval argument.
bool isExportedInst(const Value *V) const
isExportedInst - Return true if the specified value is an instruction exported from its block.
DenseMap< const Value *, Register > ValueMap
ValueMap - Since we emit code for the function a basic block at a time, we must remember which virtua...
MachineRegisterInfo * RegInfo
bool skipFunction(const Function &F) const
Optional passes call this function to check whether the pass should be skipped.
Data structure describing the variable locations in a function.
const VarLocInfo * single_locs_begin() const
DILocalVariable * getDILocalVariable(const VarLocInfo *Loc) const
Return the DILocalVariable for the location definition represented by ID.
const VarLocInfo * single_locs_end() const
One past the last single-location variable location definition.
const BasicBlock & getEntryBlock() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
unsigned getMaxBlockNumber() const
Return a value larger than the largest block number.
iterator_range< arg_iterator > args()
DISubprogram * getSubprogram() const
Get the attached subprogram.
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
bool hasOptNone() const
Do not optimize this function (-O0).
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
An analysis pass which caches information about the Function.
An analysis pass which caches information about the entire Module.
Module * getParent()
Get the module that this global value is contained inside of...
This class is used to form a handle around another node that is persistent and is updated across invo...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
bool isTerminator() const
A wrapper class for inspecting calls to intrinsic functions.
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
LLVM_ABI void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
This is an alternative analysis pass to BlockFrequencyInfoWrapperPass.
static void getLazyBFIAnalysisUsage(AnalysisUsage &AU)
Helper for client passes to set up the analysis usage on behalf of this pass.
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Describe properties that are true of each instruction in the target description file.
bool mayStore() const
Return true if this instruction could possibly modify memory.
bool mayLoad() const
Return true if this instruction could possibly read memory.
bool mayRaiseFPException() const
Return true if this instruction may raise a floating-point exception.
bool isCall() const
Return true if the instruction is a call.
bool isReturn() const
Return true if the instruction is a return.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Wrapper class representing physical registers. Should be passed by value.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const MDNode * getMD() const
const MDOperand & getOperand(unsigned I) const
LLVM_ABI StringRef getString() const
LLVM_ABI instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
LLVM_ABI iterator getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
instr_iterator instr_end()
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
iterator insertAfter(iterator I, MachineInstr *MI)
Insert MI into the instruction list after I.
LLVM_ABI bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool hasCalls() const
Return true if the current function has any function calls.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
bool useDebugInstrRef() const
Returns true if the function's variable locations are tracked with instruction referencing.
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index)
Map the landing pad to its index. Used for Wasm exception handling.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
void finalizeDebugInstrRefs()
Finalise any partially emitted debug instructions.
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef< unsigned > Sites)
Map the landing pad's EH symbol to the call site indexes.
void setUseDebugInstrRef(bool UseInstrRef)
Set whether this function will use instruction referencing or not.
MCContext & getContext() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
MCSymbol * addLandingPad(MachineBasicBlock *LandingPad)
Add a new panding pad, and extract the exception handling information from the landingpad instruction...
Function & getFunction()
Return the LLVM function that this machine code represents.
bool shouldUseDebugInstrRef() const
Determine whether, in the current machine configuration, we should use instruction referencing or not...
const MachineFunctionProperties & getProperties() const
Get the function properties.
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable in a stack slot.
const MachineBasicBlock & front() const
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Representation of each machine instruction.
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
const MachineOperand & getOperand(unsigned i) const
A description of a memory reference used in the backend.
An analysis that produces MachineModuleInfo for a module.
This class contains meta information specific to a module.
Register getReg() const
getReg - Returns the register number.
MachinePassRegistry - Track the registration of machine passes.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI MachineInstr * getVRegDef(Register Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
LLVM_ABI void EmitLiveInCopies(MachineBasicBlock *EntryMBB, const TargetRegisterInfo &TRI, const TargetInstrInfo &TII)
EmitLiveInCopies - Emit copies to initialize livein virtual registers into the given entry block.
ArrayRef< std::pair< MCRegister, Register > > liveins() const
iterator_range< use_instr_iterator > use_instructions(Register Reg) const
void addPhysRegsUsedFromRegMask(const uint32_t *RegMask)
addPhysRegsUsedFromRegMask - Mark any registers not in RegMask as used.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
This class is used by SelectionDAGISel to temporarily override the optimization level on a per-functi...
OptLevelChanger(SelectionDAGISel &ISel, CodeGenOptLevel NewOptLevel)
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
AnalysisType * getAnalysisIfAvailable() const
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information tha...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
RegisterPassParser class - Handle the addition of new machine passes.
ScheduleDAGSDNodes *(*)(SelectionDAGISel *, CodeGenOptLevel) FunctionPassCtor
static LLVM_ABI MachinePassRegistry< FunctionPassCtor > Registry
RegisterScheduler class - Track the registration of instruction schedulers.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
SDNode * getGluedUser() const
If this node has a glue value with a user, return the user (there is at most one).
LLVM_ABI bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
iterator_range< value_op_iterator > op_values() const
iterator_range< use_iterator > uses()
void setNodeId(int Id)
Set unique node id.
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallVectorImpl< const SDNode * > &Worklist, unsigned int MaxSteps=0, bool TopologicalPrune=false)
Returns true if N is a predecessor of any node in Worklist.
uint64_t getAsZExtVal() const
Helper method returns the zero-extended integer value of a ConstantSDNode.
bool use_empty() const
Return true if there are no uses of this node.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
unsigned getNumOperands() const
Return the number of values used by this operation.
const SDValue & getOperand(unsigned Num) const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Represents a use of a SDNode.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
void copyToMachineFrameInfo(MachineFrameInfo &MFI) const
bool shouldEmitSDCheck(const BasicBlock &BB) const
ScheduleDAGSDNodes - A ScheduleDAG for scheduling SDNode-based DAGs.
SelectionDAGBuilder - This is the common target-independent lowering implementation that is parameter...
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
SelectionDAGISelLegacy(char &ID, std::unique_ptr< SelectionDAGISel > S)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
std::optional< BatchAAResults > BatchAA
std::unique_ptr< FunctionLoweringInfo > FuncInfo
SmallPtrSet< const Instruction *, 4 > ElidedArgCopyInstrs
virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op, InlineAsm::ConstraintCode ConstraintID, std::vector< SDValue > &OutOps)
SelectInlineAsmMemoryOperand - Select the specified address as a target addressing mode,...
bool CheckOrMask(SDValue LHS, ConstantSDNode *RHS, int64_t DesiredMaskS) const
CheckOrMask - The isel is trying to match something like (or X, 255).
void initializeAnalysisResults(MachineFunctionAnalysisManager &MFAM)
virtual bool CheckNodePredicate(SDValue Op, unsigned PredNo) const
CheckNodePredicate - This function is generated by tblgen in the target.
virtual bool CheckNodePredicateWithOperands(SDValue Op, unsigned PredNo, ArrayRef< SDValue > Operands) const
CheckNodePredicateWithOperands - This function is generated by tblgen in the target.
const TargetLowering * TLI
virtual void PostprocessISelDAG()
PostprocessISelDAG() - This hook allows the target to hack on the graph right after selection.
std::unique_ptr< OptimizationRemarkEmitter > ORE
Current optimization remark emitter.
MachineRegisterInfo * RegInfo
unsigned DAGSize
DAGSize - Size of DAG being instruction selected.
@ OPC_MorphNodeTo2GlueOutput
@ OPC_CheckPatternPredicate5
@ OPC_EmitCopyToRegTwoByte
@ OPC_MorphNodeTo2GlueInput
@ OPC_CheckChild2CondCode
@ OPC_CheckPatternPredicateTwoByte
@ OPC_CheckPatternPredicate1
@ OPC_MorphNodeTo1GlueOutput
@ OPC_EmitMergeInputChains1_1
@ OPC_CheckPatternPredicate2
@ OPC_EmitConvertToTarget2
@ OPC_EmitConvertToTarget0
@ OPC_CheckPatternPredicate4
@ OPC_EmitConvertToTarget1
@ OPC_CheckPatternPredicate
@ OPC_MorphNodeTo0GlueInput
@ OPC_CheckPatternPredicate6
@ OPC_MorphNodeTo0GlueOutput
@ OPC_CheckPatternPredicate7
@ OPC_EmitMergeInputChains
@ OPC_EmitMergeInputChains1_0
@ OPC_CheckFoldableChainNode
@ OPC_EmitConvertToTarget3
@ OPC_CheckPredicateWithOperands
@ OPC_EmitConvertToTarget4
@ OPC_EmitStringInteger32
@ OPC_EmitConvertToTarget7
@ OPC_EmitMergeInputChains1_2
@ OPC_EmitConvertToTarget5
@ OPC_CheckPatternPredicate0
@ OPC_MorphNodeTo1GlueInput
@ OPC_CheckPatternPredicate3
@ OPC_EmitConvertToTarget
@ OPC_EmitConvertToTarget6
bool isOrEquivalentToAdd(const SDNode *N) const
virtual bool CheckComplexPattern(SDNode *Root, SDNode *Parent, SDValue N, unsigned PatternNo, SmallVectorImpl< std::pair< SDValue, SDNode * > > &Result)
virtual bool CheckPatternPredicate(unsigned PredNo) const
CheckPatternPredicate - This function is generated by tblgen in the target.
static int getNumFixedFromVariadicInfo(unsigned Flags)
getNumFixedFromVariadicInfo - Transform an EmitNode flags word into the number of fixed arity values ...
const TargetLibraryInfo * LibInfo
static int getUninvalidatedNodeId(SDNode *N)
const TargetInstrInfo * TII
std::unique_ptr< SwiftErrorValueTracking > SwiftError
void SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable, unsigned TableSize)
static void EnforceNodeIdInvariant(SDNode *N)
void ReplaceUses(SDValue F, SDValue T)
ReplaceUses - replace all uses of the old node F with the use of the new node T.
virtual bool IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const
IsProfitableToFold - Returns true if it's profitable to fold the specific operand node N of U during ...
virtual SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo)
bool MatchFilterFuncName
True if the function currently processing is in the function printing list (i.e.
void SelectInlineAsmMemoryOperands(std::vector< SDValue > &Ops, const SDLoc &DL)
SelectInlineAsmMemoryOperands - Calls to this are automatically generated by tblgen.
static bool IsLegalToFold(SDValue N, SDNode *U, SDNode *Root, CodeGenOptLevel OptLevel, bool IgnoreChains=false)
IsLegalToFold - Returns true if the specific operand node N of U can be folded during instruction sel...
virtual bool ComplexPatternFuncMutatesDAG() const
Return true if complex patterns for this target can mutate the DAG.
virtual void PreprocessISelDAG()
PreprocessISelDAG - This hook allows targets to hack on the graph before instruction selection starts...
BatchAAResults * getBatchAA() const
Returns a (possibly null) pointer to the current BatchAAResults.
bool CheckAndMask(SDValue LHS, ConstantSDNode *RHS, int64_t DesiredMaskS) const
CheckAndMask - The isel is trying to match something like (and X, 255).
virtual ~SelectionDAGISel()
virtual StringRef getPatternForIndex(unsigned index)
getPatternForIndex - Patterns selected by tablegen during ISEL
bool mayRaiseFPException(SDNode *Node) const
Return whether the node may raise an FP exception.
std::unique_ptr< SelectionDAGBuilder > SDB
void ReplaceNode(SDNode *F, SDNode *T)
Replace all uses of F with T, then remove F from the DAG.
SelectionDAGISel(TargetMachine &tm, CodeGenOptLevel OL=CodeGenOptLevel::Default)
virtual bool runOnMachineFunction(MachineFunction &mf)
static void InvalidateNodeId(SDNode *N)
virtual StringRef getIncludePathForIndex(unsigned index)
getIncludePathForIndex - get the td source location of pattern instantiation
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
virtual bool mayRaiseFPException(unsigned Opcode) const
Returns true if a node with the given target-specific opcode may raise a floating-point exception.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
LLVM_ABI bool LegalizeVectors()
This transforms the SelectionDAG into a SelectionDAG that only uses vector math operations supported ...
LLVM_ABI SDNode * SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT)
These are used for target selectors to mutate the specified node to have the specified return type,...
LLVM_ABI void Combine(CombineLevel Level, BatchAAResults *BatchAA, CodeGenOptLevel OptLevel)
This iterates over the nodes in the SelectionDAG, folding certain types of nodes together,...
void setFunctionLoweringInfo(FunctionLoweringInfo *FuncInfo)
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI SDNode * mutateStrictFPToFP(SDNode *Node)
Mutate the specified strict FP node to its non-strict equivalent, unlinking the node from its chain a...
bool NewNodesMustHaveLegalTypes
When true, additional steps are taken to ensure that getConstant() and similar functions return DAG n...
LLVM_ABI void salvageDebugInfo(SDNode &N)
To be invoked on an SDNode that is slated to be erased.
LLVM_ABI SDNode * MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, ArrayRef< SDValue > Ops)
This mutates the specified node to have the specified return type, opcode, and operands.
allnodes_const_iterator allnodes_begin() const
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
LLVM_ABI void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
const DataLayout & getDataLayout() const
LLVM_ABI void viewGraph(const std::string &Title)
Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
LLVM_ABI void Legalize()
This transforms the SelectionDAG into a SelectionDAG that is compatible with the target instruction s...
const SelectionDAGTargetInfo & getSelectionDAGInfo() const
LLVM_ABI void clear()
Clear state and free memory necessary to make this SelectionDAG ready to process a new block.
LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
LLVM_ABI void dump() const
LLVM_ABI void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
LLVM_ABI void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
LLVM_ABI unsigned AssignTopologicalOrder()
Topological-sort the AllNodes list and a assign a unique node id for each node in the DAG based on th...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits.
MachineFunction & getMachineFunction() const
const FunctionVarLocs * getFunctionVarLocs() const
Returns the result of the AssignmentTrackingAnalysis pass if it's available, otherwise return nullptr...
LLVM_ABI KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
LLVM_ABI void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, Pass *PassPtr, const TargetLibraryInfo *LibraryInfo, UniformityInfo *UA, ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin, MachineModuleInfo &MMI, FunctionVarLocs const *FnVarLocs)
Prepare this SelectionDAG to process code in the given MachineFunction.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
ilist< SDNode >::iterator allnodes_iterator
LLVM_ABI bool LegalizeTypes()
This transforms the SelectionDAG into a SelectionDAG that only uses types natively supported by the t...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Analysis pass providing the TargetTransformInfo.
Analysis pass providing the TargetLibraryInfo.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
virtual Function * getSSPStackGuardCheck(const Module &M) const
If the target has a standard stack protection check function that performs validation and error handl...
Sched::Preference getSchedulingPreference() const
Return target scheduling preference.
bool isStrictFPEnabled() const
Return true if the target support strict float operation.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
virtual Register getExceptionPointerRegister(const Constant *PersonalityFn) const
If a physical register, this returns the register that receives the exception address on entry to an ...
virtual Register getExceptionSelectorRegister(const Constant *PersonalityFn) const
If a physical register, this returns the register that receives the exception typeid on entry to a la...
LegalizeAction getOperationAction(unsigned Op, EVT VT) const
Return how this operation should be treated: either it is legal, needs to be promoted to a larger siz...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
virtual Register getRegisterByName(const char *RegName, LLT Ty, const MachineFunction &MF) const
Return the register ID of the name passed in.
virtual void insertCopiesSplitCSR(MachineBasicBlock *Entry, const SmallVectorImpl< MachineBasicBlock * > &Exits) const
Insert explicit copies in entry and exit blocks.
virtual void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
virtual void initializeSplitCSR(MachineBasicBlock *Entry) const
Perform necessary initialization to handle a subset of CSRs explicitly via copies.
virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
virtual FastISel * createFastISel(FunctionLoweringInfo &, const TargetLibraryInfo *) const
This method returns a target specific FastISel object, or null if the target does not support "fast" ...
virtual bool supportSplitCSR(MachineFunction *MF) const
Return true if the target supports that a subset of CSRs for the given machine function is handled ex...
Primary interface to the complete machine description for the target machine.
void setFastISel(bool Enable)
void setOptLevel(CodeGenOptLevel Level)
Overrides the optimization level.
bool getO0WantsFastISel()
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
virtual const TargetLowering * getTargetLowering() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isTokenTy() const
Return true if this is 'token'.
bool isVoidTy() const
Return true if this is 'void'.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
bool hasOneUse() const
Return true if there is exactly one use of this value.
iterator_range< user_iterator > users()
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
self_iterator getIterator()
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
LLVM_ABI bool isConstantSplatVectorAllOnes(const SDNode *N, bool BuildVectorOnly=false)
Return true if the specified node is a BUILD_VECTOR or SPLAT_VECTOR where all of the elements are ~0 ...
@ MDNODE_SDNODE
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR.
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
@ DELETED_NODE
DELETED_NODE - This is an illegal value that is used to catch errors.
@ POISON
POISON - A poison node.
@ JUMP_TABLE_DEBUG_INFO
JUMP_TABLE_DEBUG_INFO - Jumptable debug info.
@ INTRINSIC_VOID
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
@ MEMBARRIER
MEMBARRIER - Compiler barrier only; generate a no-op.
@ FAKE_USE
FAKE_USE represents a use of the operand but does not do anything.
@ EH_LABEL
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
@ ANNOTATION_LABEL
ANNOTATION_LABEL - Represents a mid basic block label used by annotations.
@ UNDEF
UNDEF - An undefined node.
@ AssertAlign
AssertAlign - These nodes record if a register contains a value that has a known alignment and the tr...
@ BasicBlock
Various leaf nodes.
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
@ TargetGlobalAddress
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
@ ARITH_FENCE
ARITH_FENCE - This corresponds to a arithmetic fence intrinsic.
@ AssertNoFPClass
AssertNoFPClass - These nodes record if a register contains a float value that is known to be not som...
@ EntryToken
EntryToken - This is the marker used to indicate the start of a region.
@ READ_REGISTER
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
@ CopyToReg
CopyToReg - This node has three operands: a chain, a register number to set to this value,...
@ LIFETIME_START
This corresponds to the llvm.lifetime.
@ STRICT_SINT_TO_FP
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
@ HANDLENODE
HANDLENODE node - Used as a handle for various purposes.
@ INLINEASM_BR
INLINEASM_BR - Branching version of inline asm. Used by asm-goto.
@ TargetConstant
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification,...
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ INTRINSIC_WO_CHAIN
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
@ PSEUDO_PROBE
Pseudo probe for AutoFDO, as a place holder in a basic block to improve the sample counts quality.
@ FREEZE
FREEZE - FREEZE(VAL) returns an arbitrary value if VAL is UNDEF (or is evaluated to UNDEF),...
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ INLINEASM
INLINEASM - Represents an inline asm block.
@ AssertSext
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
@ INTRINSIC_W_CHAIN
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
LLVM_ABI bool isConstantSplatVectorAllZeros(const SDNode *N, bool BuildVectorOnly=false)
Return true if the specified node is a BUILD_VECTOR or SPLAT_VECTOR where all of the elements are 0 o...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LLVM_ABI StringRef getBaseName(ID id)
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm....
@ Kill
The last use of a register.
Reg
All possible values of the reg field in the ModR/M byte.
initializer< Ty > init(const Ty &Val)
DiagnosticInfoOptimizationBase::Argument NV
LLVM_ABI const_iterator end(StringRef path LLVM_LIFETIME_BOUND)
Get end iterator over path.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI ScheduleDAGSDNodes * createDefaultScheduler(SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createDefaultScheduler - This creates an instruction scheduler appropriate for the target.
bool succ_empty(const Instruction *I)
LLVM_ABI ScheduleDAGSDNodes * createBURRListDAGScheduler(SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createBURRListDAGScheduler - This creates a bottom up register usage reduction list scheduler.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
LLVM_ABI ScheduleDAGSDNodes * createHybridListDAGScheduler(SelectionDAGISel *IS, CodeGenOptLevel)
createHybridListDAGScheduler - This creates a bottom up register pressure aware list scheduler that m...
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
MachineBasicBlock::iterator findSplitPointForStackProtector(MachineBasicBlock *BB, const TargetInstrInfo &TII)
Find the split point at which to splice the end of BB into its success stack protector check machine ...
LLVM_ABI bool TimePassesIsEnabled
If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...
LLVM_ABI LLT getLLTForMVT(MVT Ty)
Get a rough equivalent of an LLT for a given MVT.
LLVM_ABI void initializeGCModuleInfoPass(PassRegistry &)
LLVM_ABI ScheduleDAGSDNodes * createFastDAGScheduler(SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createFastDAGScheduler - This creates a "fast" scheduler.
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI ScheduleDAGSDNodes * createDAGLinearizer(SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createDAGLinearizer - This creates a "no-scheduling" scheduler which linearize the DAG using topologi...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isFunctionInPrintList(StringRef FunctionName)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
CodeGenOptLevel
Code generation optimization level.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
LLVM_ABI ScheduleDAGSDNodes * createSourceListDAGScheduler(SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createSourceListDAGScheduler - This creates a bottom up list scheduler that schedules nodes in source...
LLVM_ABI bool isAssignmentTrackingEnabled(const Module &M)
Return true if assignment tracking is enabled for module M.
void replace(R &&Range, const T &OldValue, const T &NewValue)
Provide wrappers to std::replace which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI void initializeAAResultsWrapperPassPass(PassRegistry &)
LLVM_ABI void initializeTargetLibraryInfoWrapperPassPass(PassRegistry &)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI ScheduleDAGSDNodes * createILPListDAGScheduler(SelectionDAGISel *IS, CodeGenOptLevel)
createILPListDAGScheduler - This creates a bottom up register pressure aware list scheduler that trie...
auto predecessors(const MachineBasicBlock *BB)
LLVM_ABI void initializeBranchProbabilityInfoWrapperPassPass(PassRegistry &)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI ScheduleDAGSDNodes * createVLIWDAGScheduler(SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createVLIWDAGScheduler - Scheduler for VLIW targets.
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool isInteger() const
Return true if this is an integer or a vector integer type.
This class is basically a combination of TimeRegion and Timer.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
Clients of various APIs that cause global effects on the DAG can optionally implement this interface.
void addIPToStateRange(const InvokeInst *II, MCSymbol *InvokeBegin, MCSymbol *InvokeEnd)
DenseMap< const BasicBlock *, int > BlockToStateMap