source: icGREP/icgrep-devel/icgrep/pablo/optimizers/booleanreassociationpass.h @ 4763

Last change on this file since 4763 was 4763, checked in by nmedfort, 4 years ago

Temporary check in

File size: 1.2 KB
Line 
1#ifndef BOOLEANREASSOCIATIONPASS_H
2#define BOOLEANREASSOCIATIONPASS_H
3
4#include <pablo/codegenstate.h>
5#include <boost/container/flat_map.hpp>
6#include <boost/graph/adjacency_list.hpp>
7
8namespace pablo {
9
10class BooleanReassociationPass {
11public:
12    using Graph = boost::adjacency_list<boost::hash_setS, boost::vecS, boost::bidirectionalS, PabloAST *>;
13    using Vertex = Graph::vertex_descriptor;
14    using Map = std::unordered_map<PabloAST *, Vertex>;
15
16    static bool optimize(PabloFunction & function);
17protected:
18    inline BooleanReassociationPass() {}
19    void resolveScopes(PabloFunction & function);
20    void resolveScopes(PabloBlock &block);
21    void processScopes(PabloFunction & function);
22    void processScopes(PabloBlock & block, std::vector<Statement *> && terminals);
23    void processScope(PabloBlock & block, std::vector<Statement *> && terminals);
24    void summarizeAST(PabloBlock & block, Graph & G) const;
25    void annotateUseDefs(const Vertex u, PabloAST * expr, PabloBlock & block, Graph & G, Map & M) const;
26    bool redistributeAST(PabloBlock & block, Graph & G) const;
27private:
28    boost::container::flat_map<PabloBlock *, Statement *> mResolvedScopes;
29};
30
31}
32
33#endif // BOOLEANREASSOCIATIONPASS_H
Note: See TracBrowser for help on using the repository browser.