Coverage Report

Created: 2018-09-17 19:50

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Analysis/ScopedNoAliasAA.h
Line
Count
Source (jump to first uncovered line)
1
//===- ScopedNoAliasAA.h - Scoped No-Alias 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
//
10
/// \file
11
/// This is the interface for a metadata-based scoped no-alias analysis.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_ANALYSIS_SCOPEDNOALIASAA_H
16
#define LLVM_ANALYSIS_SCOPEDNOALIASAA_H
17
18
#include "llvm/Analysis/AliasAnalysis.h"
19
#include "llvm/IR/CallSite.h"
20
#include "llvm/IR/PassManager.h"
21
#include "llvm/Pass.h"
22
#include <memory>
23
24
namespace llvm {
25
26
class Function;
27
class MDNode;
28
class MemoryLocation;
29
30
/// A simple AA result which uses scoped-noalias metadata to answer queries.
31
class ScopedNoAliasAAResult : public AAResultBase<ScopedNoAliasAAResult> {
32
  friend AAResultBase<ScopedNoAliasAAResult>;
33
34
public:
35
  /// Handle invalidation events from the new pass manager.
36
  ///
37
  /// By definition, this result is stateless and so remains valid.
38
  bool invalidate(Function &, const PreservedAnalyses &,
39
246
                  FunctionAnalysisManager::Invalidator &) {
40
246
    return false;
41
246
  }
42
43
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB);
44
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc);
45
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2);
46
47
private:
48
  bool mayAliasInScopes(const MDNode *Scopes, const MDNode *NoAlias) const;
49
};
50
51
/// Analysis pass providing a never-invalidated alias analysis result.
52
class ScopedNoAliasAA : public AnalysisInfoMixin<ScopedNoAliasAA> {
53
  friend AnalysisInfoMixin<ScopedNoAliasAA>;
54
55
  static AnalysisKey Key;
56
57
public:
58
  using Result = ScopedNoAliasAAResult;
59
60
  ScopedNoAliasAAResult run(Function &F, FunctionAnalysisManager &AM);
61
};
62
63
/// Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
64
class ScopedNoAliasAAWrapperPass : public ImmutablePass {
65
  std::unique_ptr<ScopedNoAliasAAResult> Result;
66
67
public:
68
  static char ID;
69
70
  ScopedNoAliasAAWrapperPass();
71
72
10.0M
  ScopedNoAliasAAResult &getResult() { return *Result; }
73
0
  const ScopedNoAliasAAResult &getResult() const { return *Result; }
74
75
  bool doInitialization(Module &M) override;
76
  bool doFinalization(Module &M) override;
77
  void getAnalysisUsage(AnalysisUsage &AU) const override;
78
};
79
80
//===--------------------------------------------------------------------===//
81
//
82
// createScopedNoAliasAAWrapperPass - This pass implements metadata-based
83
// scoped noalias analysis.
84
//
85
ImmutablePass *createScopedNoAliasAAWrapperPass();
86
87
} // end namespace llvm
88
89
#endif // LLVM_ANALYSIS_SCOPEDNOALIASAA_H