LLVM 23.0.0git
FunctionPropertiesAnalysis.cpp
Go to the documentation of this file.
1//===- FunctionPropertiesAnalysis.cpp - Function Properties Analysis ------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the FunctionPropertiesInfo and FunctionPropertiesAnalysis
10// classes used to extract function properties.
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/ADT/STLExtras.h"
16#include "llvm/ADT/SetVector.h"
17#include "llvm/ADT/Statistic.h"
19#include "llvm/IR/CFG.h"
20#include "llvm/IR/Constants.h"
21#include "llvm/IR/Dominators.h"
26#include <deque>
27
28using namespace llvm;
29
30#define DEBUG_TYPE "func-properties-stats"
31
32#define FUNCTION_PROPERTY(Name, Description) \
33 STATISTIC(Num##Name##PreOptimization, \
34 Description " (before optimizations)"); \
35 STATISTIC(Num##Name, Description);
36#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
37 STATISTIC(Num##Name##PreOptimization, \
38 Description " (before optimizations)"); \
39 STATISTIC(Num##Name, Description);
40#include "llvm/IR/FunctionProperties.def"
41
42namespace llvm {
44 "enable-detailed-function-properties", cl::Hidden, cl::init(false),
45 cl::desc("Whether or not to compute detailed function properties."));
46
48 "big-basic-block-instruction-threshold", cl::Hidden, cl::init(500),
49 cl::desc("The minimum number of instructions a basic block should contain "
50 "before being considered big."));
51
53 "medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15),
54 cl::desc("The minimum number of instructions a basic block should contain "
55 "before being considered medium-sized."));
56} // namespace llvm
57
59 "call-with-many-arguments-threshold", cl::Hidden, cl::init(4),
60 cl::desc("The minimum number of arguments a function call must have before "
61 "it is considered having many arguments."));
62
63namespace {
64int64_t getNumBlocksFromCond(const BasicBlock &BB) {
65 int64_t Ret = 0;
66 if (const auto *BI = dyn_cast<CondBrInst>(BB.getTerminator())) {
67 Ret += BI->getNumSuccessors();
68 } else if (const auto *SI = dyn_cast<SwitchInst>(BB.getTerminator())) {
69 Ret += (SI->getNumCases() + (nullptr != SI->getDefaultDest()));
70 }
71 return Ret;
72}
73
74int64_t getUses(const Function &F) {
75 return ((!F.hasLocalLinkage()) ? 1 : 0) + F.getNumUses();
76}
77} // namespace
78
79void FunctionPropertiesInfo::reIncludeBB(const BasicBlock &BB) {
80 updateForBB(BB, +1);
81}
82
83void FunctionPropertiesInfo::updateForBB(const BasicBlock &BB,
84 int64_t Direction) {
85 assert(Direction == 1 || Direction == -1);
88 (Direction * getNumBlocksFromCond(BB));
89 for (const auto &I : BB) {
90 if (auto *CS = dyn_cast<CallBase>(&I)) {
91 const auto *Callee = CS->getCalledFunction();
92 if (Callee && !Callee->isIntrinsic() && !Callee->isDeclaration())
94 }
95 if (I.getOpcode() == Instruction::Load) {
97 } else if (I.getOpcode() == Instruction::Store) {
99 }
100 }
101 TotalInstructionCount += Direction * BB.size();
102
104 unsigned SuccessorCount = succ_size(&BB);
105 if (SuccessorCount == 1)
107 else if (SuccessorCount == 2)
109 else if (SuccessorCount > 2)
111
112 unsigned PredecessorCount = pred_size(&BB);
113 if (PredecessorCount == 1)
115 else if (PredecessorCount == 2)
117 else if (PredecessorCount > 2)
119
124 else
126
127 // Calculate critical edges by looking through all successors of a basic
128 // block that has multiple successors and finding ones that have multiple
129 // predecessors, which represent critical edges.
130 if (SuccessorCount > 1) {
131 for (const auto *Successor : successors(&BB)) {
132 if (pred_size(Successor) > 1)
134 }
135 }
136
137 ControlFlowEdgeCount += Direction * SuccessorCount;
138
139 const Instruction *TI = BB.getTerminator();
140 if (isa<UncondBrInst>(TI)) {
144 } else if (isa<CondBrInst>(TI)) {
148 } else if (const auto *SI = dyn_cast<SwitchInst>(TI)) {
150 SwitchSuccessorCount += Direction * SI->getNumSuccessors();
151 }
152
153 for (const Instruction &I : BB) {
154 if (I.isCast())
156
157 if (I.getType()->isFloatTy())
159 else if (I.getType()->isIntegerTy())
161
164
165 if (const auto *Call = dyn_cast<CallInst>(&I)) {
166 if (Call->isIndirectCall())
168 else
170
171 if (Call->getType()->isIntegerTy())
173 else if (Call->getType()->isFloatingPointTy())
175 else if (Call->getType()->isPointerTy())
177 else if (Call->getType()->isVectorTy()) {
182 else if (Call->getType()->getScalarType()->isPointerTy())
184 }
185
188
189 for (const auto &Arg : Call->args()) {
190 if (Arg->getType()->isPointerTy()) {
192 break;
193 }
194 }
195 }
196
197#define COUNT_OPERAND(OPTYPE) \
198 if (isa<OPTYPE>(Operand)) { \
199 OPTYPE##OperandCount += Direction; \
200 continue; \
201 }
202
203 for (unsigned int OperandIndex = 0; OperandIndex < I.getNumOperands();
204 ++OperandIndex) {
205 Value *Operand = I.getOperand(OperandIndex);
206 COUNT_OPERAND(GlobalValue)
207 COUNT_OPERAND(ConstantInt)
208 COUNT_OPERAND(ConstantFP)
209 COUNT_OPERAND(Constant)
210 COUNT_OPERAND(Instruction)
211 COUNT_OPERAND(BasicBlock)
212 COUNT_OPERAND(InlineAsm)
213 COUNT_OPERAND(Argument)
214
215 // We only get to this point if we haven't matched any of the other
216 // operand types.
218 }
219
220#undef CHECK_OPERAND
221 }
222 }
223
224 if (IR2VecVocab) {
225 // We instantiate the IR2Vec embedder each time, as having an unique
226 // pointer to the embedder as member of the class would make it
227 // non-copyable. Instantiating the embedder in itself is not costly.
229 *BB.getParent(), *IR2VecVocab);
230 if (!Embedder) {
231 BB.getContext().emitError("Error creating IR2Vec embeddings");
232 return;
233 }
234 const auto &BBEmbedding = Embedder->getBBVector(BB);
235 // Subtract BBEmbedding from Function embedding if the direction is -1,
236 // and add it if the direction is +1.
237 if (Direction == -1)
238 FunctionEmbedding -= BBEmbedding;
239 else
240 FunctionEmbedding += BBEmbedding;
241 }
242}
243
244void FunctionPropertiesInfo::updateAggregateStats(const Function &F,
245 const LoopInfo &LI) {
246
247 Uses = getUses(F);
249 MaxLoopDepth = 0;
250 std::deque<const Loop *> Worklist;
251 llvm::append_range(Worklist, LI);
252 while (!Worklist.empty()) {
253 const auto *L = Worklist.front();
255 std::max(MaxLoopDepth, static_cast<int64_t>(L->getLoopDepth()));
256 Worklist.pop_front();
257 llvm::append_range(Worklist, L->getSubLoops());
258 }
259}
260
263 // We use the cached result of the IR2VecVocabAnalysis run by
264 // InlineAdvisorAnalysis. If the IR2VecVocabAnalysis is not run, we don't
265 // use IR2Vec embeddings.
266 auto Vocabulary = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
267 .getCachedResult<IR2VecVocabAnalysis>(*F.getParent());
269 FAM.getResult<LoopAnalysis>(F), Vocabulary);
270}
271
273 const Function &F, const DominatorTree &DT, const LoopInfo &LI,
274 const ir2vec::Vocabulary *Vocabulary) {
275
277 if (Vocabulary && Vocabulary->isValid()) {
278 FPI.IR2VecVocab = Vocabulary;
279 FPI.FunctionEmbedding = ir2vec::Embedding(Vocabulary->getDimension(), 0.0);
280 }
281 for (const auto &BB : F)
282 if (DT.isReachableFromEntry(&BB))
283 FPI.reIncludeBB(BB);
284 FPI.updateAggregateStats(F, LI);
285 return FPI;
286}
287
289 const FunctionPropertiesInfo &FPI) const {
290 if (BasicBlockCount != FPI.BasicBlockCount ||
293 Uses != FPI.Uses ||
297 MaxLoopDepth != FPI.MaxLoopDepth ||
338 return false;
339 }
340 // Check the equality of the function embeddings. We don't check the equality
341 // of Vocabulary as it remains the same.
342 if (!FunctionEmbedding.approximatelyEquals(FPI.FunctionEmbedding))
343 return false;
344
345 return true;
346}
347
349#define FUNCTION_PROPERTY(Name, Description) OS << #Name ": " << Name << "\n";
350
351#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
352 if (EnableDetailedFunctionProperties) { \
353 OS << #Name ": " << Name << "\n"; \
354 }
355
356#include "llvm/IR/FunctionProperties.def"
357
358#undef FUNCTION_PROPERTY
359#undef DETAILED_FUNCTION_PROPERTY
360
361 OS << "\n";
362}
363
365
370
373 OS << "Printing analysis results of CFA for function "
374 << "'" << F.getName() << "':"
375 << "\n";
377 return PreservedAnalyses::all();
378}
379
383 LLVM_DEBUG(dbgs() << "STATSCOUNT: running on function " << F.getName()
384 << "\n");
385 auto &AnalysisResults = FAM.getResult<FunctionPropertiesAnalysis>(F);
386 if (IsPreOptimization) {
387#define FUNCTION_PROPERTY(Name, Description) \
388 Num##Name##PreOptimization += AnalysisResults.Name;
389#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
390 Num##Name##PreOptimization += AnalysisResults.Name;
391#include "llvm/IR/FunctionProperties.def"
392#undef FUNCTION_PROPERTY
393#undef DETAILED_FUNCTION_PROPERTY
394 } else {
395#define FUNCTION_PROPERTY(Name, Description) Num##Name += AnalysisResults.Name;
396#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
397 Num##Name += AnalysisResults.Name;
398#include "llvm/IR/FunctionProperties.def"
399#undef FUNCTION_PROPERTY
400#undef DETAILED_FUNCTION_PROPERTY
401 }
402
403 return PreservedAnalyses::all();
404}
405
408 : FPI(FPI), CallSiteBB(*CB.getParent()), Caller(*CallSiteBB.getParent()) {
410 // For BBs that are likely to change, we subtract from feature totals their
411 // contribution. Some features, like max loop counts or depths, are left
412 // invalid, as they will be updated post-inlining.
413 SmallPtrSet<const BasicBlock *, 4> LikelyToChangeBBs;
414 // The CB BB will change - it'll either be split or the callee's body (single
415 // BB) will be pasted in.
416 LikelyToChangeBBs.insert(&CallSiteBB);
417
418 // The caller's entry BB may change due to new alloca instructions.
419 LikelyToChangeBBs.insert(&*Caller.begin());
420
421 // The users of the value returned by call instruction can change
422 // leading to the change in embeddings being computed, when used.
423 // We conservatively add the BBs with such uses to LikelyToChangeBBs.
424 for (const auto *User : CB.users())
425 CallUsers.insert(dyn_cast<Instruction>(User)->getParent());
426 // CallSiteBB can be removed from CallUsers if present, it's taken care
427 // separately.
428 CallUsers.erase(&CallSiteBB);
429 LikelyToChangeBBs.insert_range(CallUsers);
430
431 // The successors may become unreachable in the case of `invoke` inlining.
432 // We track successors separately, too, because they form a boundary, together
433 // with the CB BB ('Entry') between which the inlined callee will be pasted.
434 Successors.insert_range(successors(&CallSiteBB));
435
436 // the outcome of the inlining may be that some edges get lost (DCEd BBs
437 // because inlining brought some constant, for example). We don't know which
438 // edges will be removed, so we list all of them as potentially removable.
439 // Some BBs have (at this point) duplicate edges. Remove duplicates, otherwise
440 // the DT updater will not apply changes correctly.
442 for (auto *Succ : successors(&CallSiteBB))
443 if (Inserted.insert(Succ).second)
444 DomTreeUpdates.emplace_back(DominatorTree::UpdateKind::Delete,
445 const_cast<BasicBlock *>(&CallSiteBB),
446 const_cast<BasicBlock *>(Succ));
447 // Reuse Inserted (which has some allocated capacity at this point) below, if
448 // we have an invoke.
449 Inserted.clear();
450 // Inlining only handles invoke and calls. If this is an invoke, and inlining
451 // it pulls another invoke, the original landing pad may get split, so as to
452 // share its content with other potential users. So the edge up to which we
453 // need to invalidate and then re-account BB data is the successors of the
454 // current landing pad. We can leave the current lp, too - if it doesn't get
455 // split, then it will be the place traversal stops. Either way, the
456 // discounted BBs will be checked if reachable and re-added.
457 if (const auto *II = dyn_cast<InvokeInst>(&CB)) {
458 const auto *UnwindDest = II->getUnwindDest();
459 Successors.insert_range(successors(UnwindDest));
460 // Same idea as above, we pretend we lose all these edges.
461 for (auto *Succ : successors(UnwindDest))
462 if (Inserted.insert(Succ).second)
463 DomTreeUpdates.emplace_back(DominatorTree::UpdateKind::Delete,
464 const_cast<BasicBlock *>(UnwindDest),
465 const_cast<BasicBlock *>(Succ));
466 }
467
468 // Exclude the CallSiteBB, if it happens to be its own successor (1-BB loop).
469 // We are only interested in BBs the graph moves past the callsite BB to
470 // define the frontier past which we don't want to re-process BBs. Including
471 // the callsite BB in this case would prematurely stop the traversal in
472 // finish().
473 Successors.erase(&CallSiteBB);
474
475 LikelyToChangeBBs.insert_range(Successors);
476
477 // Commit the change. While some of the BBs accounted for above may play dual
478 // role - e.g. caller's entry BB may be the same as the callsite BB - set
479 // insertion semantics make sure we account them once. This needs to be
480 // followed in `finish`, too.
481 for (const auto *BB : LikelyToChangeBBs)
482 FPI.updateForBB(*BB, -1);
483}
484
485DominatorTree &FunctionPropertiesUpdater::getUpdatedDominatorTree(
487 auto &DT =
488 FAM.getResult<DominatorTreeAnalysis>(const_cast<Function &>(Caller));
489
491
493 for (auto *Succ : successors(&CallSiteBB))
494 if (Inserted.insert(Succ).second)
495 FinalDomTreeUpdates.push_back({DominatorTree::UpdateKind::Insert,
496 const_cast<BasicBlock *>(&CallSiteBB),
497 const_cast<BasicBlock *>(Succ)});
498
499 // Perform the deletes last, so that any new nodes connected to nodes
500 // participating in the edge deletion are known to the DT.
501 for (auto &Upd : DomTreeUpdates)
502 if (!llvm::is_contained(successors(Upd.getFrom()), Upd.getTo()))
503 FinalDomTreeUpdates.push_back(Upd);
504
505 DT.applyUpdates(FinalDomTreeUpdates);
506#ifdef EXPENSIVE_CHECKS
507 assert(DT.verify(DominatorTree::VerificationLevel::Full));
508#endif
509 return DT;
510}
511
513 // Update feature values from the BBs that were copied from the callee, or
514 // might have been modified because of inlining. The latter have been
515 // subtracted in the FunctionPropertiesUpdater ctor.
516 // There could be successors that were reached before but now are only
517 // reachable from elsewhere in the CFG.
518 // One example is the following diamond CFG (lines are arrows pointing down):
519 // A
520 // / \
521 // B C
522 // | |
523 // | D
524 // | |
525 // | E
526 // \ /
527 // F
528 // There's a call site in C that is inlined. Upon doing that, it turns out
529 // it expands to
530 // call void @llvm.trap()
531 // unreachable
532 // F isn't reachable from C anymore, but we did discount it when we set up
533 // FunctionPropertiesUpdater, so we need to re-include it here.
534 // At the same time, D and E were reachable before, but now are not anymore,
535 // so we need to leave D out (we discounted it at setup), and explicitly
536 // remove E.
539 auto &DT = getUpdatedDominatorTree(FAM);
540
541 if (&CallSiteBB != &*Caller.begin())
542 Reinclude.insert(&*Caller.begin());
543
544 // Reinclude the BBs which use the values returned by call instruction
545 Reinclude.insert_range(CallUsers);
546
547 // Distribute the successors to the 2 buckets.
548 for (const auto *Succ : Successors)
549 if (DT.isReachableFromEntry(Succ))
550 Reinclude.insert(Succ);
551 else
552 Unreachable.insert(Succ);
553
554 // For reinclusion, we want to stop at the reachable successors, who are at
555 // the beginning of the worklist; but, starting from the callsite bb and
556 // ending at those successors, we also want to perform a traversal.
557 // IncludeSuccessorsMark is the index after which we include successors.
558 const auto IncludeSuccessorsMark = Reinclude.size();
559 bool CSInsertion = Reinclude.insert(&CallSiteBB);
560 (void)CSInsertion;
561 assert(CSInsertion);
562 for (size_t I = 0; I < Reinclude.size(); ++I) {
563 const auto *BB = Reinclude[I];
564 FPI.reIncludeBB(*BB);
565 if (I >= IncludeSuccessorsMark)
566 Reinclude.insert_range(successors(BB));
567 }
568
569 // For exclusion, we don't need to exclude the set of BBs that were successors
570 // before and are now unreachable, because we already did that at setup. For
571 // the rest, as long as a successor is unreachable, we want to explicitly
572 // exclude it.
573 const auto AlreadyExcludedMark = Unreachable.size();
574 for (size_t I = 0; I < Unreachable.size(); ++I) {
575 const auto *U = Unreachable[I];
576 if (I >= AlreadyExcludedMark)
577 FPI.updateForBB(*U, -1);
578 for (const auto *Succ : successors(U))
579 if (!DT.isReachableFromEntry(Succ))
580 Unreachable.insert(Succ);
581 }
582
583 const auto &LI = FAM.getResult<LoopAnalysis>(const_cast<Function &>(Caller));
584 FPI.updateAggregateStats(Caller, LI);
585#ifdef EXPENSIVE_CHECKS
586 assert(isUpdateValid(Caller, FPI, FAM));
587#endif
588}
589
590bool FunctionPropertiesUpdater::isUpdateValid(Function &F,
591 const FunctionPropertiesInfo &FPI,
593 if (!FAM.getResult<DominatorTreeAnalysis>(F).verify(
594 DominatorTree::VerificationLevel::Full))
595 return false;
596 DominatorTree DT(F);
597 LoopInfo LI(DT);
598 auto Vocabulary = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
599 .getCachedResult<IR2VecVocabAnalysis>(*F.getParent());
600 auto Fresh =
602 return FPI == Fresh;
603}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static const Function * getParent(const Value *V)
#define LLVM_ABI
Definition Compiler.h:213
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static cl::opt< unsigned > CallWithManyArgumentsThreshold("call-with-many-arguments-threshold", cl::Hidden, cl::init(4), cl::desc("The minimum number of arguments a function call must have before " "it is considered having many arguments."))
#define COUNT_OPERAND(OPTYPE)
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
Loop::LoopBounds::Direction Direction
Definition LoopInfo.cpp:253
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
This file contains some templates that are useful if you are working with the STL at all.
This file implements a set that has insertion order iteration characteristics.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define LLVM_DEBUG(...)
Definition Debug.h:114
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Definition BasicBlock.h:237
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
LLVM_ABI bool isIndirectCall() const
Return true if the callsite is an indirect call.
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
unsigned arg_size() const
Implements a dense probed hash-table based set.
Definition DenseSet.h:279
Analysis pass which computes a DominatorTree.
Definition Dominators.h:278
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:159
LLVM_ABI bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
LLVM_ABI FunctionPropertiesInfo run(Function &F, FunctionAnalysisManager &FAM)
int64_t BasicBlockCount
Number of basic blocks.
int64_t Uses
Number of uses of this function, plus 1 if the function is callable outside the module.
int64_t BlocksReachedFromConditionalInstruction
Number of blocks reached from a conditional instruction, or that are 'cases' of a SwitchInstr.
LLVM_ABI bool operator==(const FunctionPropertiesInfo &FPI) const
static LLVM_ABI FunctionPropertiesInfo getFunctionPropertiesInfo(const Function &F, const DominatorTree &DT, const LoopInfo &LI, const ir2vec::Vocabulary *Vocabulary)
LLVM_ABI void print(raw_ostream &OS) const
int64_t DirectCallsToDefinedFunctions
Number of direct calls made from this function to other functions defined in this module.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
LLVM_ABI FunctionPropertiesUpdater(FunctionPropertiesInfo &FPI, CallBase &CB)
LLVM_ABI void finish(FunctionAnalysisManager &FAM) const
Analysis pass that exposes the LoopInfo for a function.
Definition LoopInfo.h:569
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
A vector that has set insertion semantics.
Definition SetVector.h:57
size_type size() const
Determine the number of elements in the SetVector.
Definition SetVector.h:103
void insert_range(Range &&R)
Definition SetVector.h:176
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition SetVector.h:151
void insert_range(Range &&R)
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 is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:290
bool isPointerTy() const
True if this is an instance of PointerType.
Definition Type.h:284
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition Type.h:370
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition Type.h:186
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition Type.h:257
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:255
iterator_range< user_iterator > users()
Definition Value.h:426
static LLVM_ABI std::unique_ptr< Embedder > create(IR2VecKind Mode, const Function &F, const Vocabulary &Vocab)
Factory method to create an Embedder object.
Definition IR2Vec.cpp:156
Class for storing and accessing the IR2Vec vocabulary.
Definition IR2Vec.h:248
LLVM_ABI unsigned getDimension() const
Definition IR2Vec.h:351
LLVM_ABI bool isValid() const
Definition IR2Vec.h:347
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
CallInst * Call
initializer< Ty > init(const Ty &Val)
friend class Instruction
Iterator for Instructions in a `BasicBlock.
Definition BasicBlock.h:73
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
Definition InstrProf.h:137
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition STLExtras.h:1669
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
auto successors(const MachineBasicBlock *BB)
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI cl::opt< bool > EnableDetailedFunctionProperties("enable-detailed-function-properties", cl::Hidden, cl::init(false), cl::desc("Whether or not to compute detailed function properties."))
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2208
auto pred_size(const MachineBasicBlock *BB)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:207
auto succ_size(const MachineBasicBlock *BB)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
static cl::opt< unsigned > BigBasicBlockInstructionThreshold("big-basic-block-instruction-threshold", cl::Hidden, cl::init(500), cl::desc("The minimum number of instructions a basic block should contain " "before being considered big."))
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition STLExtras.h:1947
static cl::opt< unsigned > MediumBasicBlockInstructionThreshold("medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15), cl::desc("The minimum number of instructions a basic block should contain " "before being considered medium-sized."))
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
Embedding is a datatype that wraps std::vector<double>.
Definition IR2Vec.h:88