1f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===--- BranchProbabilityInfo.h - Branch Probability Analysis --*- C++ -*-===//
2f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
3f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//                     The LLVM Compiler Infrastructure
4f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
5f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file is distributed under the University of Illinois Open Source
6f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// License. See LICENSE.TXT for details.
7f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
8f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
9f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
10f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This pass is used to evaluate branch probabilties.
11f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
12f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
13f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
14f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#ifndef LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H
15f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H
16f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
17f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/DenseMap.h"
18f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/DenseSet.h"
19f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/SmallPtrSet.h"
20f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/IR/CFG.h"
21f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/IR/PassManager.h"
22f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/IR/ValueHandle.h"
23f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/InitializePasses.h"
24f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/Pass.h"
25f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/Support/BranchProbability.h"
26f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
27f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace llvm {
28f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass LoopInfo;
29f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass TargetLibraryInfo;
30f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass raw_ostream;
31f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
32f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief Analysis providing branch probability information.
33f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot///
34f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// This is a function analysis which provides information on the relative
35f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// probabilities of each "edge" in the function's CFG where such an edge is
36f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// defined by a pair (PredBlock and an index in the successors). The
37f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// probability of an edge from one block is always relative to the
38f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// probabilities of other edges from the block. The probabilites of all edges
39f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// from a block sum to exactly one (100%).
40f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// We use a pair (PredBlock and an index in the successors) to uniquely
41f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// identify an edge, since we can have multiple edges from Src to Dst.
42f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// As an example, we can have a switch which jumps to Dst with value 0 and
43f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// value 10.
44f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass BranchProbabilityInfo {
45f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
46f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo() {}
47f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo(const Function &F, const LoopInfo &LI,
48f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                        const TargetLibraryInfo *TLI = nullptr) {
49f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    calculate(F, LI, TLI);
50f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
51f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
52f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo(BranchProbabilityInfo &&Arg)
53f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot      : Probs(std::move(Arg.Probs)), LastF(Arg.LastF),
54f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        PostDominatedByUnreachable(std::move(Arg.PostDominatedByUnreachable)),
55f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        PostDominatedByColdCall(std::move(Arg.PostDominatedByColdCall)) {}
56f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
57f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo &operator=(BranchProbabilityInfo &&RHS) {
58f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    releaseMemory();
59f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    Probs = std::move(RHS.Probs);
60f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    PostDominatedByColdCall = std::move(RHS.PostDominatedByColdCall);
61f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    PostDominatedByUnreachable = std::move(RHS.PostDominatedByUnreachable);
62f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    return *this;
63f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
64f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
65f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void releaseMemory();
66f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
67f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void print(raw_ostream &OS) const;
68f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
69f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Get an edge's probability, relative to other out-edges of the Src.
70f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
71f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// This routine provides access to the fractional probability between zero
72f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// (0%) and one (100%) of this edge executing, relative to other edges
73f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// leaving the 'Src' block. The returned probability is never zero, and can
74f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// only be one if the source block has only one successor.
75f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbability getEdgeProbability(const BasicBlock *Src,
76f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                       unsigned IndexInSuccessors) const;
77f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
78f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Get the probability of going from Src to Dst.
79f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
80f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// It returns the sum of all probabilities for edges from Src to Dst.
81f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbability getEdgeProbability(const BasicBlock *Src,
82f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                       const BasicBlock *Dst) const;
83f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
84f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbability getEdgeProbability(const BasicBlock *Src,
85f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                       succ_const_iterator Dst) const;
86f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
87f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Test if an edge is hot relative to other out-edges of the Src.
88f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
89f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Check whether this edge out of the source block is 'hot'. We define hot
90f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// as having a relative probability >= 80%.
91f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool isEdgeHot(const BasicBlock *Src, const BasicBlock *Dst) const;
92f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
93f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Retrieve the hot successor of a block if one exists.
94f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
95f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Given a basic block, look through its successors and if one exists for
96f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// which \see isEdgeHot would return true, return that successor block.
97f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  const BasicBlock *getHotSucc(const BasicBlock *BB) const;
98f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
99f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Print an edge's probability.
100f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
101f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Retrieves an edge's probability similarly to \see getEdgeProbability, but
102f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// then prints that probability to the provided stream. That stream is then
103f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// returned.
104f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  raw_ostream &printEdgeProbability(raw_ostream &OS, const BasicBlock *Src,
105f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                                    const BasicBlock *Dst) const;
106f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
107f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Set the raw edge probability for the given edge.
108f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  ///
109f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// This allows a pass to explicitly set the edge probability for an edge. It
110f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// can be used when updating the CFG to update and preserve the branch
111f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// probability information. Read the implementation of how these edge
112f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// probabilities are calculated carefully before using!
113f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void setEdgeProbability(const BasicBlock *Src, unsigned IndexInSuccessors,
114f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                          BranchProbability Prob);
115f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
116f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  static BranchProbability getBranchProbStackProtector(bool IsLikely) {
117f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    static const BranchProbability LikelyProb((1u << 20) - 1, 1u << 20);
118f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    return IsLikely ? LikelyProb : LikelyProb.getCompl();
119f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
120f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
121f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void calculate(const Function &F, const LoopInfo &LI,
122f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot                 const TargetLibraryInfo *TLI = nullptr);
123f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
124f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Forget analysis results for the given basic block.
125f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void eraseBlock(const BasicBlock *BB);
126f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
127f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate:
128f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void operator=(const BranchProbabilityInfo &) = delete;
129f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo(const BranchProbabilityInfo &) = delete;
130f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
131f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // We need to store CallbackVH's in order to correctly handle basic block
132f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // removal.
133f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  class BasicBlockCallbackVH final : public CallbackVH {
134f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    BranchProbabilityInfo *BPI;
135f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    void deleted() override {
136f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot      assert(BPI != nullptr);
137f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot      BPI->eraseBlock(cast<BasicBlock>(getValPtr()));
138f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot      BPI->Handles.erase(*this);
139f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    }
140f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
141f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  public:
142f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    BasicBlockCallbackVH(const Value *V, BranchProbabilityInfo *BPI=nullptr)
143f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        : CallbackVH(const_cast<Value *>(V)), BPI(BPI) {}
144f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  };
145f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  DenseSet<BasicBlockCallbackVH, DenseMapInfo<Value*>> Handles;
146f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
147f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // Since we allow duplicate edges from one basic block to another, we use
148f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // a pair (PredBlock and an index in the successors) to specify an edge.
149f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  typedef std::pair<const BasicBlock *, unsigned> Edge;
150f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
151f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // Default weight value. Used when we don't have information about the edge.
152f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // TODO: DEFAULT_WEIGHT makes sense during static predication, when none of
153f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // the successors have a weight yet. But it doesn't make sense when providing
154f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // weight to an edge that may have siblings with non-zero weights. This can
155f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // be handled various ways, but it's probably fine for an edge with unknown
156f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // weight to just "inherit" the non-zero weight of an adjacent successor.
157f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  static const uint32_t DEFAULT_WEIGHT = 16;
158f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
159f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  DenseMap<Edge, BranchProbability> Probs;
160f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
161f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Track the last function we run over for printing.
162f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  const Function *LastF;
163f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
164f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Track the set of blocks directly succeeded by a returning block.
165f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  SmallPtrSet<const BasicBlock *, 16> PostDominatedByUnreachable;
166f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
167f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Track the set of blocks that always lead to a cold call.
168f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  SmallPtrSet<const BasicBlock *, 16> PostDominatedByColdCall;
169f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
170f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void updatePostDominatedByUnreachable(const BasicBlock *BB);
171f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void updatePostDominatedByColdCall(const BasicBlock *BB);
172f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcUnreachableHeuristics(const BasicBlock *BB);
173f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcMetadataWeights(const BasicBlock *BB);
174f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcColdCallHeuristics(const BasicBlock *BB);
175f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcPointerHeuristics(const BasicBlock *BB);
176f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcLoopBranchHeuristics(const BasicBlock *BB, const LoopInfo &LI);
177f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcZeroHeuristics(const BasicBlock *BB, const TargetLibraryInfo *TLI);
178f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcFloatingPointHeuristics(const BasicBlock *BB);
179f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool calcInvokeHeuristics(const BasicBlock *BB);
180f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
181f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
182f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief Analysis pass which computes \c BranchProbabilityInfo.
183f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass BranchProbabilityAnalysis
184f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    : public AnalysisInfoMixin<BranchProbabilityAnalysis> {
185f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  friend AnalysisInfoMixin<BranchProbabilityAnalysis>;
186f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  static AnalysisKey Key;
187f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
188f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
189f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Provide the result typedef for this analysis pass.
190f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  typedef BranchProbabilityInfo Result;
191f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
192f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// \brief Run the analysis pass over a function and produce BPI.
193f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo run(Function &F, FunctionAnalysisManager &AM);
194f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
195f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
196f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief Printer pass for the \c BranchProbabilityAnalysis results.
197f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass BranchProbabilityPrinterPass
198f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    : public PassInfoMixin<BranchProbabilityPrinterPass> {
199f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  raw_ostream &OS;
200f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
201f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
202f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  explicit BranchProbabilityPrinterPass(raw_ostream &OS) : OS(OS) {}
203f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
204f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
205f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
206f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief Legacy analysis pass which computes \c BranchProbabilityInfo.
207f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass BranchProbabilityInfoWrapperPass : public FunctionPass {
208f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo BPI;
209f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
210f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
211f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  static char ID;
212f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
213f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfoWrapperPass() : FunctionPass(ID) {
214f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    initializeBranchProbabilityInfoWrapperPassPass(
215f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot        *PassRegistry::getPassRegistry());
216f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
217f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
218f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  BranchProbabilityInfo &getBPI() { return BPI; }
219f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  const BranchProbabilityInfo &getBPI() const { return BPI; }
220f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
221f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void getAnalysisUsage(AnalysisUsage &AU) const override;
222f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  bool runOnFunction(Function &F) override;
223f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void releaseMemory() override;
224f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  void print(raw_ostream &OS, const Module *M = nullptr) const override;
225f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
226f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
227f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}
228f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
229f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#endif
230