Coverage Report

Created: 2018-07-19 03:59

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