Ignore:
Timestamp:
Dec 23, 2015, 4:28:42 PM (3 years ago)
Author:
nmedfort
Message:

Work on lowering + minor bug fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/passes/factorizedfg.h

    r4890 r4899  
    1616class FactorizeDFG {
    1717    using ScopeDepth = boost::container::flat_map<const PabloBlock *, unsigned>;
    18     using VertexSet = std::vector<PabloAST *>;
     18    using ScopeSet = std::vector<PabloBlock *>;
     19    using ASTVector = std::vector<PabloAST *>;
     20    struct OrderingMap {
     21        unsigned of(const PabloAST * const expr) const {
     22            auto f = mMap.find(expr);
     23            if (f == mMap.end()) {
     24                return mParent ? mParent->of(expr) : 0;
     25            }
     26            return f->second;
     27        }
     28        inline void enumerate(const PabloAST * const expr) {
     29            mMap.emplace(expr, ++mOrderingCount);
     30        }
     31        OrderingMap() :  mParent(nullptr), mOrderingCount(0) {}
     32        OrderingMap(OrderingMap * const parent) :  mParent(parent), mOrderingCount(parent->mOrderingCount) {}
     33        ~OrderingMap() { if (mParent) { mParent->mOrderingCount = mOrderingCount; } }
     34    private:
     35        OrderingMap * const mParent;
     36        unsigned mOrderingCount;
     37        boost::container::flat_map<const PabloAST *, unsigned> mMap;
     38    };
     39
    1940public:
    2041    static void transform(PabloFunction & function);
    2142protected:   
    22     void initialize(const PabloFunction & function);
    23     void initialize(const PabloBlock * const block, const unsigned depth);
    24     void CSE(PabloBlock * const block);
    25     void CSE(Variadic * const var);
    26     PabloBlock * chooseInsertionScope(const VertexSet & users);
    27     void findInsertionPoint(const VertexSet & operands, PabloBlock * const scope);
    28     void finalize(PabloBlock * const block);
    29     Statement * finalize(Variadic * const var, PabloBlock * block);
     43    void enumerateScopeDepth(const PabloFunction & function);
     44    void enumerateScopeDepth(const PabloBlock * const block, const unsigned depth);
     45    void cse(PabloBlock * const block);
     46    void cse(Variadic * const var);
     47    PabloBlock * chooseInsertionScope(const ASTVector & users);
     48    void findInsertionPoint(const ASTVector & operands, PabloBlock * const scope);
     49    void lower(PabloFunction & function);
     50//    void lower(PabloBlock * const block, OrderingMap & parent);
     51//    PabloAST * lower(Variadic * const var, PabloBlock * block, OrderingMap & order);
     52    void lower(PabloBlock * const block);
     53    Statement * lower(Variadic * const var, PabloBlock * block);
    3054    FactorizeDFG() = default;
    3155private:
Note: See TracChangeset for help on using the changeset viewer.