LLVM 20.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
18#include "llvm/IR/CycleInfo.h"
19#include "llvm/IR/PassManager.h"
20#include "llvm/Pass.h"
21
22namespace llvm {
23
24/// Legacy analysis pass which computes a \ref CycleInfo.
26 Function *F = nullptr;
27 CycleInfo CI;
28
29public:
30 static char ID;
31
33
34 CycleInfo &getResult() { return CI; }
35 const CycleInfo &getResult() const { return CI; }
36
37 bool runOnFunction(Function &F) override;
38 void getAnalysisUsage(AnalysisUsage &AU) const override;
39 void releaseMemory() override;
40 void print(raw_ostream &OS, const Module *M = nullptr) const override;
41
42 // TODO: verify analysis?
43};
44
45/// Analysis pass which computes a \ref CycleInfo.
46class CycleAnalysis : public AnalysisInfoMixin<CycleAnalysis> {
48 static AnalysisKey Key;
49
50public:
51 /// Provide the result typedef for this analysis pass.
53
55
56 /// Run the analysis pass over a function and produce a dominator tree.
58
59 // TODO: verify analysis?
60};
61
62class CycleInfoPrinterPass : public PassInfoMixin<CycleInfoPrinterPass> {
63 raw_ostream &OS;
64
65public:
68 static bool isRequired() { return true; }
69};
70
71struct CycleInfoVerifierPass : public PassInfoMixin<CycleInfoVerifierPass> {
73 static bool isRequired() { return true; }
74};
75
76} // end namespace llvm
77
78#endif // LLVM_ANALYSIS_CYCLEANALYSIS_H
This file declares the LLVM IR specialization of the GenericCycle templates.
#define F(x, y, z)
Definition: MD5.cpp:55
This header defines various interfaces for pass management in LLVM.
raw_pwrite_stream & OS
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
Represent the analysis usage information of a pass.
Analysis pass which computes a CycleInfo.
Definition: CycleAnalysis.h:46
CycleInfo run(Function &F, FunctionAnalysisManager &)
Run the analysis pass over a function and produce a dominator tree.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Legacy analysis pass which computes a CycleInfo.
Definition: CycleAnalysis.h:25
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
const CycleInfo & getResult() const
Definition: CycleAnalysis.h:35
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
GenericCycleInfo< SSAContext > CycleInfo
Definition: CycleInfo.h:23
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:92
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:28
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69