Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/EdgeBundles.h
Line
Count
Source (jump to first uncovered line)
1
//===-------- EdgeBundles.h - Bundles of CFG edges --------------*- c++ -*-===//
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
// The EdgeBundles analysis forms equivalence classes of CFG edges such that all
10
// edges leaving a machine basic block are in the same bundle, and all edges
11
// leaving a basic block are in the same bundle.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CODEGEN_EDGEBUNDLES_H
16
#define LLVM_CODEGEN_EDGEBUNDLES_H
17
18
#include "llvm/ADT/ArrayRef.h"
19
#include "llvm/ADT/IntEqClasses.h"
20
#include "llvm/ADT/Twine.h"
21
#include "llvm/CodeGen/MachineFunctionPass.h"
22
23
namespace llvm {
24
25
class EdgeBundles : public MachineFunctionPass {
26
  const MachineFunction *MF;
27
28
  /// EC - Each edge bundle is an equivalence class. The keys are:
29
  ///   2*BB->getNumber()   -> Ingoing bundle.
30
  ///   2*BB->getNumber()+1 -> Outgoing bundle.
31
  IntEqClasses EC;
32
33
  /// Blocks - Map each bundle to a list of basic block numbers.
34
  SmallVector<SmallVector<unsigned, 8>, 4> Blocks;
35
36
public:
37
  static char ID;
38
45.7k
  EdgeBundles() : MachineFunctionPass(ID) {}
39
40
  /// getBundle - Return the ingoing (Out = false) or outgoing (Out = true)
41
  /// bundle number for basic block #N
42
416M
  unsigned getBundle(unsigned N, bool Out) const { return EC[2 * N + Out]; }
43
44
  /// getNumBundles - Return the total number of bundles in the CFG.
45
22.3M
  unsigned getNumBundles() const { return EC.getNumClasses(); }
46
47
  /// getBlocks - Return an array of blocks that are connected to Bundle.
48
108M
  ArrayRef<unsigned> getBlocks(unsigned Bundle) const { return Blocks[Bundle]; }
49
50
  /// getMachineFunction - Return the last machine function computed.
51
0
  const MachineFunction *getMachineFunction() const { return MF; }
52
53
  /// view - Visualize the annotated bipartite CFG with Graphviz.
54
  void view() const;
55
56
private:
57
  bool runOnMachineFunction(MachineFunction&) override;
58
  void getAnalysisUsage(AnalysisUsage&) const override;
59
};
60
61
} // end namespace llvm
62
63
#endif