Changeset 4878 for icGREP


Ignore:
Timestamp:
Nov 22, 2015, 3:17:10 PM (4 years ago)
Author:
nmedfort
Message:

More work on n-ary operations.

Location:
icGREP/icgrep-devel/icgrep
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r4876 r4878  
    5555set(Boost_USE_MULTITHREADED OFF)
    5656set(Boost_USE_STATIC_RUNTIME ON)
    57 
    58 if(ENABLE_MULTIPLEXING)
    59   SET(REQ_BOOST_COMPONENTS ${REQ_BOOST_COMPONENTS} system)
    60 endif()
     57SET(REQ_BOOST_COMPONENTS ${REQ_BOOST_COMPONENTS} system)
    6158if(USE_BOOST_MMAP)
    62   SET(REQ_BOOST_COMPONENTS ${REQ_BOOST_COMPONENTS} system iostreams filesystem)
    63 endif()
    64 
    65 if(REQ_BOOST_COMPONENTS)
    66   find_package(Boost COMPONENTS ${REQ_BOOST_COMPONENTS} REQUIRED)
    67 endif()
     59  SET(REQ_BOOST_COMPONENTS ${REQ_BOOST_COMPONENTS} iostreams filesystem)
     60endif()
     61find_package(Boost COMPONENTS ${REQ_BOOST_COMPONENTS} REQUIRED)
    6862
    6963SET(PABLO_SRC pablo/pabloAST.cpp pablo/ps_if.cpp pablo/ps_while.cpp pablo/function.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp)
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r4876 r4878  
    486486pablo/passes/flattenassociativedfg.h
    487487pablo/passes/flattenassociativedfg.cpp
     488pablo/optimizers/distributivepass.h
     489pablo/optimizers/distributivepass.cpp
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r4876 r4878  
    225225}
    226226
    227 
    228227PabloAST * PabloBlock::createAnd(PabloAST * expr1, PabloAST * expr2) {
    229228    assert (expr1 && expr2);
     
    252251}
    253252
     253And * PabloBlock::createAnd(const unsigned operands, PabloAST * value) {
     254    return insertAtInsertionPoint(new And(operands, value, makeName("and_")));
     255}
     256
    254257PabloAST * PabloBlock::createAnd(PabloAST * expr1, PabloAST * expr2, const std::string prefix) {
    255258    assert (expr1 && expr2);
     
    294297    }
    295298    return insertAtInsertionPoint(new Or(expr1, expr2, makeName("or_")));
     299}
     300
     301Or * PabloBlock::createOr(const unsigned operands, PabloAST * value) {
     302    return insertAtInsertionPoint(new Or(operands, value, makeName("or_")));
    296303}
    297304
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4871 r4878  
    105105    PabloAST * createAnd(PabloAST * expr1, PabloAST * expr2);
    106106
     107    And * createAnd(const unsigned operands, PabloAST * value);
     108
    107109    PabloAST * createAnd(PabloAST * expr1, PabloAST * expr2, const std::string prefix);
    108110
     
    112114
    113115    PabloAST * createOr(PabloAST * expr1, PabloAST * expr2);
     116
     117    Or * createOr(const unsigned operands, PabloAST * value);
    114118
    115119    PabloAST * createOr(PabloAST * expr1, PabloAST * expr2, const std::string prefix);
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/booleanreassociationpass.cpp

    r4871 r4878  
    848848    VertexSet sinks;
    849849    for (const Vertex u : make_iterator_range(vertices(H))) {
    850         if (out_degree(u, H) == 0 && in_degree(u, G) != 0) {
     850        if (out_degree(u, H) == 0 && in_degree(u, H) != 0) {
    851851            sinks.push_back(u);
    852852        }
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_simplifier.cpp

    r4876 r4878  
    3636
    3737/** ------------------------------------------------------------------------------------------------------------- *
    38  * @brief isReassociatable
    39  ** ------------------------------------------------------------------------------------------------------------- */
    40 inline bool isReassociatable(const Statement * const stmt) {
     38 * @brief isReassociative
     39 ** ------------------------------------------------------------------------------------------------------------- */
     40inline bool isReassociative(const Statement * const stmt) {
    4141    switch (stmt->getClassTypeId()) {
    4242        case PabloAST::ClassTypeId::And:
     
    5454
    5555    assert (var);
     56
     57    bool negated = false;
     58    if (LLVM_UNLIKELY(isa<Xor>(var))) {
     59        for (unsigned i = 0; i != var->getNumOperands(); ++i) {
     60            if (isa<Not>(var->getOperand(i))) {
     61                // (A ⊕ ¬B) = ¬(A ⊕ B)
     62                var->setOperand(i, cast<Not>(var->getOperand(i))->getOperand(0));
     63                negated = !negated;
     64            }
     65        }
     66    }
    5667
    5768    // Ensure all operands of a reassociatiable function are consistently ordered.
     
    7384    }
    7485
    75     // Apply the complementation law whenever possible.
    76     bool negated = false;
    77     for (unsigned i = 0; i < var->getNumOperands(); ++i) {
    78         if (isa<Not>(var->getOperand(i))) {
    79             PabloAST * const negatedOp = cast<Not>(var->getOperand(i))->getOperand(0);
    80             bool complementation = false;
    81             for (unsigned j = 0; j != var->getNumOperands(); ++j) {
    82                 if (LLVM_UNLIKELY(var->getOperand(j) == negatedOp)) {
    83                     if (isa<And>(var)) { // (A ∧ ¬A) ∧ B = 0 for any B
    84                         return PabloBlock::createZeroes();
    85                     } else if (isa<Or>(var)) { // (A √ ¬A) √ B = 1 for any B
    86                         return PabloBlock::createOnes();
    87                     }
    88                     var->removeOperand(i); // (A ⊕ ¬A) ⊕ B = 1 ⊕ B = ¬B for any B
    89                     var->removeOperand(j);
    90                     negated = !negated;
    91                     complementation = true;
    92                     break;
    93                 }
    94             }
    95             if (complementation) {
    96                 continue;
    97             }
    98         }
    99         ++i;
     86    if (LLVM_LIKELY(!isa<Xor>(var))) {
     87        // Apply the complementation law whenever possible.
     88        for (unsigned i = 0; i < var->getNumOperands(); ++i) {
     89            if (isa<Not>(var->getOperand(i))) {
     90                const PabloAST * const negatedOp = cast<Not>(var->getOperand(i))->getOperand(0);
     91                for (unsigned j = 0; j != var->getNumOperands(); ++j) {
     92                    if (LLVM_UNLIKELY(var->getOperand(j) == negatedOp)) {
     93                        if (isa<And>(var)) { // (A ∧ ¬A) ∧ B = 0 for any B
     94                            return PabloBlock::createZeroes();
     95                        } else if (isa<Or>(var)) { // (A √ ¬A) √ B = 1 for any B
     96                            return PabloBlock::createOnes();
     97                        }
     98                    }
     99                }
     100            }
     101        }
    100102    }
    101103
     
    392394        } else {
    393395            PabloAST * folded = nullptr;
    394             if (isReassociatable(stmt)) {
     396            if (isReassociative(stmt)) {
    395397                folded =  foldReassociativeFunction(cast<Variadic>(stmt), block);
    396398            } else {
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_simplifier.hpp

    r4876 r4878  
    1010
    1111class Simplifier {
    12     friend class FlattenAssociativeDFG;
    1312public:
    1413    static bool optimize(PabloFunction & function);
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r4876 r4878  
    193193        PabloBlock * body = isa<If>(this) ? cast<If>(this)->getBody() : cast<While>(this)->getBody();
    194194        body->setParent(mParent);
    195         mParent->addUser(body);
    196195    }
    197196}
     
    222221        PabloBlock * body = isa<If>(this) ? cast<If>(this)->getBody() : cast<While>(this)->getBody();
    223222        body->setParent(mParent);
    224         mParent->addUser(body);
    225223    }
    226224}
     
    250248            PabloBlock * body = isa<If>(this) ? cast<If>(this)->getBody() : cast<While>(this)->getBody();
    251249            body->setParent(nullptr);
    252             mParent->removeUser(body);
    253250        }
    254251    }
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.h

    r4876 r4878  
    101101    }
    102102
     103    inline unsigned getNumUsers() const {
     104        return mUsers.size();
     105    }
     106
    103107    inline Users & users() {
    104108        return mUsers;
     
    223227    , mOperand(reinterpret_cast<PabloAST**>(mAllocator.allocate(mOperands * sizeof(PabloAST *)))) {
    224228        unsigned i = 0;
    225         for (PabloAST * const op : operands) {
    226             mOperand[i++] = op;
    227             if (LLVM_LIKELY(op != nullptr)) {
    228                 op->addUser(this);
    229             }
     229        for (PabloAST * const value : operands) {
     230            assert (value);
     231            mOperand[i] = value;
     232            value->addUser(this);
     233            ++i;
    230234        }
    231235    } 
     236    Statement(const ClassTypeId id, unsigned operands, PabloAST * value, const String * const name)
     237    : PabloAST(id)
     238    , mName(name)
     239    , mNext(nullptr)
     240    , mPrev(nullptr)
     241    , mParent(nullptr)
     242    , mOperands(operands)
     243    , mOperand(reinterpret_cast<PabloAST**>(mAllocator.allocate(mOperands * sizeof(PabloAST *)))) {
     244        for (unsigned i = 0; i != operands; ++i) {
     245            assert (value);
     246            mOperand[i] = value;
     247            value->addUser(this);
     248        }
     249    }
    232250private:
    233251    template <class ValueType, class ValueList>
     
    269287        inline void increment() { ++mCurrent; }
    270288        inline void decrement() { --mCurrent; }
    271         inline void advance(const unsigned n) { mCurrent += n; }
     289        inline void advance(const std::ptrdiff_t n) { mCurrent += n; }
    272290        inline std::ptrdiff_t distance_to(const iterator & other) const { return other.mCurrent - mCurrent; }
    273291        inline PabloAST *& dereference() const { return *mCurrent; }
     
    284302
    285303    PabloAST * removeOperand(const unsigned index);
    286 
    287     inline iterator erase(iterator itr) {
    288         removeOperand(itr.distance_to(begin()));
    289         return itr;
    290     }
    291304
    292305    iterator begin() {
     
    310323    : Statement(id, operands, name)
    311324    , mCapacity(operands.size()) {
     325
     326    }
     327    Variadic(const ClassTypeId id, const unsigned operands, PabloAST * value, String * name)
     328    : Statement(id, operands, value, name)
     329    , mCapacity(operands) {
    312330
    313331    }
     
    570588 ** ------------------------------------------------------------------------------------------------------------- */
    571589inline void PabloAST::addUser(PabloAST *user) {
    572     assert (user);
     590    assert (user);   
    573591    // Note: for the rare situation that this node is used multiple times by a statement, duplicates are allowed.
    574592    mUsers.insert(std::lower_bound(mUsers.begin(), mUsers.end(), user), user);
  • icGREP/icgrep-devel/icgrep/pablo/passes/flattenassociativedfg.cpp

    r4876 r4878  
    33#include <pablo/codegenstate.h>
    44#include <pablo/optimizers/pablo_simplifier.hpp>
     5#include <boost/container/flat_map.hpp>
     6#include <boost/graph/adjacency_list.hpp>
    57#include <pablo/analysis/pabloverifier.hpp>
    68
     9#include <boost/graph/strong_components.hpp>
     10#include <pablo/printer_pablos.h>
     11#include <iostream>
     12
     13using namespace boost;
     14using namespace boost::container;
     15
    716namespace pablo {
     17
     18using TypeId = PabloAST::ClassTypeId;
     19using Graph = adjacency_list<hash_setS, vecS, bidirectionalS, PabloAST *>;
     20using Map = flat_map<PabloAST *, Graph::vertex_descriptor>;
    821
    922/** ------------------------------------------------------------------------------------------------------------- *
    1023 * @brief flatten
    1124 ** ------------------------------------------------------------------------------------------------------------- */
    12 inline bool FlattenAssociativeDFG::flatten(Variadic * const var, PabloBlock * const block) {
    13     bool modified = false;
    14     for (;;) {
    15         bool unmodified = true;
    16         for (unsigned i = 0; i < var->getNumOperands(); ) {
    17             PabloAST * const op = var->getOperand(i);
    18             if ((op->getNumUses() == 1) && (op->getClassTypeId() == var->getClassTypeId()) && (cast<Variadic>(op)->getParent() == block)) {
    19                 var->removeOperand(i);
    20                 for (unsigned j = 0; j != cast<Variadic>(op)->getNumOperands(); ++j) {
    21                     var->addOperand(cast<Variadic>(op)->getOperand(j));
    22                 }
    23                 assert (op->getNumUses() == 0);
    24                 cast<Variadic>(op)->eraseFromParent(true);
    25                 unmodified = false;
    26                 modified = true;
    27                 continue;
     25inline void FlattenAssociativeDFG::flatten(Variadic * const var) {
     26    const TypeId typeId = var->getClassTypeId();
     27    for (unsigned i = 0; i < var->getNumOperands(); ) {
     28        PabloAST * const op = var->getOperand(i);
     29        if (op->getClassTypeId() == typeId) {
     30            var->removeOperand(i);
     31            for (unsigned j = 0; j != cast<Variadic>(op)->getNumOperands(); ++j) {
     32                var->addOperand(cast<Variadic>(op)->getOperand(j));
    2833            }
    29             ++i;
     34            continue;
    3035        }
    31         if (unmodified) {
    32             break;
     36        ++i;
     37    }
     38}
     39
     40/** ------------------------------------------------------------------------------------------------------------- *
     41 * @brief applyNegationInwards
     42 *
     43 * Apply the De Morgans' law to any negated And or Or statement with the intent of further flattening its operands
     44 * and creating a bigger clause for the Simplifier to analyze.
     45 ** ------------------------------------------------------------------------------------------------------------- */
     46inline void FlattenAssociativeDFG::applyNegationInwards(Not * const var, PabloBlock * const block) {
     47    PabloAST * negatedVar = var->getOperand(0);
     48    if (isa<And>(negatedVar) || isa<Or>(negatedVar)) {
     49        Variadic * src = cast<Variadic>(negatedVar);
     50        const unsigned operands = src->getNumOperands();
     51        Variadic * replacement = nullptr;
     52        block->setInsertPoint(var->getPrevNode());
     53        if (isa<And>(negatedVar)) {
     54            replacement = block->createOr(operands, PabloBlock::createZeroes());
     55        } else {
     56            replacement = block->createAnd(operands, PabloBlock::createOnes());
    3357        }
     58        block->setInsertPoint(replacement->getPrevNode());
     59        for (unsigned i = 0; i != operands; ++i) {
     60            replacement->setOperand(i, block->createNot(src->getOperand(i)));
     61        }
     62        flatten(replacement);
     63        var->replaceWith(replacement, true, true);
    3464    }
    35     return modified;
    3665}
    3766
     
    3968 * @brief flatten
    4069 ** ------------------------------------------------------------------------------------------------------------- */
    41 inline bool FlattenAssociativeDFG::flatten(PabloBlock * const block) {
    42     bool modified = false;
     70void FlattenAssociativeDFG::flatten(PabloBlock * const block) {
    4371    Statement * stmt = block->front();
    4472    while (stmt) {
    45         if (isa<And>(stmt) || isa<Or>(stmt) || isa<Xor>(stmt)) {
    46             Variadic * var = cast<Variadic>(stmt);
    47             if (flatten(var, block)) {
    48                 modified = true;
    49                 if (PabloAST * replacement = Simplifier::foldReassociativeFunction(var, block)) {
    50                     stmt = stmt->replaceWith(replacement);
     73        Statement * next = stmt->getNextNode();
     74        if (isa<If>(stmt) || isa<While>(stmt)) {
     75            flatten(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody());
     76        } else if (isa<And>(stmt) || isa<Or>(stmt) || isa<Xor>(stmt)) {
     77            flatten(cast<Variadic>(stmt));
     78        } else if (isa<Not>(stmt)) {
     79            applyNegationInwards(cast<Not>(stmt), block);
     80        }
     81        stmt = next;
     82    }
     83}
     84
     85/** ------------------------------------------------------------------------------------------------------------- *
     86 * @brief extractNegationsOutwards
     87 ** ------------------------------------------------------------------------------------------------------------- */
     88inline void FlattenAssociativeDFG::extractNegationsOutwards(Variadic * const var, PabloBlock * const block) {
     89    PabloAST * negated[var->getNumOperands()];
     90    unsigned operands = 0;
     91    for (unsigned i = 0; i != var->getNumOperands(); ) {
     92        if (isa<Not>(var->getOperand(i))) {
     93            negated[operands++] = cast<Not>(var->removeOperand(i))->getOperand(0);
     94            continue;
     95        }
     96        ++i;
     97    }
     98    if (operands) {
     99        block->setInsertPoint(var->getPrevNode());
     100        Variadic * extractedVar = nullptr;
     101        if (isa<And>(var)) {
     102            extractedVar = block->createOr(operands, PabloBlock::createZeroes());
     103        } else {
     104            extractedVar = block->createAnd(operands, PabloBlock::createOnes());
     105        }
     106        for (unsigned i = 0; i != operands; ++i) {
     107            extractedVar->setOperand(i, negated[i]);
     108        }
     109        std::sort(extractedVar->begin(), extractedVar->end());
     110        var->addOperand(block->createNot(extractedVar));
     111        std::sort(var->begin(), var->end());
     112    }
     113}
     114
     115/** ------------------------------------------------------------------------------------------------------------- *
     116 * @brief removeCommonCalculation
     117 ** ------------------------------------------------------------------------------------------------------------- */
     118inline void FlattenAssociativeDFG::removeCommonCalculation(Assign * const def) {
     119    PabloAST * op = def->getOperand(0);
     120    if (isa<And>(op) || isa<Or>(op) || isa<Xor>(op)) {
     121        Variadic * const var = cast<Variadic>(op);
     122        std::vector<PabloAST *> common(var->begin(), var->end());
     123        std::vector<PabloAST *> temp;
     124        temp.reserve(common.size());
     125        for (PabloAST * user : def->users()) {
     126            if (user->getClassTypeId() != var->getClassTypeId()) {
     127                if (isa<If>(user)) {
    51128                    continue;
     129                }
     130                return;
     131            }
     132            std::set_intersection(common.begin(), common.end(), cast<Variadic>(user)->begin(), cast<Variadic>(user)->end(), std::back_inserter(temp));
     133            common.swap(temp);
     134            temp.clear();
     135        }
     136        for (PabloAST * op : common) {
     137            for (unsigned i = 0; i != var->getNumOperands(); ++i) {
     138                if (var->getOperand(i) == op) {
     139                    var->removeOperand(i);
     140                    break;
    52141                }
    53142            }
    54143        }
    55         stmt = stmt->getNextNode();
    56144    }
    57     return modified;
    58145}
    59146
    60147/** ------------------------------------------------------------------------------------------------------------- *
    61  * @brief factorize
     148 * @brief extract
    62149 ** ------------------------------------------------------------------------------------------------------------- */
    63 inline bool FlattenAssociativeDFG::factorize(PabloBlock * const block) {
    64     bool modified = false;
     150void FlattenAssociativeDFG::extract(PabloBlock * const block) {
    65151    Statement * stmt = block->front();
    66152    while (stmt) {
    67         if (isa<And>(stmt) || isa<Or>(stmt) || isa<Xor>(stmt)) {
    68             // Does this function share two operands with another function of the same type?
    69             // If so, pull them out of both functions.
    70             Variadic * var = cast<Variadic>(stmt);
    71             for (unsigned i = 1; i < var->getNumOperands(); ++i) {
    72                 for (unsigned j = 0; j != i; ++j) {
    73 
    74                 }
    75             }
     153        if (isa<If>(stmt) || isa<While>(stmt)) {
     154            extract(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody());
     155        } else if (isa<And>(stmt) || isa<Or>(stmt)) {
     156            extractNegationsOutwards(cast<Variadic>(stmt), block);
     157        } else if (isa<Assign>(stmt)) {
     158            removeCommonCalculation(cast<Assign>(stmt));
    76159        }
    77160        stmt = stmt->getNextNode();
    78161    }
    79     return modified;
    80 }
    81 
    82 
    83 /** ------------------------------------------------------------------------------------------------------------- *
    84  * @brief traverse
    85  ** ------------------------------------------------------------------------------------------------------------- */
    86 void FlattenAssociativeDFG::traverse(PabloBlock * const block) {
    87     for (Statement * stmt : *block) {
    88         if (isa<If>(stmt) || isa<While>(stmt)) {
    89             traverse(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody());
    90         }
    91     }
    92     flatten(block);
    93162}
    94163
     
    96165 * @brief process
    97166 ** ------------------------------------------------------------------------------------------------------------- */
    98 void FlattenAssociativeDFG::process(PabloFunction & function) {
    99     FlattenAssociativeDFG::traverse(function.getEntryBlock());
    100 //    #ifndef NDEBUG
    101     PabloVerifier::verify(function, "post-flatten-associative-dfg");
    102 //    #endif
     167void FlattenAssociativeDFG::transform(PabloFunction & function) {
     168
     169    FlattenAssociativeDFG::flatten(function.getEntryBlock());
     170    #ifndef NDEBUG
     171    PabloVerifier::verify(function, "post-flatten");
     172    #endif
    103173    Simplifier::optimize(function);
     174
     175    FlattenAssociativeDFG::extract(function.getEntryBlock());
     176    #ifndef NDEBUG
     177    PabloVerifier::verify(function, "post-extract");
     178    #endif
     179    Simplifier::optimize(function);
     180
    104181}
    105182
  • icGREP/icgrep-devel/icgrep/pablo/passes/flattenassociativedfg.h

    r4876 r4878  
    11#ifndef FLATTENASSOCIATIVEDFG_H
    22#define FLATTENASSOCIATIVEDFG_H
    3 
    43
    54namespace pablo {
     
    87class PabloBlock;
    98class Variadic;
     9class Not;
     10class Assign;
     11
    1012
    1113class FlattenAssociativeDFG {
    1214public:
    13     static void process(PabloFunction & function);
     15    static void transform(PabloFunction & function);
    1416protected:
    15     static void traverse(PabloBlock * const block);
    16     static bool flatten(PabloBlock * const block);
    17     static bool factorize(PabloBlock * const block);
    18     static bool flatten(Variadic * const var, PabloBlock * const block);
     17
     18    static void flatten(PabloBlock * const block);
     19    static void flatten(Variadic * const var);
     20    static void applyNegationInwards(Not * const var, PabloBlock * const block);
     21
     22    static void extract(PabloBlock * const block);
     23    static void extractNegationsOutwards(Variadic * const var, PabloBlock * const block);
     24    static void removeCommonCalculation(Assign * const def);
     25
    1926    FlattenAssociativeDFG() = default;
    2027};
  • icGREP/icgrep-devel/icgrep/pablo/pe_and.h

    r4873 r4878  
    2828
    2929    }
     30    And(const unsigned operands, PabloAST * value, String * name)
     31    : Variadic(ClassTypeId::And, operands, value, name)
     32    {
     33
     34    }
    3035};
    3136
  • icGREP/icgrep-devel/icgrep/pablo/pe_or.h

    r4873 r4878  
    2828
    2929    }
     30    Or(const unsigned operands, PabloAST * value, String * name)
     31    : Variadic(ClassTypeId::Or, operands, value, name)
     32    {
     33
     34    }
    3035};
    3136
  • icGREP/icgrep-devel/icgrep/pablo/pe_xor.h

    r4873 r4878  
    2828
    2929    }
     30    Xor(const unsigned operands, PabloAST * value, String * name)
     31    : Variadic(ClassTypeId::Xor, operands, value, name)
     32    {
     33
     34    }
    3035};
    3136
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.cpp

    r4876 r4878  
    88: Statement(ClassTypeId::If, {expr}, nullptr)
    99, mBody(body)
    10 , mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mAllocator))
    11 {
     10, mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mAllocator)) {
    1211    // Conceptually, having a defined var X is identical to having:
    1312    //
     
    2120    // of it.
    2221
     22    mBody->setParent(getParent());
    2323    for (Assign * def : mDefined) {
    2424        def->addUser(this);
     
    3030: Statement(ClassTypeId::If, {expr}, nullptr)
    3131, mBody(body)
    32 , mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mAllocator))
    33 {
     32, mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mAllocator)) {
     33    mBody->setParent(getParent());
    3434    for (Assign * def : mDefined) {
    3535        def->addUser(this);
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.cpp

    r4876 r4878  
    88, mBody(body)
    99, mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
     10    mBody->setParent(getParent());
    1011    for (Next * variant : nextVars) {
    1112        variant->addUser(this);
     
    1819, mBody(body)
    1920, mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
     21    mBody->setParent(getParent());
    2022    for (Next * variant : nextVars) {
    2123        variant->addUser(this);
  • icGREP/icgrep-devel/icgrep/toolchain.cpp

    r4876 r4878  
    144144        Simplifier::optimize(*function);
    145145    }
    146     // FlattenAssociativeDFG::process(*function);
     146    // FlattenAssociativeDFG::transform(*function);
    147147    if (PabloSinkingPass) {
    148148        CodeMotionPass::optimize(*function);
Note: See TracChangeset for help on using the changeset viewer.