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

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

Temporary check in

File size: 1.1 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    bool redistributeAST(PabloBlock & block, Graph & G) const;
26private:
27    boost::container::flat_map<PabloBlock *, Statement *> mResolvedScopes;
28};
29
30}
31
32#endif // BOOLEANREASSOCIATIONPASS_H
Note: See TracBrowser for help on using the repository browser.