Ignore:
Timestamp:
Dec 9, 2015, 4:59:02 PM (4 years ago)
Author:
nmedfort
Message:

Continued work on multiplexing pass.

Location:
icGREP/icgrep-devel/icgrep/pablo/passes
Files:
3 edited

Legend:

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

    r4886 r4890  
    44#include <pablo/analysis/pabloverifier.hpp>
    55#include <pablo/optimizers/pablo_simplifier.hpp>
    6 #include <pablo/optimizers/codemotionpass.h>
     6#include <pablo/passes/flattenassociativedfg.h>
    77#include <boost/container/flat_set.hpp>
    88#include <set>
     
    239239
    240240/** ------------------------------------------------------------------------------------------------------------- *
    241  * @brief factorize
    242  ** ------------------------------------------------------------------------------------------------------------- */
    243 inline void FactorizeDFG::factorize(Variadic * var) {
     241 * @brief Common Subexpression Elimination
     242 ** ------------------------------------------------------------------------------------------------------------- */
     243inline void FactorizeDFG::CSE(Variadic * var) {
    244244    while (var->getNumOperands() > 2) {
    245         unsigned numOperands = var->getNumOperands();
    246245        BicliqueSet bicliques = enumerateBicliques(var);
    247246        if (bicliques.empty()) {
     
    268267            cast<Variadic>(user)->addOperand(factored);
    269268        }
    270         assert (var->getNumOperands() < numOperands);
    271     }
    272 }
    273 
    274 /** ------------------------------------------------------------------------------------------------------------- *
    275  * @brief factorize
    276  ** ------------------------------------------------------------------------------------------------------------- */
    277 void FactorizeDFG::factorize(PabloBlock * const block) {
     269    }
     270}
     271
     272/** ------------------------------------------------------------------------------------------------------------- *
     273 * @brief Common Subexpression Elimination
     274 ** ------------------------------------------------------------------------------------------------------------- */
     275void FactorizeDFG::CSE(PabloBlock * const block) {
    278276    Statement * stmt = block->front();
    279277    while (stmt) {
    280278        if (isa<If>(stmt) || isa<While>(stmt)) {           
    281             factorize(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody());
     279            CSE(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody());
    282280        } else if (isa<And>(stmt) || isa<Or>(stmt) || isa<Xor>(stmt)) {
    283             factorize(cast<Variadic>(stmt));
     281            CSE(cast<Variadic>(stmt));
    284282        }
    285283        stmt = stmt->getNextNode();
     
    288286
    289287/** ------------------------------------------------------------------------------------------------------------- *
    290  * @brief initialize
     288 * @brief preScanDFG
    291289 ** ------------------------------------------------------------------------------------------------------------- */
    292290void FactorizeDFG::initialize(const PabloBlock * const block, const unsigned depth) {
     
    303301
    304302/** ------------------------------------------------------------------------------------------------------------- *
    305  * @brief initialize
    306  ** ------------------------------------------------------------------------------------------------------------- */
    307 inline void FactorizeDFG::initialize(const PabloFunction & function) {
     303 * @brief preScanDFG
     304 ** ------------------------------------------------------------------------------------------------------------- */
     305inline void FactorizeDFG::initialize(const PabloFunction &function) {
    308306    mScopeDepth.emplace(function.getEntryBlock(), 0);
    309307    initialize(function.getEntryBlock(), 1);
     
    316314    FactorizeDFG ldfg;
    317315    ldfg.initialize(function);
    318     ldfg.factorize(function.getEntryBlock());
     316    ldfg.CSE(function.getEntryBlock());
    319317    #ifndef NDEBUG
    320318    PabloVerifier::verify(function, "post-factorize");
  • icGREP/icgrep-devel/icgrep/pablo/passes/factorizedfg.h

    r4886 r4890  
    1010class PabloBlock;
    1111class Variadic;
     12class Not;
    1213class Statement;
    1314class PabloAST;
     
    2122    void initialize(const PabloFunction & function);
    2223    void initialize(const PabloBlock * const block, const unsigned depth);
    23     void factorize(PabloBlock * const block);
    24     void factorize(Variadic * const var);
     24    void CSE(PabloBlock * const block);
     25    void CSE(Variadic * const var);
    2526    PabloBlock * chooseInsertionScope(const VertexSet & users);
    2627    void findInsertionPoint(const VertexSet & operands, PabloBlock * const scope);
  • icGREP/icgrep-devel/icgrep/pablo/passes/flattenassociativedfg.h

    r4887 r4890  
    1313class FlattenAssociativeDFG {
    1414    friend class DistributivePass;
     15    friend class FactorizeDFG;
    1516public:
    1617    static void transform(PabloFunction & function);
Note: See TracChangeset for help on using the changeset viewer.