LLVM  15.0.0git
CycleAnalysis.h
Go to the documentation of this file.
1 //===- CycleAnalysis.h - Cycle Info for LLVM IR -----------------*- 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 ///
10 /// This file declares an analysis pass that computes CycleInfo for
11 /// LLVM IR, specialized from GenericCycleInfo.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_ANALYSIS_CYCLEANALYSIS_H
16 #define LLVM_ANALYSIS_CYCLEANALYSIS_H
17 
19 #include "llvm/IR/PassManager.h"
20 #include "llvm/IR/SSAContext.h"
21 #include "llvm/Pass.h"
22 
23 namespace llvm {
24 extern template class GenericCycleInfo<SSAContext>;
25 extern template class GenericCycle<SSAContext>;
26 
29 
30 /// Analysis pass which computes a \ref CycleInfo.
33  static AnalysisKey Key;
34 
35 public:
36  /// Provide the result typedef for this analysis pass.
37  using Result = CycleInfo;
38 
39  /// Run the analysis pass over a function and produce a dominator tree.
41 
42  // TODO: verify analysis?
43 };
44 
45 /// Printer pass for the \c DominatorTree.
47  raw_ostream &OS;
48 
49 public:
50  explicit CycleInfoPrinterPass(raw_ostream &OS);
51 
53 };
54 
55 /// Legacy analysis pass which computes a \ref CycleInfo.
57  Function *F = nullptr;
58  CycleInfo CI;
59 
60 public:
61  static char ID;
62 
64 
65  CycleInfo &getCycleInfo() { return CI; }
66  const CycleInfo &getCycleInfo() const { return CI; }
67 
68  bool runOnFunction(Function &F) override;
69  void getAnalysisUsage(AnalysisUsage &AU) const override;
70  void releaseMemory() override;
71  void print(raw_ostream &OS, const Module *M = nullptr) const override;
72 
73  // TODO: verify analysis?
74 };
75 
76 } // end namespace llvm
77 
78 #endif // LLVM_ANALYSIS_CYCLEANALYSIS_H
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm::CycleInfoPrinterPass
Printer pass for the DominatorTree.
Definition: CycleAnalysis.h:46
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::CycleInfoWrapperPass::getCycleInfo
const CycleInfo & getCycleInfo() const
Definition: CycleAnalysis.h:66
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:189
llvm::PassInfoMixin< CycleInfoPrinterPass >
llvm::Function
Definition: Function.h:60
Pass.h
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::CycleAnalysis
Analysis pass which computes a CycleInfo.
Definition: CycleAnalysis.h:31
llvm::GenericCycleInfo< SSAContext >::CycleT
GenericCycle< SSAContext > CycleT
Definition: GenericCycleInfo.h:227
llvm::CycleInfo
GenericCycleInfo< SSAContext > CycleInfo
Definition: CycleAnalysis.h:27
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:486
llvm::GenericCycle
A possibly irreducible generalization of a Loop.
Definition: GenericCycleInfo.h:48
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::CycleInfoWrapperPass::ID
static char ID
Definition: CycleAnalysis.h:61
llvm::dxil::PointerTypeAnalysis::run
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
Definition: PointerTypeAnalysis.cpp:101
GenericCycleInfo.h
Find all cycles in a control-flow graph, including irreducible loops.
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:69
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::AnalysisInfoMixin< CycleAnalysis >
llvm::GenericCycleInfo< SSAContext >
llvm::CycleInfoWrapperPass::getCycleInfo
CycleInfo & getCycleInfo()
Definition: CycleAnalysis.h:65
runOnFunction
static bool runOnFunction(Function &F, bool PostInlining)
Definition: EntryExitInstrumenter.cpp:69
PassManager.h
SSAContext.h
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
llvm::CycleInfoWrapperPass
Legacy analysis pass which computes a CycleInfo.
Definition: CycleAnalysis.h:56