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, Description); \
34 STATISTIC(Num##Name##PreOptimization, Description " (before " \
35 "optimizations)");
36#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
37 STATISTIC(Num##Name, Description); \
38 STATISTIC(Num##Name##PreOptimization, Description " (before " \
39 "optimizations)");
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 if (BB.hasNPredecessors(1))
114 else if (BB.hasNPredecessors(2))
116 else if (BB.hasNPredecessorsOrMore(3))
118
123 else
125
126 // Calculate critical edges by looking through all successors of a basic
127 // block that has multiple successors and finding ones that have multiple
128 // predecessors, which represent critical edges.
129 if (SuccessorCount > 1) {
130 for (const auto *Successor : successors(&BB)) {
131 if (Successor->hasNPredecessorsOrMore(2))
133 }
134 }
135
136 ControlFlowEdgeCount += Direction * SuccessorCount;
137
138 const Instruction *TI = BB.getTerminator();
139 if (isa<UncondBrInst>(TI)) {
143 } else if (isa<CondBrInst>(TI)) {
147 } else if (const auto *SI = dyn_cast<SwitchInst>(TI)) {
149 SwitchSuccessorCount += Direction * SI->getNumSuccessors();
150 }
151
152 for (const Instruction &I : BB) {
153 if (I.isCast())
155
156 if (I.getType()->isFloatTy())
158 else if (I.getType()->isIntegerTy())
160
163
164 if (const auto *Call = dyn_cast<CallInst>(&I)) {
165 if (Call->doesNotReturn())
167
168 if (Call->isIndirectCall())
170 else
172
173 if (Call->getType()->isIntegerTy())
175 else if (Call->getType()->isFloatingPointTy())
177 else if (Call->getType()->isPointerTy())
179 else if (Call->getType()->isVectorTy()) {
184 else if (Call->getType()->getScalarType()->isPointerTy())
186 }
187
190
191 for (const auto &Arg : Call->args()) {
192 if (Arg->getType()->isPointerTy()) {
194 break;
195 }
196 }
197 }
198
199#define COUNT_OPERAND(OPTYPE) \
200 if (isa<OPTYPE>(Operand)) { \
201 OPTYPE##OperandCount += Direction; \
202 continue; \
203 }
204
205 for (unsigned int OperandIndex = 0; OperandIndex < I.getNumOperands();
206 ++OperandIndex) {
207 Value *Operand = I.getOperand(OperandIndex);
208 COUNT_OPERAND(GlobalValue)
209 COUNT_OPERAND(ConstantInt)
210 COUNT_OPERAND(ConstantFP)
211 COUNT_OPERAND(Constant)
212 COUNT_OPERAND(Instruction)
213 COUNT_OPERAND(BasicBlock)
214 COUNT_OPERAND(InlineAsm)
215 COUNT_OPERAND(Argument)
216
217 // We only get to this point if we haven't matched any of the other
218 // operand types.
220 }
221
222#undef CHECK_OPERAND
223 }
224 }
225
226 if (IR2VecVocab) {
227 // We instantiate the IR2Vec embedder each time, as having an unique
228 // pointer to the embedder as member of the class would make it
229 // non-copyable. Instantiating the embedder in itself is not costly.
231 *BB.getParent(), *IR2VecVocab);
232 if (!Embedder) {
233 BB.getContext().emitError("Error creating IR2Vec embeddings");
234 return;
235 }
236 const auto &BBEmbedding = Embedder->getBBVector(BB);
237 // Subtract BBEmbedding from Function embedding if the direction is -1,
238 // and add it if the direction is +1.
239 if (Direction == -1)
240 FunctionEmbedding -= BBEmbedding;
241 else
242 FunctionEmbedding += BBEmbedding;
243 }
244}
245
246void FunctionPropertiesInfo::updateAggregateStats(const Function &F,
247 const LoopInfo &LI) {
248
249 Uses = getUses(F);
251 MaxLoopDepth = 0;
252 std::deque<const Loop *> Worklist;
253 llvm::append_range(Worklist, LI);
254 while (!Worklist.empty()) {
255 const auto *L = Worklist.front();
257 std::max(MaxLoopDepth, static_cast<int64_t>(L->getLoopDepth()));
258 Worklist.pop_front();
259 llvm::append_range(Worklist, L->getSubLoops());
260 }
261}
262
265 // We use the cached result of the IR2VecVocabAnalysis run by
266 // InlineAdvisorAnalysis. If the IR2VecVocabAnalysis is not run, we don't
267 // use IR2Vec embeddings.
268 auto Vocabulary = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
269 .getCachedResult<IR2VecVocabAnalysis>(*F.getParent());
271 FAM.getResult<LoopAnalysis>(F), Vocabulary);
272}
273
275 const Function &F, const DominatorTree &DT, const LoopInfo &LI,
276 const ir2vec::Vocabulary *Vocabulary) {
277
279 if (Vocabulary && Vocabulary->isValid()) {
280 FPI.IR2VecVocab = Vocabulary;
281 FPI.FunctionEmbedding = ir2vec::Embedding(Vocabulary->getDimension(), 0.0);
282 }
283 for (const auto &BB : F)
284 if (DT.isReachableFromEntry(&BB))
285 FPI.reIncludeBB(BB);
286 FPI.updateAggregateStats(F, LI);
287 return FPI;
288}
289
291 const FunctionPropertiesInfo &FPI) const {
292 if (BasicBlockCount != FPI.BasicBlockCount ||
295 Uses != FPI.Uses ||
299 MaxLoopDepth != FPI.MaxLoopDepth ||
341 return false;
342 }
343 // Check the equality of the function embeddings. We don't check the equality
344 // of Vocabulary as it remains the same.
345 if (!FunctionEmbedding.approximatelyEquals(FPI.FunctionEmbedding))
346 return false;
347
348 return true;
349}
350
352#define FUNCTION_PROPERTY(Name, Description) OS << #Name ": " << Name << "\n";
353
354#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
355 if (EnableDetailedFunctionProperties) { \
356 OS << #Name ": " << Name << "\n"; \
357 }
358
359#include "llvm/IR/FunctionProperties.def"
360
361#undef FUNCTION_PROPERTY
362#undef DETAILED_FUNCTION_PROPERTY
363
364 OS << "\n";
365}
366
368
373
376 OS << "Printing analysis results of CFA for function "
377 << "'" << F.getName() << "':"
378 << "\n";
380 return PreservedAnalyses::all();
381}
382
386 LLVM_DEBUG(dbgs() << "STATSCOUNT: running on function " << F.getName()
387 << "\n");
388 auto &AnalysisResults = FAM.getResult<FunctionPropertiesAnalysis>(F);
389 if (IsPreOptimization) {
390#define FUNCTION_PROPERTY(Name, Description) \
391 Num##Name##PreOptimization += AnalysisResults.Name;
392#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
393 Num##Name##PreOptimization += AnalysisResults.Name;
394#include "llvm/IR/FunctionProperties.def"
395#undef FUNCTION_PROPERTY
396#undef DETAILED_FUNCTION_PROPERTY
397 } else {
398#define FUNCTION_PROPERTY(Name, Description) Num##Name += AnalysisResults.Name;
399#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
400 Num##Name += AnalysisResults.Name;
401#include "llvm/IR/FunctionProperties.def"
402#undef FUNCTION_PROPERTY
403#undef DETAILED_FUNCTION_PROPERTY
404 }
405 return PreservedAnalyses::all();
406}
407
410 : FPI(FPI), CallSiteBB(*CB.getParent()), Caller(*CallSiteBB.getParent()) {
412 // For BBs that are likely to change, we subtract from feature totals their
413 // contribution. Some features, like max loop counts or depths, are left
414 // invalid, as they will be updated post-inlining.
415 SmallPtrSet<const BasicBlock *, 4> LikelyToChangeBBs;
416 // The CB BB will change - it'll either be split or the callee's body (single
417 // BB) will be pasted in.
418 LikelyToChangeBBs.insert(&CallSiteBB);
419
420 // The caller's entry BB may change due to new alloca instructions.
421 LikelyToChangeBBs.insert(&*Caller.begin());
422
423 // The users of the value returned by call instruction can change
424 // leading to the change in embeddings being computed, when used.
425 // We conservatively add the BBs with such uses to LikelyToChangeBBs.
426 for (const auto *User : CB.users())
427 CallUsers.insert(dyn_cast<Instruction>(User)->getParent());
428 // CallSiteBB can be removed from CallUsers if present, it's taken care
429 // separately.
430 CallUsers.erase(&CallSiteBB);
431 LikelyToChangeBBs.insert_range(CallUsers);
432
433 // The successors may become unreachable in the case of `invoke` inlining.
434 // We track successors separately, too, because they form a boundary, together
435 // with the CB BB ('Entry') between which the inlined callee will be pasted.
436 Successors.insert_range(successors(&CallSiteBB));
437
438 // the outcome of the inlining may be that some edges get lost (DCEd BBs
439 // because inlining brought some constant, for example). We don't know which
440 // edges will be removed, so we list all of them as potentially removable.
441 // Some BBs have (at this point) duplicate edges. Remove duplicates, otherwise
442 // the DT updater will not apply changes correctly.
444 for (auto *Succ : successors(&CallSiteBB))
445 if (Inserted.insert(Succ).second)
446 DomTreeUpdates.emplace_back(DominatorTree::UpdateKind::Delete,
447 const_cast<BasicBlock *>(&CallSiteBB),
448 const_cast<BasicBlock *>(Succ));
449 // Reuse Inserted (which has some allocated capacity at this point) below, if
450 // we have an invoke.
451 Inserted.clear();
452 // Inlining only handles invoke and calls. If this is an invoke, and inlining
453 // it pulls another invoke, the original landing pad may get split, so as to
454 // share its content with other potential users. So the edge up to which we
455 // need to invalidate and then re-account BB data is the successors of the
456 // current landing pad. We can leave the current lp, too - if it doesn't get
457 // split, then it will be the place traversal stops. Either way, the
458 // discounted BBs will be checked if reachable and re-added.
459 if (const auto *II = dyn_cast<InvokeInst>(&CB)) {
460 const auto *UnwindDest = II->getUnwindDest();
461 Successors.insert_range(successors(UnwindDest));
462 // Same idea as above, we pretend we lose all these edges.
463 for (auto *Succ : successors(UnwindDest))
464 if (Inserted.insert(Succ).second)
465 DomTreeUpdates.emplace_back(DominatorTree::UpdateKind::Delete,
466 const_cast<BasicBlock *>(UnwindDest),
467 const_cast<BasicBlock *>(Succ));
468 }
469
470 // Exclude the CallSiteBB, if it happens to be its own successor (1-BB loop).
471 // We are only interested in BBs the graph moves past the callsite BB to
472 // define the frontier past which we don't want to re-process BBs. Including
473 // the callsite BB in this case would prematurely stop the traversal in
474 // finish().
475 Successors.erase(&CallSiteBB);
476
477 LikelyToChangeBBs.insert_range(Successors);
478
479 // Commit the change. While some of the BBs accounted for above may play dual
480 // role - e.g. caller's entry BB may be the same as the callsite BB - set
481 // insertion semantics make sure we account them once. This needs to be
482 // followed in `finish`, too.
483 for (const auto *BB : LikelyToChangeBBs)
484 FPI.updateForBB(*BB, -1);
485}
486
487DominatorTree &FunctionPropertiesUpdater::getUpdatedDominatorTree(
489 auto &DT =
490 FAM.getResult<DominatorTreeAnalysis>(const_cast<Function &>(Caller));
491
493
495 for (auto *Succ : successors(&CallSiteBB))
496 if (Inserted.insert(Succ).second)
497 FinalDomTreeUpdates.push_back({DominatorTree::UpdateKind::Insert,
498 const_cast<BasicBlock *>(&CallSiteBB),
499 const_cast<BasicBlock *>(Succ)});
500
501 // Perform the deletes last, so that any new nodes connected to nodes
502 // participating in the edge deletion are known to the DT.
503 for (auto &Upd : DomTreeUpdates)
504 if (!llvm::is_contained(successors(Upd.getFrom()), Upd.getTo()))
505 FinalDomTreeUpdates.push_back(Upd);
506
507 DT.applyUpdates(FinalDomTreeUpdates);
508#ifdef EXPENSIVE_CHECKS
509 assert(DT.verify(DominatorTree::VerificationLevel::Full));
510#endif
511 return DT;
512}
513
515 // Update feature values from the BBs that were copied from the callee, or
516 // might have been modified because of inlining. The latter have been
517 // subtracted in the FunctionPropertiesUpdater ctor.
518 // There could be successors that were reached before but now are only
519 // reachable from elsewhere in the CFG.
520 // One example is the following diamond CFG (lines are arrows pointing down):
521 // A
522 // / \
523 // B C
524 // | |
525 // | D
526 // | |
527 // | E
528 // \ /
529 // F
530 // There's a call site in C that is inlined. Upon doing that, it turns out
531 // it expands to
532 // call void @llvm.trap()
533 // unreachable
534 // F isn't reachable from C anymore, but we did discount it when we set up
535 // FunctionPropertiesUpdater, so we need to re-include it here.
536 // At the same time, D and E were reachable before, but now are not anymore,
537 // so we need to leave D out (we discounted it at setup), and explicitly
538 // remove E.
541 auto &DT = getUpdatedDominatorTree(FAM);
542
543 if (&CallSiteBB != &*Caller.begin())
544 Reinclude.insert(&*Caller.begin());
545
546 // Reinclude the BBs which use the values returned by call instruction
547 Reinclude.insert_range(CallUsers);
548
549 // Distribute the successors to the 2 buckets.
550 for (const auto *Succ : Successors)
551 if (DT.isReachableFromEntry(Succ))
552 Reinclude.insert(Succ);
553 else
554 Unreachable.insert(Succ);
555
556 // For reinclusion, we want to stop at the reachable successors, who are at
557 // the beginning of the worklist; but, starting from the callsite bb and
558 // ending at those successors, we also want to perform a traversal.
559 // IncludeSuccessorsMark is the index after which we include successors.
560 const auto IncludeSuccessorsMark = Reinclude.size();
561 bool CSInsertion = Reinclude.insert(&CallSiteBB);
562 (void)CSInsertion;
563 assert(CSInsertion);
564 for (size_t I = 0; I < Reinclude.size(); ++I) {
565 const auto *BB = Reinclude[I];
566 FPI.reIncludeBB(*BB);
567 if (I >= IncludeSuccessorsMark)
568 Reinclude.insert_range(successors(BB));
569 }
570
571 // For exclusion, we don't need to exclude the set of BBs that were successors
572 // before and are now unreachable, because we already did that at setup. For
573 // the rest, as long as a successor is unreachable, we want to explicitly
574 // exclude it.
575 const auto AlreadyExcludedMark = Unreachable.size();
576 for (size_t I = 0; I < Unreachable.size(); ++I) {
577 const auto *U = Unreachable[I];
578 if (I >= AlreadyExcludedMark)
579 FPI.updateForBB(*U, -1);
580 for (const auto *Succ : successors(U))
581 if (!DT.isReachableFromEntry(Succ))
582 Unreachable.insert(Succ);
583 }
584
585 const auto &LI = FAM.getResult<LoopAnalysis>(const_cast<Function &>(Caller));
586 FPI.updateAggregateStats(Caller, LI);
587#ifdef EXPENSIVE_CHECKS
588 assert(isUpdateValid(Caller, FPI, FAM));
589#endif
590}
591
592bool FunctionPropertiesUpdater::isUpdateValid(Function &F,
593 const FunctionPropertiesInfo &FPI,
595 if (!FAM.getResult<DominatorTreeAnalysis>(F).verify(
596 DominatorTree::VerificationLevel::Full))
597 return false;
598 DominatorTree DT(F);
599 LoopInfo LI(DT);
600 auto Vocabulary = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
601 .getCachedResult<IR2VecVocabAnalysis>(*F.getParent());
602 auto Fresh =
604 return FPI == Fresh;
605}
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:119
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.
bool doesNotReturn() const
Determine if the call cannot return.
unsigned arg_size() const
Implements a dense probed hash-table based set.
Definition DenseSet.h:289
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)
LLVM_ABI 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:587
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:288
bool isPointerTy() const
True if this is an instance of PointerType.
Definition Type.h:282
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition Type.h:368
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
unsigned getDimension() const
Definition IR2Vec.h:349
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:1668
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:2207
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
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:1946
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