LLVM 24.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/// Enable verification of cycle info.
25///
26/// The flag enables checks which are expensive and are disabled by default
27/// unless the `EXPENSIVE_CHECKS` macro is defined. The `-verify-cycle-info`
28/// flag allows the checks to be enabled selectively without re-compilation.
29LLVM_ABI extern bool VerifyCycleInfo;
30
31/// Legacy analysis pass which computes a \ref CycleInfo.
33 Function *F = nullptr;
34 CycleInfo CI;
35
36public:
37 static char ID;
38
40
41 CycleInfo &getResult() { return CI; }
42 const CycleInfo &getResult() const { return CI; }
43
44 bool runOnFunction(Function &F) override;
45 void getAnalysisUsage(AnalysisUsage &AU) const override;
46 void releaseMemory() override;
47 void print(raw_ostream &OS, const Module *M = nullptr) const override;
48 void verifyAnalysis() const override;
49};
50
51/// Analysis pass which computes a \ref CycleInfo.
52class CycleAnalysis : public AnalysisInfoMixin<CycleAnalysis> {
54 LLVM_ABI static AnalysisKey Key;
55
56public:
57 /// Provide the result typedef for this analysis pass.
59
61
62 /// Run the analysis pass over a function and produce a dominator tree.
64
65 // TODO: verify analysis?
66};
67
69 : public RequiredPassInfoMixin<CycleInfoPrinterPass> {
70 raw_ostream &OS;
71
72public:
75};
76
81
82} // end namespace llvm
83
84#endif // LLVM_ANALYSIS_CYCLEANALYSIS_H
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_ABI
Definition Compiler.h:211
This file declares the LLVM IR specialization of the GenericCycle templates.
static bool runOnFunction(Function &F, bool PostInlining)
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:54
Represent the analysis usage information of a pass.
Analysis pass which computes a CycleInfo.
CycleInfo Result
Provide the result typedef for this analysis pass.
CycleInfoWrapperPass LegacyWrapper
LLVM_ABI CycleInfo run(Function &F, FunctionAnalysisManager &)
Run the analysis pass over a function and produce a dominator tree.
LLVM_ABI CycleInfoPrinterPass(raw_ostream &OS)
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Legacy analysis pass which computes a CycleInfo.
const CycleInfo & getResult() const
FunctionPass(char &pid)
Definition Pass.h:314
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool VerifyCycleInfo
Enable verification of cycle info.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A CRTP mix-in for passes that should not be skipped.