source: icGREP/icgrep-devel/icgrep/pablo/optimizers/codemotionpass.h @ 5267

Last change on this file since 5267 was 5267, checked in by nmedfort, 2 years ago

Code clean-up. Removed Pablo Call, SetIthBit? and Prototype.

File size: 1.1 KB
Line 
1#ifndef PABLO_CODESINKING_HPP
2#define PABLO_CODESINKING_HPP
3
4#include <vector>
5
6namespace pablo {
7
8class PabloKernel;
9class PabloBlock;
10class Statement;
11class While;
12class Variadic;
13
14class CodeMotionPass {
15    struct ScopeSet : public std::vector<PabloBlock *> {
16        inline bool insert(PabloBlock * block) {
17            const auto i = std::lower_bound(begin(), end(), block);
18            if (i == end() || *i != block) {
19                std::vector<PabloBlock *>::insert(i, block);
20                return true;
21            }
22            return false;
23        }
24        inline bool count(PabloBlock * block) {
25            const auto i = std::lower_bound(begin(), end(), block);
26            return (i != end() && *i == block);
27        }
28    };
29public:
30    static bool optimize(PabloKernel * kernel);
31protected:
32    static void movement(PabloBlock * const block);
33    static bool isAcceptableTarget(Statement *stmt, ScopeSet & scopeSet, const PabloBlock * const block);
34    static void sink(PabloBlock * const block);
35    static void hoistLoopInvariants(While * loop);
36};
37
38}
39
40#endif // PABLO_CODESINKING_HPP
Note: See TracBrowser for help on using the repository browser.