Coverage Report

Created: 2017-06-28 17:40

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/Transform/CodePreparation.cpp
Line
Count
Source (jump to first uncovered line)
1
//===---- CodePreparation.cpp - Code preparation for Scop Detection -------===//
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 Polly code preparation pass is executed before SCoP detection. Its
11
// currently only splits the entry block of the SCoP to make room for alloc
12
// instructions as they are generated during code generation.
13
//
14
// XXX: In the future, we should remove the need for this pass entirely and
15
// instead add this spitting to the code generation pass.
16
//
17
//===----------------------------------------------------------------------===//
18
19
#include "polly/LinkAllPasses.h"
20
#include "polly/ScopDetection.h"
21
#include "polly/Support/ScopHelper.h"
22
#include "llvm/Analysis/DominanceFrontier.h"
23
#include "llvm/Analysis/LoopInfo.h"
24
#include "llvm/Analysis/RegionInfo.h"
25
#include "llvm/Analysis/ScalarEvolution.h"
26
#include "llvm/Transforms/Utils/Local.h"
27
28
using namespace llvm;
29
using namespace polly;
30
31
namespace {
32
33
/// Prepare the IR for the scop detection.
34
///
35
class CodePreparation : public FunctionPass {
36
  CodePreparation(const CodePreparation &) = delete;
37
  const CodePreparation &operator=(const CodePreparation &) = delete;
38
39
  LoopInfo *LI;
40
  ScalarEvolution *SE;
41
42
  void clear();
43
44
public:
45
  static char ID;
46
47
12
  explicit CodePreparation() : FunctionPass(ID) {}
48
  ~CodePreparation();
49
50
  /// @name FunctionPass interface.
51
  //@{
52
  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
53
  virtual void releaseMemory();
54
  virtual bool runOnFunction(Function &F);
55
  virtual void print(raw_ostream &OS, const Module *) const;
56
  //@}
57
};
58
} // namespace
59
60
25
void CodePreparation::clear() {}
61
62
12
CodePreparation::~CodePreparation() { clear(); }
63
64
12
void CodePreparation::getAnalysisUsage(AnalysisUsage &AU) const {
65
12
  AU.addRequired<LoopInfoWrapperPass>();
66
12
  AU.addRequired<ScalarEvolutionWrapperPass>();
67
12
68
12
  AU.addPreserved<LoopInfoWrapperPass>();
69
12
  AU.addPreserved<RegionInfoPass>();
70
12
  AU.addPreserved<DominatorTreeWrapperPass>();
71
12
  AU.addPreserved<DominanceFrontierWrapperPass>();
72
12
}
73
74
13
bool CodePreparation::runOnFunction(Function &F) {
75
13
  if (skipFunction(F))
76
0
    return false;
77
13
78
13
  LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
79
13
  SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
80
13
81
13
  splitEntryBlockForAlloca(&F.getEntryBlock(), this);
82
13
83
13
  return true;
84
13
}
85
86
13
void CodePreparation::releaseMemory() { clear(); }
87
88
12
void CodePreparation::print(raw_ostream &OS, const Module *) const {}
89
90
char CodePreparation::ID = 0;
91
char &polly::CodePreparationID = CodePreparation::ID;
92
93
1
Pass *polly::createCodePreparationPass() { return new CodePreparation(); }
94
95
41.0k
INITIALIZE_PASS_BEGIN41.0k
(CodePreparation, "polly-prepare",41.0k
96
41.0k
                      "Polly - Prepare code for polly", false, false)
97
41.0k
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
98
41.0k
INITIALIZE_PASS_END(CodePreparation, "polly-prepare",
99
                    "Polly - Prepare code for polly", false, false)