LLVM 22.0.0git
DominanceFrontier.cpp
Go to the documentation of this file.
1//===- DominanceFrontier.cpp - Dominance Frontier Calculation -------------===//
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
11#include "llvm/Config/llvm-config.h"
12#include "llvm/IR/Dominators.h"
13#include "llvm/IR/Function.h"
14#include "llvm/IR/PassManager.h"
16#include "llvm/Pass.h"
19
20using namespace llvm;
21
22namespace llvm {
23
27
28} // end namespace llvm
29
31
33 "Dominance Frontier Construction", true, true)
36 "Dominance Frontier Construction", true, true)
37
40
42 DF.releaseMemory();
43}
44
47 DF.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
48 return false;
49}
50
55
57 DF.print(OS);
58}
59
60#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
64#endif
65
66/// Handle invalidation explicitly.
68 FunctionAnalysisManager::Invalidator &) {
69 // Check whether the analysis, all analyses on functions, or the function's
70 // CFG have been preserved.
72 return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
73 PAC.preservedSet<CFGAnalyses>());
74}
75
76AnalysisKey DominanceFrontierAnalysis::Key;
77
84
87
90 OS << "DominanceFrontier for function: " << F.getName() << "\n";
92
94}
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:638
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:55
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition PassSupport.h:42
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition PassSupport.h:44
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition PassSupport.h:39
This templated class represents "all analyses that operate over <aparticular IR unit>" (e....
Definition Analysis.h:50
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
Represents analyses that only rely on functions' control flow.
Definition Analysis.h:73
Analysis pass which computes a DominanceFrontier.
DominanceFrontier run(Function &F, FunctionAnalysisManager &AM)
Run the analysis pass over a function and produce a dominator tree.
DominanceFrontierBase - Common base class for computing forward and inverse dominance frontiers for a...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
bool runOnFunction(Function &) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
void print(raw_ostream &OS, const Module *=nullptr) const override
print - Print out the internal state 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...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
Analysis pass which computes a DominatorTree.
Definition Dominators.h:284
Legacy analysis pass which computes a DominatorTree.
Definition Dominators.h:322
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
DominanceFrontier Class - Concrete subclass of DominanceFrontierBase that is used to compute a forwar...
FunctionPass(char &pid)
Definition Pass.h:316
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Definition Analysis.h:275
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.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:207
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29