Go to the documentation of this file.
33 #include "llvm/IR/PassManager.h"
34 #include "llvm/IR/Module.h"
35 #include "llvm/IR/Instruction.h"
36 #include "llvm/Passes/PassBuilder.h"
37 #include "llvm/Passes/PassPlugin.h"
38 #include "llvm/ADT/SmallVector.h"
39 #include "llvm/ADT/iterator_range.h"
60 virtual StringRef name()
const = 0;
73 virtual bool run(
CGRADFG &G, Loop &L, FunctionAnalysisManager &FAM,
74 LoopAnalysisManager &LAM,
75 LoopStandardAnalysisResults &AR) = 0;
84 template <
typename PassT>
94 bool run(
CGRADFG &G, Loop &L, FunctionAnalysisManager &FAM,
95 LoopAnalysisManager &LAM,
96 LoopStandardAnalysisResults &AR)
override {
97 return Pass.run(G, L, FAM, LAM, AR);
101 StringRef
name()
const override {
return PassT::name(); }
118 template <
typename PassT>
120 pipeline.emplace_back(
new DFGPassModel(std::move(Pass)));
134 bool run(
CGRADFG &G, Loop &L, FunctionAnalysisManager &FAM,
135 LoopAnalysisManager &LAM,
136 LoopStandardAnalysisResults &AR);
153 void registerPipelineParsingCallback(
const CallBackT &C);
161 Error parsePassPipeline(
DFGPassManager &DPM, ArrayRef<std::string> PipelineText);
170 Error search_callback();
201 DPB(P.DPB), DPM(P.DPM) {
206 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
209 graph_list.emplace_back(G);
215 for (it = graph_begin(); it != graph_end(); it++) {
220 if (it != graph_end()) {
221 return graph_list.erase(it);
227 return graph_list.begin();
231 return graph_list.end();
235 iterator_range<graph_iterator>
graphs() {
236 return make_range(graph_begin(), graph_end());
246 template<
typename VerifyPassT>
247 void createDataFlowGraphsForAllKernels(Function &F, FunctionAnalysisManager &AM);
258 template<
typename VerifyPassT>
259 void createDataFlowGraph(Function &F, Loop &L, FunctionAnalysisManager &FAM,
260 LoopAnalysisManager &LAM,
261 LoopStandardAnalysisResults &AR);
271 return isa<LoadInst>(I) || isa<StoreInst>(I);
281 if (
auto load = dyn_cast<LoadInst>(&I)) {
283 }
else if (
auto store = dyn_cast<StoreInst>(&I)) {
286 assert(
false &&
"Non-memory access instruction");
A template wrapper used to implement the polymorphic API.
Definition: DFGPass.hpp:85
DFGPassBuilder * DPB
Definition: DFGPass.hpp:341
graph_iterator graph_end()
Definition: DFGPass.hpp:230
Definition: OptionPlugin.cpp:128
iterator_range< graph_iterator > graphs()
Definition: DFGPass.hpp:235
DFGNode * make_const_node(Value *V, SmallVector< Value * > *seq)
create constant node with different data source
Definition: DFGPass.hpp:316
SmallVector< CGRADFG * > GraphList
Definition: DFGPass.hpp:190
StringRef name() const override
Wrapper to get the name.
Definition: DFGPass.hpp:101
DFGNode * make_global_node(Value *V, SmallVector< Value * > *seq)
create global data node with different data source
Definition: DFGPass.hpp:337
DFGNode * make_mem_node(Instruction &I)
create memory access node
Definition: DFGPass.hpp:280
DFGNode * make_global_node(Value *V)
create global data node
Definition: DFGPass.hpp:326
GraphList::iterator graph_iterator
Definition: DFGPass.hpp:191
DFGPassModel(DFGPassModel &&Arg)
move constructor
Definition: DFGPass.hpp:91
DFGPassModel(PassT Pass)
default constructor
Definition: DFGPass.hpp:87
Definition: CGRADataFlowGraph.hpp:357
DFGPassManager * DPM
Definition: DFGPass.hpp:342
bool run(CGRADFG &G, Loop &L, FunctionAnalysisManager &FAM, LoopAnalysisManager &LAM, LoopStandardAnalysisResults &AR) override
Wrapper to run the implemented optimization function.
Definition: DFGPass.hpp:94
SmallVector< CGRADFG * > graph_list
Definition: DFGPass.hpp:343
PassT Pass
Definition: DFGPass.hpp:104
DFGPassHandler(DFGPassHandler &&P)
Move constractor.
Definition: DFGPass.hpp:200
The abstract class of the DFG pass manager interfaces.
Definition: DFGPass.hpp:53
graph_iterator removeGraph(CGRADFG *G)
Definition: DFGPass.hpp:212
Definition: AGVerifyPass.hpp:50
void addPass(PassT Pass)
Adding a pass to the DFG pass manager.
Definition: DFGPass.hpp:119
Definition: CGRADataFlowGraph.hpp:325
DFGNode * make_const_node(Value *V)
create constant node
Definition: DFGPass.hpp:305
DFGNode * make_comp_node(Instruction *inst, std::string opcode)
create computational node
Definition: DFGPass.hpp:295
~DFGPassHandler()
Definition: DFGPass.hpp:195
A graph class for CGRA kernel DFG derived from llvm::DirectedGraph.
Definition: CGRADataFlowGraph.hpp:505
graph_iterator graph_begin()
Definition: DFGPass.hpp:226
Module Pass to create data flow graph for all kernels while aplying DFG Optimization Passes.
Definition: DFGPass.hpp:188
SmallVector< CallBackT > callback_list
Definition: DFGPass.hpp:164
SmallVector< DFGPassConcept * > pipeline
Definition: DFGPass.hpp:138
A concrete class for computational nodes.
Definition: CGRADataFlowGraph.hpp:171
DFGPassModel(const DFGPassModel &Arg)
copy constructor
Definition: DFGPass.hpp:89
void addGraph(CGRADFG *G)
Definition: DFGPass.hpp:208
bool isMemAccess(Instruction &I)
check if the instruction is memory access or not
Definition: DFGPass.hpp:270
An abstract class for DFG node derived from DGNode.
Definition: CGRADataFlowGraph.hpp:69
Definition: CGRADataFlowGraph.hpp:192
const char * PluginName
A meaningful name of the plugin.
Definition: DFGPass.hpp:179
std::function< bool(StringRef, DFGPassManager &)> CallBackT
Definition: DFGPass.hpp:147
A class to access the DFG Passes.
Definition: DFGPass.hpp:145
A bundled information about the DFG Pass.
Definition: DFGPass.hpp:177
Manages a sequence of passes over a DFG.
Definition: DFGPass.hpp:111