Coverage Report

Created: 2018-09-17 19:50

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Analysis/CFLAliasAnalysisUtils.h
Line
Count
Source (jump to first uncovered line)
1
//=- CFLAliasAnalysisUtils.h - Utilities for CFL Alias Analysis ----*- 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
// \file
10
// These are the utilities/helpers used by the CFL Alias Analyses available in
11
// tree, i.e. Steensgaard's and Andersens'.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_ANALYSIS_CFLALIASANALYSISUTILS_H
16
#define LLVM_ANALYSIS_CFLALIASANALYSISUTILS_H
17
18
#include "llvm/IR/Function.h"
19
#include "llvm/IR/ValueHandle.h"
20
21
namespace llvm {
22
namespace cflaa {
23
24
template <typename AAResult> struct FunctionHandle final : public CallbackVH {
25
  FunctionHandle(Function *Fn, AAResult *Result)
26
211
      : CallbackVH(Fn), Result(Result) {
27
211
    assert(Fn != nullptr);
28
211
    assert(Result != nullptr);
29
211
  }
llvm::cflaa::FunctionHandle<llvm::CFLAndersAAResult>::FunctionHandle(llvm::Function*, llvm::CFLAndersAAResult*)
Line
Count
Source
26
95
      : CallbackVH(Fn), Result(Result) {
27
95
    assert(Fn != nullptr);
28
95
    assert(Result != nullptr);
29
95
  }
llvm::cflaa::FunctionHandle<llvm::CFLSteensAAResult>::FunctionHandle(llvm::Function*, llvm::CFLSteensAAResult*)
Line
Count
Source
26
116
      : CallbackVH(Fn), Result(Result) {
27
116
    assert(Fn != nullptr);
28
116
    assert(Result != nullptr);
29
116
  }
30
31
0
  void deleted() override { removeSelfFromCache(); }
Unexecuted instantiation: llvm::cflaa::FunctionHandle<llvm::CFLAndersAAResult>::deleted()
Unexecuted instantiation: llvm::cflaa::FunctionHandle<llvm::CFLSteensAAResult>::deleted()
32
0
  void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
Unexecuted instantiation: llvm::cflaa::FunctionHandle<llvm::CFLAndersAAResult>::allUsesReplacedWith(llvm::Value*)
Unexecuted instantiation: llvm::cflaa::FunctionHandle<llvm::CFLSteensAAResult>::allUsesReplacedWith(llvm::Value*)
33
34
private:
35
  AAResult *Result;
36
37
0
  void removeSelfFromCache() {
38
0
    assert(Result != nullptr);
39
0
    auto *Val = getValPtr();
40
0
    Result->evict(cast<Function>(Val));
41
0
    setValPtr(nullptr);
42
0
  }
Unexecuted instantiation: llvm::cflaa::FunctionHandle<llvm::CFLAndersAAResult>::removeSelfFromCache()
Unexecuted instantiation: llvm::cflaa::FunctionHandle<llvm::CFLSteensAAResult>::removeSelfFromCache()
43
};
44
45
6.27k
static inline const Function *parentFunctionOfValue(const Value *Val) {
46
6.27k
  if (auto *Inst = dyn_cast<Instruction>(Val)) {
47
2.42k
    auto *Bb = Inst->getParent();
48
2.42k
    return Bb->getParent();
49
2.42k
  }
50
3.85k
51
3.85k
  if (auto *Arg = dyn_cast<Argument>(Val))
52
3.78k
    return Arg->getParent();
53
68
  return nullptr;
54
68
} // namespace cflaa
CFLAndersAliasAnalysis.cpp:llvm::cflaa::parentFunctionOfValue(llvm::Value const*)
Line
Count
Source
45
679
static inline const Function *parentFunctionOfValue(const Value *Val) {
46
679
  if (auto *Inst = dyn_cast<Instruction>(Val)) {
47
643
    auto *Bb = Inst->getParent();
48
643
    return Bb->getParent();
49
643
  }
50
36
51
36
  if (auto *Arg = dyn_cast<Argument>(Val))
52
22
    return Arg->getParent();
53
14
  return nullptr;
54
14
} // namespace cflaa
CFLSteensAliasAnalysis.cpp:llvm::cflaa::parentFunctionOfValue(llvm::Value const*)
Line
Count
Source
45
5.59k
static inline const Function *parentFunctionOfValue(const Value *Val) {
46
5.59k
  if (auto *Inst = dyn_cast<Instruction>(Val)) {
47
1.77k
    auto *Bb = Inst->getParent();
48
1.77k
    return Bb->getParent();
49
1.77k
  }
50
3.81k
51
3.81k
  if (auto *Arg = dyn_cast<Argument>(Val))
52
3.76k
    return Arg->getParent();
53
54
  return nullptr;
54
54
} // namespace cflaa
55
} // namespace llvm
56
}
57
58
#endif // LLVM_ANALYSIS_CFLALIASANALYSISUTILS_H