LLVM
22.0.0git
include
llvm
CodeGen
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
17
#include "
llvm/ADT/GenericCycleInfo.h
"
18
#include "
llvm/CodeGen/MachineFunctionPass.h
"
19
#include "
llvm/CodeGen/MachinePassManager.h
"
20
#include "
llvm/CodeGen/MachineSSAContext.h
"
21
#include "
llvm/Support/Compiler.h
"
22
23
namespace
llvm
{
24
25
using
MachineCycleInfo
=
GenericCycleInfo<MachineSSAContext>
;
26
using
MachineCycle
=
MachineCycleInfo::CycleT
;
27
28
/// Legacy analysis pass which computes a \ref MachineCycleInfo.
29
class
LLVM_ABI
MachineCycleInfoWrapperPass
:
public
MachineFunctionPass
{
30
MachineFunction
*
F
=
nullptr
;
31
MachineCycleInfo
CI;
32
33
public
:
34
static
char
ID
;
35
36
MachineCycleInfoWrapperPass
();
37
38
MachineCycleInfo
&
getCycleInfo
() {
return
CI; }
39
const
MachineCycleInfo
&
getCycleInfo
()
const
{
return
CI; }
40
41
bool
runOnMachineFunction(
MachineFunction
&
F
)
override
;
42
void
getAnalysisUsage(
AnalysisUsage
&AU)
const override
;
43
void
releaseMemory()
override
;
44
void
print
(
raw_ostream
&
OS
,
const
Module
*M =
nullptr
)
const override
;
45
};
46
47
// TODO: add this function to GenericCycle template after implementing IR
48
// version.
49
LLVM_ABI
bool
isCycleInvariant
(
const
MachineCycle
*
Cycle
, MachineInstr &
I
);
50
51
class
MachineCycleAnalysis
:
public
AnalysisInfoMixin
<MachineCycleAnalysis> {
52
friend
AnalysisInfoMixin<MachineCycleAnalysis>
;
53
LLVM_ABI
static
AnalysisKey
Key;
54
55
public
:
56
using
Result
=
MachineCycleInfo
;
57
58
LLVM_ABI
Result
run
(
MachineFunction
&MF,
59
MachineFunctionAnalysisManager
&MFAM);
60
};
61
62
class
MachineCycleInfoPrinterPass
63
:
public
PassInfoMixin
<MachineCycleInfoPrinterPass> {
64
raw_ostream
&OS;
65
66
public
:
67
explicit
MachineCycleInfoPrinterPass
(
raw_ostream
&OS) :
OS
(
OS
) {}
68
LLVM_ABI
PreservedAnalyses
run
(
MachineFunction
&MF,
69
MachineFunctionAnalysisManager
&MFAM);
70
static
bool
isRequired
() {
return
true
; }
71
};
72
73
}
// end namespace llvm
74
75
#endif
// LLVM_CODEGEN_MACHINECYCLEANALYSIS_H
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition:
ArchiveWriter.cpp:205
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition:
Compiler.h:213
GenericCycleInfo.h
Find all cycles in a control-flow graph, including irreducible loops.
F
#define F(x, y, z)
Definition:
MD5.cpp:55
I
#define I(x, y, z)
Definition:
MD5.cpp:58
MachineFunctionPass.h
MachinePassManager.h
MachineSSAContext.h
This file declares a specialization of the GenericSSAContext<X> template class for Machine IR.
OS
raw_pwrite_stream & OS
Definition:
SampleProfWriter.cpp:51
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition:
PassManager.h:255
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition:
PassAnalysisSupport.h:48
llvm::GenericCycleInfo< MachineSSAContext >
llvm::GenericCycleInfo< MachineSSAContext >::CycleT
GenericCycle< MachineSSAContext > CycleT
Definition:
GenericCycleInfo.h:261
llvm::MachineCycleAnalysis
Definition:
MachineCycleAnalysis.h:51
llvm::MachineCycleAnalysis::run
LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Definition:
MachineCycleAnalysis.cpp:60
llvm::MachineCycleInfoPrinterPass
Definition:
MachineCycleAnalysis.h:63
llvm::MachineCycleInfoPrinterPass::run
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Definition:
MachineCycleAnalysis.cpp:105
llvm::MachineCycleInfoPrinterPass::MachineCycleInfoPrinterPass
MachineCycleInfoPrinterPass(raw_ostream &OS)
Definition:
MachineCycleAnalysis.h:67
llvm::MachineCycleInfoPrinterPass::isRequired
static bool isRequired()
Definition:
MachineCycleAnalysis.h:70
llvm::MachineCycleInfoWrapperPass
Legacy analysis pass which computes a MachineCycleInfo.
Definition:
MachineCycleAnalysis.h:29
llvm::MachineCycleInfoWrapperPass::getCycleInfo
const MachineCycleInfo & getCycleInfo() const
Definition:
MachineCycleAnalysis.h:39
llvm::MachineCycleInfoWrapperPass::getCycleInfo
MachineCycleInfo & getCycleInfo()
Definition:
MachineCycleAnalysis.h:38
llvm::MachineCycleInfoWrapperPass::ID
static char ID
Definition:
MachineCycleAnalysis.h:34
llvm::MachineFunctionPass
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Definition:
MachineFunctionPass.h:31
llvm::MachineFunction
Definition:
MachineFunction.h:286
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:
Module.h:67
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition:
Analysis.h:112
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:
raw_ostream.h:53
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::isCycleInvariant
LLVM_ABI bool isCycleInvariant(const MachineCycle *Cycle, MachineInstr &I)
Definition:
MachineCycleAnalysis.cpp:112
llvm::MachineCycle
MachineCycleInfo::CycleT MachineCycle
Definition:
MachineCycleAnalysis.h:26
llvm::Cycle
CycleInfo::CycleT Cycle
Definition:
CycleInfo.h:24
llvm::MachineCycleInfo
GenericCycleInfo< MachineSSAContext > MachineCycleInfo
Definition:
MachineCycleAnalysis.h:25
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition:
PassManager.h:93
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition:
Analysis.h:29
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition:
PassManager.h:70
Generated on Mon Sep 1 2025 23:15:45 for LLVM by
1.9.6