Ignore:
Timestamp:
May 16, 2017, 4:13:53 PM (2 years ago)
Author:
nmedfort
Message:

Bug fix check in for DumpTrace?, compilation of DoBlock? / DoFinalBlock? functions. Pablo CodeMotionPass? optimized and enabled by default.

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
20 edited

Legend:

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

    r5283 r5454  
    4848
    4949#define CREATE_OPERATOR_TYPE(Name) \
    50 class Name : public Operator { \
     50class Name final : public Operator { \
    5151    friend class PabloBlock; \
    5252public: \
  • icGREP/icgrep-devel/icgrep/pablo/boolean.h

    r5267 r5454  
    66namespace pablo {
    77
    8 class And : public Variadic {
     8class And final : public Variadic {
    99    friend class PabloBlock;
    1010public:
     
    3434};
    3535
    36 class Or : public Variadic {
     36class Or final : public Variadic {
    3737    friend class PabloBlock;
    3838public:
     
    6262};
    6363
    64 class Xor : public Variadic {
     64class Xor final : public Variadic {
    6565    friend class PabloBlock;
    6666public:
     
    8989};
    9090
    91 class Not : public Statement {
     91class Not final : public Statement {
    9292    friend class PabloBlock;
    9393public:
     
    111111};
    112112
    113 class Sel : public Statement {
     113class Sel final : public Statement {
    114114    friend class PabloBlock;
    115115public:
  • icGREP/icgrep-devel/icgrep/pablo/branch.h

    r5371 r5454  
    5151};
    5252
    53 class If : public Branch {
     53class If final : public Branch {
    5454    friend class PabloBlock;
    5555    friend class Statement;
     
    6666};
    6767
    68 class While : public Branch {
     68class While final : public Branch {
    6969    friend class PabloBlock;
    7070    friend class Statement;
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/booleanreassociationpass.cpp

    r5240 r5454  
    720720    cliques.erase(cliques.begin(), end);
    721721
    722     return std::move(cliques);
     722    return cliques;
    723723}
    724724
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/codemotionpass.cpp

    r5283 r5454  
    66#include <pablo/pe_var.h>
    77#include <boost/container/flat_set.hpp>
    8 #include <vector>
    98#ifndef NDEBUG
    109#include <pablo/analysis/pabloverifier.hpp>
    1110#endif
    1211
    13 using namespace boost;
    14 using namespace boost::container;
    1512using namespace llvm;
    1613
    1714namespace pablo {
    18 
    19 /** ------------------------------------------------------------------------------------------------------------- *
    20  * @brief optimize
    21  ** ------------------------------------------------------------------------------------------------------------- */
    22 bool CodeMotionPass::optimize(PabloKernel * kernel) {
    23     CodeMotionPass::movement(kernel->getEntryBlock());
    24     #ifndef NDEBUG
    25     PabloVerifier::verify(kernel, "post-code-motion");
    26     #endif
    27     return true;
    28 }
    29 
    30 /** ------------------------------------------------------------------------------------------------------------- *
    31  * @brief movement
    32  ** ------------------------------------------------------------------------------------------------------------- */
    33 void CodeMotionPass::movement(PabloBlock * const block) {
    34     sink(block);
    35     for (Statement * stmt : *block) {
    36         if (isa<If>(stmt)) {
    37             movement(cast<If>(stmt)->getBody());
    38         } else if (isa<While>(stmt)) {
    39             movement(cast<While>(stmt)->getBody());
    40             // TODO: if we analyzed the probability of this loop being executed once, twice, or many times, we could
    41             // determine whether hoisting will helpful or harmful to the expected run time.
    42             hoistLoopInvariants(cast<While>(stmt));
    43         }
    44     }
    45 }
    46 
    47 /** ------------------------------------------------------------------------------------------------------------- *
    48  * @brief depthOf
    49  ** ------------------------------------------------------------------------------------------------------------- */
    50 inline static int depthOf(PabloBlock * scope) {
    51     int depth = 0;
    52     while (scope) {
    53         ++depth;
    54         scope = scope->getPredecessor();
    55     }
    56     return depth;
    57 }
    58 
    59 /** ------------------------------------------------------------------------------------------------------------- *
    60  * @brief findLCA
    61  ** ------------------------------------------------------------------------------------------------------------- */
    62 inline PabloBlock * getLCA(PabloBlock * scope1, PabloBlock * scope2) {
    63     int depth1 = depthOf(scope1);
    64     int depth2 = depthOf(scope2);
    65     // If one of these scopes is nested deeper than the other, scan upwards through
    66     // the scope tree until both scopes are at the same depth.
    67     while (depth1 > depth2) {
    68         scope1 = scope1->getPredecessor();
    69         --depth1;
    70     }
    71     while (depth1 < depth2) {
    72         scope2 = scope2->getPredecessor();
    73         --depth2;
    74     }
    75     // Then iteratively step backwards until we find a matching set of scopes; this
    76     // must be the LCA of our original scopes.
    77     while (scope1 != scope2) {
    78         assert (scope1 && scope2);
    79         scope1 = scope1->getPredecessor();
    80         scope2 = scope2->getPredecessor();
    81     }
    82     return scope1;
    83 }
    8415
    8516/** ------------------------------------------------------------------------------------------------------------- *
     
    9425        }
    9526    }
    96     inline bool count(T const item) const {
     27    inline bool contains(T const item) const {
    9728        const auto i = std::lower_bound(std::vector<T>::begin(), std::vector<T>::end(), item);
    9829        return (i != std::vector<T>::end() && *i == item);
     
    10435using UserSet = SetQueue<Statement *>;
    10536
    106 /** ------------------------------------------------------------------------------------------------------------- *
    107  * @brief getScopesOfAllUsers
    108  ** ------------------------------------------------------------------------------------------------------------- */
    109 inline void getScopesOfAllUsers(PabloAST * expr, ScopeSet & scopes) {
    110     for (PabloAST * use : expr->users()) {
    111         if (LLVM_LIKELY(isa<Statement>(use))) {
    112             scopes.insert(cast<Statement>(use)->getParent());
    113         } else if (LLVM_UNLIKELY(isa<PabloKernel>(use))) {
    114             scopes.insert(cast<PabloKernel>(use)->getEntryBlock());
    115         }
    116     }
    117 }
    118 
    119 /** ------------------------------------------------------------------------------------------------------------- *
    120  * @brief getInScopeDominatorsOfAllUsers
    121  ** ------------------------------------------------------------------------------------------------------------- */
    122 inline void getInScopeDominatorsOfAllUsers(PabloAST * expr, UserSet & users, PabloBlock * const block) {
    123     for (PabloAST * use : expr->users()) {
    124         if (LLVM_LIKELY(isa<Statement>(use))) {
    125             Statement * user = cast<Statement>(use);
    126             PabloBlock * parent = user->getParent();
    127             while (parent != block) {
    128                 assert (parent);
    129                 user = parent->getBranch();
    130                 parent = parent->getPredecessor();
    131             }
    132             users.insert(user);
    133         }
    134     }
    135 }
    136 
    137 /** ------------------------------------------------------------------------------------------------------------- *
    138  * @brief sinkIfAcceptableTarget
    139  *
    140  * Scan through this statement's users to see whether they're all in a nested scope. If not, check whether the
    141  * statement can be moved past a branch statement within the same scope.
    142  ** ------------------------------------------------------------------------------------------------------------- */
    143 inline void sinkIfAcceptableTarget(Statement * const stmt, PabloBlock * const block, ScopeSet & scopes, UserSet & users) {
    144     assert (scopes.empty());
    145     if (LLVM_UNLIKELY(isa<Branch>(stmt))) {
    146         for (Var * def : cast<Branch>(stmt)->getEscaped()) {
    147             getScopesOfAllUsers(def, scopes);
    148         }
    149     } else {
    150         getScopesOfAllUsers(isa<Assign>(stmt) ? cast<Assign>(stmt)->getVariable() : stmt, scopes);
    151     }   
    152     if (LLVM_UNLIKELY(scopes.empty())) {
    153         assert (!isa<Assign>(stmt));
    154         // should not occur unless we have a branch with no escaped vars or a statement
    155         // that has no users. In either event, the statement itself should be removed.
    156         stmt->eraseFromParent(true);
    157         return;
    158     }
    159     while (scopes.size() > 1) {
    160         PabloBlock * scope1 = scopes.back(); scopes.pop_back();
    161         PabloBlock * scope2 = scopes.back(); scopes.pop_back();
    162         scopes.insert(getLCA(scope1, scope2));
    163     }
    164     PabloBlock * const scope = scopes.back(); scopes.clear();
    165     if (LLVM_LIKELY(scope == block)) {
    166         assert (users.empty());
     37using LoopVariants = boost::container::flat_set<const PabloAST *>;
     38
     39struct CodeMotionPassContainer {
     40
     41    /** ------------------------------------------------------------------------------------------------------------- *
     42     * @brief depthOf
     43     ** ------------------------------------------------------------------------------------------------------------- */
     44    static int depthOf(PabloBlock * scope) {
     45        int depth = 0;
     46        while (scope) {
     47            ++depth;
     48            scope = scope->getPredecessor();
     49        }
     50        return depth;
     51    }
     52
     53    /** ------------------------------------------------------------------------------------------------------------- *
     54     * @brief findLCA
     55     ** ------------------------------------------------------------------------------------------------------------- */
     56    PabloBlock * getLCA(PabloBlock * scope1, PabloBlock * scope2) {
     57        int depth1 = depthOf(scope1);
     58        int depth2 = depthOf(scope2);
     59        // If one of these scopes is nested deeper than the other, scan upwards through
     60        // the scope tree until both scopes are at the same depth.
     61        while (depth1 > depth2) {
     62            scope1 = scope1->getPredecessor();
     63            --depth1;
     64        }
     65        while (depth1 < depth2) {
     66            scope2 = scope2->getPredecessor();
     67            --depth2;
     68        }
     69        // Then iteratively step backwards until we find a matching set of scopes; this
     70        // must be the LCA of our original scopes.
     71        while (scope1 != scope2) {
     72            assert (scope1 && scope2);
     73            scope1 = scope1->getPredecessor();
     74            scope2 = scope2->getPredecessor();
     75        }
     76        return scope1;
     77    }
     78
     79    /** ------------------------------------------------------------------------------------------------------------- *
     80     * @brief getScopesOfAllUsers
     81     ** ------------------------------------------------------------------------------------------------------------- */
     82    void getScopesOfAllUsers(PabloAST * expr) {
     83        for (PabloAST * use : expr->users()) {
     84            if (LLVM_LIKELY(isa<Statement>(use))) {
     85                mScopes.insert(cast<Statement>(use)->getParent());
     86            } else if (LLVM_UNLIKELY(isa<PabloKernel>(use))) {
     87                mScopes.insert(cast<PabloKernel>(use)->getEntryBlock());
     88            }
     89        }
     90    }
     91
     92    /** ------------------------------------------------------------------------------------------------------------- *
     93     * @brief getInScopeDominatorsOfAllUsers
     94     ** ------------------------------------------------------------------------------------------------------------- */
     95    void getInScopeDominatorsOfAllUsers(PabloAST * expr, PabloBlock * const block) {
     96        for (PabloAST * use : expr->users()) {
     97            if (LLVM_LIKELY(isa<Statement>(use))) {
     98                Statement * user = cast<Statement>(use);
     99                PabloBlock * parent = user->getParent();
     100                while (parent != block) {
     101                    assert (parent);
     102                    user = parent->getBranch();
     103                    parent = parent->getPredecessor();
     104                }
     105                mUsers.insert(user);
     106            }
     107        }
     108    }
     109
     110    /** ------------------------------------------------------------------------------------------------------------- *
     111     * @brief sinkIfAcceptableTarget
     112     *
     113     * Scan through this statement's users to see whether they're all in a nested scope. If not, check whether the
     114     * statement can be moved past a branch statement within the same scope.
     115     ** ------------------------------------------------------------------------------------------------------------- */
     116    void sinkIfAcceptableTarget(Statement * const stmt, PabloBlock * const block) {
     117        assert (mScopes.empty() && mUsers.empty());
    167118        if (LLVM_UNLIKELY(isa<Branch>(stmt))) {
    168119            for (Var * def : cast<Branch>(stmt)->getEscaped()) {
    169                 getInScopeDominatorsOfAllUsers(def, users, block);
     120                getScopesOfAllUsers(def);
    170121            }
    171122        } else {
    172             getInScopeDominatorsOfAllUsers(isa<Assign>(stmt) ? cast<Assign>(stmt)->getVariable() : stmt, users, block);
    173         }
    174         Branch * branch = nullptr;
    175         Statement * temp = stmt;
    176         for (;;) {
    177             temp = temp->getNextNode();
    178             if (temp == nullptr || users.count(temp)) {
    179                 if (branch) {
    180                     // we can move the statement past a branch within its current scope
    181                     stmt->insertAfter(branch);
    182                 }
    183                 break;
    184             }
    185             if (isa<Branch>(temp)) {
    186                 branch = cast<Branch>(temp);
    187             }
    188         }
    189         users.clear();
    190     } else { // test whether the LCA scope is nested within this scope.
    191         PabloBlock * temp = scope;
    192         for (;;) {
    193             temp = temp->getPredecessor();
    194             if (temp == nullptr) {
    195                 break;
    196             } else if (temp == block) {
    197                 // we can move the statement into a nested scope
    198                 stmt->insertBefore(scope->front());
    199                 break;
    200             }
    201         }
    202     }
     123            getScopesOfAllUsers(isa<Assign>(stmt) ? cast<Assign>(stmt)->getVariable() : stmt);
     124        }
     125        if (LLVM_UNLIKELY(mScopes.empty())) {
     126            assert (!isa<Assign>(stmt));
     127            // should not occur unless we have a branch with no escaped vars or a statement
     128            // that has no users. In either event, the statement itself should be removed.
     129            stmt->eraseFromParent(true);
     130            return;
     131        }
     132        while (mScopes.size() > 1) {
     133            PabloBlock * scope1 = mScopes.back(); mScopes.pop_back();
     134            PabloBlock * scope2 = mScopes.back(); mScopes.pop_back();
     135            mScopes.insert(getLCA(scope1, scope2));
     136        }
     137        PabloBlock * const scope = mScopes.back(); mScopes.clear();
     138        if (LLVM_LIKELY(scope == block)) {
     139            assert (mUsers.empty());
     140            if (LLVM_UNLIKELY(isa<Branch>(stmt))) {
     141                for (Var * def : cast<Branch>(stmt)->getEscaped()) {
     142                    getInScopeDominatorsOfAllUsers(def, block);
     143                }
     144            } else {
     145                getInScopeDominatorsOfAllUsers(isa<Assign>(stmt) ? cast<Assign>(stmt)->getVariable() : stmt, block);
     146            }
     147            Branch * branch = nullptr;
     148            Statement * temp = stmt;
     149            for (;;) {
     150                temp = temp->getNextNode();
     151                if (temp == nullptr || mUsers.contains(temp)) {
     152                    if (branch) {
     153                        // we can move the statement past a branch within its current scope
     154                        stmt->insertAfter(branch);
     155                    }
     156                    break;
     157                }
     158                if (isa<Branch>(temp)) {
     159                    branch = cast<Branch>(temp);
     160                }
     161            }
     162            mUsers.clear();
     163        } else { // test whether the LCA scope is nested within this scope.
     164            PabloBlock * temp = scope;
     165            for (;;) {
     166                temp = temp->getPredecessor();
     167                if (temp == nullptr) {
     168                    break;
     169                } else if (temp == block) {
     170                    // we can move the statement into a nested scope
     171                    stmt->insertBefore(scope->front());
     172                    break;
     173                }
     174            }
     175        }
     176    }
     177
     178    /** ------------------------------------------------------------------------------------------------------------- *
     179     * @brief doCodeSinking
     180     ** ------------------------------------------------------------------------------------------------------------- */
     181    void doCodeSinking(PabloBlock * const block) {
     182        Statement * stmt = block->back(); // note: reverse AST traversal
     183        while (stmt) {
     184            Statement * const prevNode = stmt->getPrevNode();
     185            sinkIfAcceptableTarget(stmt, block);
     186            stmt = prevNode;
     187        }
     188    }
     189
     190    /** ------------------------------------------------------------------------------------------------------------- *
     191     * @brief hoistLoopInvariants
     192     ** ------------------------------------------------------------------------------------------------------------- */
     193    void hoistLoopInvariants(Branch * const loop) {
     194        assert (mLoopVariants.empty());
     195        for (Var * variant : loop->getEscaped()) {
     196            mLoopVariants.insert(variant);
     197        }
     198        Statement * outerNode = loop->getPrevNode();
     199        Statement * stmt = loop->getBody()->front();
     200        while (stmt) {
     201            if (isa<Branch>(stmt)) {
     202                for (Var * var : cast<Branch>(stmt)->getEscaped()) {
     203                    mLoopVariants.insert(var);
     204                }
     205            } else {
     206                bool invariant = true;
     207                for (unsigned i = 0; i != stmt->getNumOperands(); ++i) {
     208                    if (mLoopVariants.count(stmt->getOperand(i)) != 0) {
     209                        invariant = false;
     210                        break;
     211                    }
     212                }
     213                if (LLVM_UNLIKELY(invariant)) {
     214                    Statement * next = stmt->getNextNode();
     215                    stmt->insertAfter(outerNode);
     216                    outerNode = stmt;
     217                    stmt = next;
     218                } else {
     219                    mLoopVariants.insert(stmt);
     220                    stmt = stmt->getNextNode();
     221                }
     222            }
     223        }
     224        mLoopVariants.clear();
     225    }
     226
     227    /** ------------------------------------------------------------------------------------------------------------- *
     228     * @brief doCodeMovement
     229     ** ------------------------------------------------------------------------------------------------------------- */
     230    void doCodeMovement(PabloBlock * const block) {
     231        doCodeSinking(block);
     232        for (Statement * stmt : *block) {
     233            if (LLVM_UNLIKELY(isa<Branch>(stmt))) {
     234                doCodeMovement(cast<Branch>(stmt)->getBody());
     235                if (isa<While>(stmt)) {
     236                    // TODO: if we analyzed the probability of this loop being executed once, twice, or many times, we could
     237                    // determine whether hoisting will helpful or harmful to the expected run time.
     238                    hoistLoopInvariants(cast<While>(stmt));
     239                }
     240            }
     241        }
     242    }
     243
     244private:
     245    ScopeSet        mScopes;
     246    UserSet         mUsers;
     247    LoopVariants    mLoopVariants;
     248};
     249
     250/** ------------------------------------------------------------------------------------------------------------- *
     251 * @brief optimize
     252 ** ------------------------------------------------------------------------------------------------------------- */
     253bool CodeMotionPass::optimize(PabloKernel * kernel) {
     254    CodeMotionPassContainer C;
     255    C.doCodeMovement(kernel->getEntryBlock());
     256    #ifndef NDEBUG
     257    PabloVerifier::verify(kernel, "post-code-motion");
     258    #endif
     259    return true;
    203260}
    204261
    205 /** ------------------------------------------------------------------------------------------------------------- *
    206  * @brief sink
    207  ** ------------------------------------------------------------------------------------------------------------- */
    208 inline void CodeMotionPass::sink(PabloBlock * const block) {
    209     ScopeSet scopes;
    210     UserSet users;
    211     Statement * stmt = block->back(); // note: reverse AST traversal
    212     while (stmt) {
    213         Statement * prevNode = stmt->getPrevNode();
    214         sinkIfAcceptableTarget(stmt, block, scopes, users);
    215         stmt = prevNode;
    216     }
     262
    217263}
    218 
    219 /** ------------------------------------------------------------------------------------------------------------- *
    220  * @brief hoistLoopInvariants
    221  ** ------------------------------------------------------------------------------------------------------------- */
    222 void CodeMotionPass::hoistLoopInvariants(While * loop) {
    223     flat_set<const PabloAST *> loopVariants;
    224     for (Var * variant : loop->getEscaped()) {
    225         loopVariants.insert(variant);
    226     }
    227     Statement * outerNode = loop->getPrevNode();
    228     Statement * stmt = loop->getBody()->front();
    229     while (stmt) {
    230         if (isa<Branch>(stmt)) {
    231             for (Var * var : cast<Branch>(stmt)->getEscaped()) {
    232                 loopVariants.insert(var);
    233             }
    234         } else {
    235             bool invariant = true;
    236             for (unsigned i = 0; i != stmt->getNumOperands(); ++i) {
    237                 if (loopVariants.count(stmt->getOperand(i)) != 0) {
    238                     invariant = false;
    239                     break;
    240                 }
    241             }
    242             if (LLVM_UNLIKELY(invariant)) {
    243                 Statement * next = stmt->getNextNode();
    244                 stmt->insertAfter(outerNode);
    245                 outerNode = stmt;
    246                 stmt = next;
    247             } else {
    248                 loopVariants.insert(stmt);
    249                 stmt = stmt->getNextNode();
    250             }
    251         }
    252     }
    253 }
    254 
    255 }
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/codemotionpass.h

    r5270 r5454  
    33
    44namespace pablo {
    5 
    65class PabloKernel;
    7 class PabloBlock;
    8 class Statement;
    9 class While;
    10 class Variadic;
    11 
    126class CodeMotionPass {
    137public:
    14     static bool optimize(PabloKernel * kernel);
    15 protected:
    16     static void movement(PabloBlock * const block);
    17     static void sink(PabloBlock * const block);
    18     static void hoistLoopInvariants(While * loop);
     8    static bool optimize(PabloKernel * const kernel);
    199};
    20 
    2110}
    2211
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_simplifier.cpp

    r5366 r5454  
    545545void Simplifier::deadCodeElimination(PabloBlock * const block) {
    546546
    547    flat_map<PabloAST *, Assign *> unread;
     547    flat_map<PabloAST *, Assign *> unread;
    548548
    549549    Statement * stmt = block->front();
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5446 r5454  
    1313#include <kernels/kernel_builder.h>
    1414#include <llvm/IR/Module.h>
    15 // #include "llvm/Support/Debug.h"
    1615
    1716using namespace pablo;
     
    121120
    122121void PabloKernel::prepareKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) {
    123     if (DebugOptionIsSet(DumpTrace)) {
    124         setName(getName() + "_DumpTrace");
    125     }
    126122    mSizeTy = iBuilder->getSizeTy();
    127123    mStreamTy = iBuilder->getStreamTy();
     
    162158}
    163159
     160static inline std::string annotateKernelNameWithDebugFlags(std::string && name) {
     161    if (DebugOptionIsSet(DumpTrace)) {
     162        name += "_DumpTrace";
     163    }
     164    return name;
     165}
     166
    164167PabloKernel::PabloKernel(const std::unique_ptr<KernelBuilder> & b,
    165                          std::string kernelName,
     168                         std::string && kernelName,
    166169                         std::vector<Binding> stream_inputs,
    167170                         std::vector<Binding> stream_outputs,
    168171                         std::vector<Binding> scalar_parameters,
    169172                         std::vector<Binding> scalar_outputs)
    170 : BlockOrientedKernel(std::move(kernelName),
     173: BlockOrientedKernel(std::move(annotateKernelNameWithDebugFlags(std::move(kernelName))),
    171174                      std::move(stream_inputs), std::move(stream_outputs),
    172175                      std::move(scalar_parameters), std::move(scalar_outputs),
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.h

    r5446 r5454  
    125125protected:
    126126
    127     PabloKernel(const std::unique_ptr<kernel::KernelBuilder> & builder, std::string kernelName,
     127    PabloKernel(const std::unique_ptr<kernel::KernelBuilder> & builder,
     128                std::string && kernelName,
    128129                std::vector<Binding> stream_inputs = {},
    129130                std::vector<Binding> stream_outputs = {},
  • icGREP/icgrep-devel/icgrep/pablo/pablo_toolchain.cpp

    r5436 r5454  
    5252static cl::bits<PabloCompilationFlags>
    5353    PabloOptimizationsOptions(cl::values(clEnumVal(DisableSimplification, "Disable Pablo Simplification pass (not recommended)"),
    54                                          clEnumVal(EnableCodeMotion, "Moves statements into the innermost legal If-scope and moves invariants out of While-loops."),
     54                                         clEnumVal(DisableCodeMotion, "Moves statements into the innermost legal If-scope and moves invariants out of While-loops."),
    5555#ifdef ENABLE_MULTIPLEXING
    5656                                         clEnumVal(EnableMultiplexing, "combine Advances whose inputs are mutual exclusive into the fewest number of advances possible (expensive)."),
     
    195195    const timestamp_t optimization_start = read_cycle_counter();
    196196#endif
    197     if (!PabloOptimizationsOptions.isSet(DisableSimplification)) {
     197    if (LLVM_LIKELY(!PabloOptimizationsOptions.isSet(DisableSimplification))) {
    198198        READ_CYCLE_COUNTER(simplification_start);
    199199        Simplifier::optimize(kernel);
     
    230230    }
    231231#endif
    232     if (PabloOptimizationsOptions.isSet(EnableCodeMotion)) {
     232    if (LLVM_LIKELY(!PabloOptimizationsOptions.isSet(DisableCodeMotion))) {
    233233        READ_CYCLE_COUNTER(sinking_start);
    234234        CodeMotionPass::optimize(kernel);
  • icGREP/icgrep-devel/icgrep/pablo/pablo_toolchain.h

    r5295 r5454  
    1818
    1919enum PabloCompilationFlags {
    20     DisableSimplification, EnableCodeMotion,
     20    DisableSimplification, DisableCodeMotion,
    2121    EnableMultiplexing, EnableLowering, EnablePreDistribution, EnablePostDistribution, EnablePrePassScheduling
    2222};
  • icGREP/icgrep-devel/icgrep/pablo/pe_advance.h

    r5267 r5454  
    1313namespace pablo {
    1414
    15 class Advance : public Statement {
     15class Advance final : public Statement {
    1616    friend class PabloBlock;
    1717public:
  • icGREP/icgrep-devel/icgrep/pablo/pe_constant.h

    r5230 r5454  
    66namespace pablo {
    77
    8 class Constant : public PabloAST {
     8class Constant final : public PabloAST {
    99    friend class PabloBlock;
    1010public:
  • icGREP/icgrep-devel/icgrep/pablo/pe_count.h

    r5267 r5454  
    1212namespace pablo {
    1313
    14 class Count : public Statement {
     14class Count final : public Statement {
    1515    friend class PabloBlock;
    1616public:
  • icGREP/icgrep-devel/icgrep/pablo/pe_infile.h

    r5230 r5454  
    1212namespace pablo {
    1313
    14 class InFile : public Statement {
     14class InFile final : public Statement {
    1515    friend class PabloBlock;
    1616public:
     
    3333};
    3434
    35 class AtEOF : public Statement {
     35class AtEOF final : public Statement {
    3636    friend class PabloBlock;
    3737public:
  • icGREP/icgrep-devel/icgrep/pablo/pe_lookahead.h

    r5267 r5454  
    1313namespace pablo {
    1414
    15 class Lookahead : public Statement {
     15class Lookahead final : public Statement {
    1616    friend class PabloBlock;
    1717public:
  • icGREP/icgrep-devel/icgrep/pablo/pe_matchstar.h

    r5230 r5454  
    1212namespace pablo {
    1313
    14 class MatchStar : public Statement {
     14class MatchStar final : public Statement {
    1515    friend class PabloBlock;
    1616public:
  • icGREP/icgrep-devel/icgrep/pablo/pe_ones.h

    r5283 r5454  
    1212namespace pablo {
    1313
    14 class Ones : public PabloAST {
     14class Ones final : public PabloAST {
    1515    friend class PabloBlock;
    1616    friend class PabloKernel;
  • icGREP/icgrep-devel/icgrep/pablo/pe_zeroes.h

    r5283 r5454  
    1212namespace pablo {
    1313
    14 class Zeroes : public PabloAST {
     14class Zeroes final : public PabloAST {
    1515    friend class PabloBlock;
    1616    friend class PabloKernel;
  • icGREP/icgrep-devel/icgrep/pablo/ps_assign.h

    r5230 r5454  
    1212namespace pablo {
    1313
    14 class Assign : public Statement {
     14class Assign final : public Statement {
    1515    friend class PabloBlock;
    1616public:
Note: See TracChangeset for help on using the changeset viewer.