LLVM 24.0.0git
MachineCycleAnalysis.h
Go to the documentation of this file.
1//===- MachineCycleAnalysis.h - Cycle Info for Machine 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//
9// This file defines the MachineCycleInfo class, which is a thin wrapper over
10// the Machine IR instance of GenericCycleInfo.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_MACHINECYCLEANALYSIS_H
15#define LLVM_CODEGEN_MACHINECYCLEANALYSIS_H
16
22
23namespace llvm {
24
25class MachineCycleInfo : public GenericCycleInfo<MachineSSAContext> {
26public:
27 /// Handle invalidation explicitly.
29 MachineFunctionAnalysisManager::Invalidator &);
30};
31
32/// Legacy analysis pass which computes a \ref MachineCycleInfo.
34 MachineFunction *F = nullptr;
36
37public:
38 static char ID;
39
41
43 const MachineCycleInfo &getCycleInfo() const { return CI; }
44
45 bool runOnMachineFunction(MachineFunction &F) override;
46 void getAnalysisUsage(AnalysisUsage &AU) const override;
47 void releaseMemory() override;
48 void print(raw_ostream &OS, const Module *M = nullptr) const override;
49};
50
51// TODO: add this function to the GenericCycleInfo template after implementing
52// the IR version.
53LLVM_ABI bool isCycleInvariant(const MachineCycleInfo &CI, CycleRef Cycle,
54 MachineInstr &I);
55
56class MachineCycleAnalysis : public AnalysisInfoMixin<MachineCycleAnalysis> {
58 LLVM_ABI static AnalysisKey Key;
59
60public:
62
65};
66
68 : public RequiredPassInfoMixin<MachineCycleInfoPrinterPass> {
69 raw_ostream &OS;
70
71public:
72 explicit MachineCycleInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
75};
76
77} // end namespace llvm
78
79#endif // LLVM_CODEGEN_MACHINECYCLEANALYSIS_H
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_ABI
Definition Compiler.h:211
Find all cycles in a control-flow graph, including irreducible loops.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
This file declares a specialization of the GenericSSAContext<X> template class for Machine IR.
Represent the analysis usage information of a pass.
LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
const MachineCycleInfo & getCycleInfo() const
LLVM_ABI bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
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.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI bool isCycleInvariant(const MachineCycleInfo &CI, CycleRef Cycle, MachineInstr &I)
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
A CRTP mix-in for passes that should not be skipped.