Ignore:
Timestamp:
Dec 1, 2015, 10:22:46 PM (4 years ago)
Author:
nmedfort
Message:

Incorporated n-ary coalescing into DistributivePass?.

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

Legend:

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

    r4886 r4887  
    4242 * @brief coalesce
    4343 ** ------------------------------------------------------------------------------------------------------------- */
    44 void FlattenAssociativeDFG::coalesce(PabloBlock * const block) {
     44void FlattenAssociativeDFG::coalesce(PabloBlock * const block, const bool traverse) {
    4545    Statement * stmt = block->front();
    4646    while (stmt) {
    4747        Statement * next = stmt->getNextNode();
    48         if (isa<If>(stmt) || isa<While>(stmt)) {
    49             coalesce(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody());
     48        if (traverse && (isa<If>(stmt) || isa<While>(stmt))) {
     49            coalesce(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody(), true);
    5050        } else if (isa<And>(stmt) || isa<Or>(stmt) || isa<Xor>(stmt)) {
    5151            coalesce(cast<Variadic>(stmt));
     
    133133void FlattenAssociativeDFG::transform(PabloFunction & function) {
    134134
    135     FlattenAssociativeDFG::coalesce(function.getEntryBlock());
     135    FlattenAssociativeDFG::coalesce(function.getEntryBlock(), true);
    136136    #ifndef NDEBUG
    137137    PabloVerifier::verify(function, "post-coalescence");
  • icGREP/icgrep-devel/icgrep/pablo/passes/flattenassociativedfg.h

    r4886 r4887  
    1616    static void transform(PabloFunction & function);
    1717protected:
    18     static void coalesce(PabloBlock * const block);
     18    static void coalesce(PabloBlock * const block, const bool traverse);
    1919    static void coalesce(Variadic * const var);
    2020    static void deMorgansExpansion(Not * const var, PabloBlock * const block);
Note: See TracChangeset for help on using the changeset viewer.