Coverage Report

Created: 2019-02-20 00:17

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