Ignore:
Timestamp:
Dec 17, 2015, 4:45:18 PM (3 years ago)
Author:
nmedfort
Message:

Work on coalescing algorithm + minor changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/codemotionpass.cpp

    r4870 r4896  
    11#include "codemotionpass.h"
    2 #include <pablo/function.h>
    3 #include <pablo/ps_while.h>
     2#include <pablo/codegenstate.h>
    43#include <pablo/analysis/pabloverifier.hpp>
    5 #ifdef USE_BOOST
    64#include <boost/container/flat_set.hpp>
    7 #else
    8 #include <unordered_set>
    9 #endif
    10 #include <pablo/printer_pablos.h>
    11 #include <iostream>
     5
     6using namespace boost;
     7using namespace boost::container;
    128
    139namespace pablo {
    14 
    15 #ifdef USE_BOOST
    16 using LoopVariants = boost::container::flat_set<const PabloAST *>;
    17 #else
    18 using LoopVariants = std::unordered_set<const PabloAST *>;
    19 #endif
    2010
    2111/** ------------------------------------------------------------------------------------------------------------- *
     
    7161 ** ------------------------------------------------------------------------------------------------------------- */
    7262template <class ScopeSet>
    73 inline bool findScopeUsages(Statement * stmt, ScopeSet & scopeSet, const PabloBlock * const block, const PabloBlock * const ignored = nullptr) {
     63inline bool findScopeUsages(Statement * stmt, ScopeSet & scopeSet, const PabloBlock * const block, const PabloBlock * const blocker) {
    7464    for (PabloAST * use : stmt->users()) {
    7565        assert (isa<Statement>(use));
     
    7868            return false;
    7969        }
    80         if (parent != ignored) {
     70        if (parent != blocker) {
    8171            scopeSet.insert(parent);
    8272        }
     
    10595        }
    10696    } else if (isSafeToMove(stmt)) {
    107         return findScopeUsages(stmt, scopeSet, block);
     97        return findScopeUsages(stmt, scopeSet, block, nullptr);
    10898    }
    10999    return false;
     
    166156 ** ------------------------------------------------------------------------------------------------------------- */
    167157void CodeMotionPass::hoistLoopInvariants(While * loop) {
    168     LoopVariants loopVariants;
     158    flat_set<const PabloAST *> loopVariants;
    169159    for (Next * variant : loop->getVariants()) {
    170160        loopVariants.insert(variant);
Note: See TracChangeset for help on using the changeset viewer.