Ignore:
Timestamp:
Nov 14, 2015, 5:38:36 PM (4 years ago)
Author:
nmedfort
Message:

Bug fix for Multiplexing. Added ability to set the body of a If/While? node after creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/analysis/pabloverifier.cpp

    r4866 r4870  
    3737}
    3838
    39 void verifyUseDefInformation(const PabloBlock & block, const ScopeSet & validScopes) {
    40     for (const Statement * stmt : block) {
    41 
     39void verifyUseDefInformation(const PabloBlock * block, const ScopeSet & validScopes) {
     40    for (const Statement * stmt : *block) {
    4241        for (const PabloAST * use : stmt->users()) {
    4342            if (LLVM_LIKELY(isa<Statement>(use))) {
     
    4746                    std::string tmp;
    4847                    raw_string_ostream str(tmp);
    49                     PabloPrinter::print(user, "PabloVerifier: use-def error: ", str);
     48                    str << "PabloVerifier: use-def error: ";
     49                    PabloPrinter::print(user, str);
    5050                    str << " is a user of ";
    5151                    PabloPrinter::print(stmt, str);
     
    100100                std::string tmp;
    101101                raw_string_ostream str(tmp);
    102                 PabloPrinter::print(stmt, "PabloVerifier: def-use error: ", str);
     102                str << "PabloVerifier: def-use error: ";
     103                PabloPrinter::print(stmt, str);
    103104                str << " is not a user of ";
    104105                PabloPrinter::print(def, str);
     
    112113}
    113114
    114 void gatherValidScopes(const PabloBlock & block, ScopeSet & validScopes) {
    115     validScopes.insert(&block);
    116     for (const Statement * stmt : block) {
     115void gatherValidScopes(const PabloBlock * block, ScopeSet & validScopes) {
     116    validScopes.insert(block);
     117    for (const Statement * stmt : *block) {
    117118        if (LLVM_UNLIKELY(isa<If>(stmt) || isa<While>(stmt))) {
    118119            gatherValidScopes(isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody(), validScopes);
     
    130131 * @brief unreachable
    131132 ** ------------------------------------------------------------------------------------------------------------- */
    132 bool unreachable(const Statement * stmt, const PabloBlock & block) {
     133bool unreachable(const Statement * stmt, const PabloBlock * const block) {
    133134    PabloBlock * parent = stmt->getParent();
    134135    while (parent)  {
    135         if (parent == &block) {
     136        if (parent == block) {
    136137            return false;
    137138        }
     
    144145 * @brief verifyProgramStructure
    145146 ** ------------------------------------------------------------------------------------------------------------- */
    146 void verifyProgramStructure(const PabloBlock & block) {
     147void verifyProgramStructure(const PabloBlock * block) {
    147148    const Statement * prev = nullptr;
    148     for (const Statement * stmt : block) {
     149    for (const Statement * stmt : *block) {
    149150        if (LLVM_UNLIKELY(stmt->getPrevNode() != prev)) {
    150151            std::string tmp;
    151152            raw_string_ostream str(tmp);
    152             PabloPrinter::print(stmt, "PabloVerifier: structure error: ", str);
     153            str << "PabloVerifier: structure error: ";
     154            PabloPrinter::print(stmt, str);
    153155            str << " succeeds ";
    154156            PabloPrinter::print(prev, str);
     
    158160        }
    159161        prev = stmt;
    160         if (LLVM_UNLIKELY(stmt->getParent() != &block)) {
     162        if (LLVM_UNLIKELY(stmt->getParent() != block)) {
    161163            std::string tmp;
    162164            raw_string_ostream str(tmp);
    163             PabloPrinter::print(stmt, "PabloVerifier: structure error: ", str);
     165            str << "PabloVerifier: structure error: ";
     166            PabloPrinter::print(stmt, str);
    164167            str << " is not contained in its reported scope block";
    165168            throw std::runtime_error(str.str());
    166169        }
    167170        if (LLVM_UNLIKELY(isa<If>(stmt) || isa<While>(stmt))) {
    168             const PabloBlock & nested = isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody();
    169             if (LLVM_UNLIKELY(nested.getParent() != &block)) {
     171            const PabloBlock * nested = isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody();
     172            if (LLVM_UNLIKELY(nested->getParent() != block)) {
    170173                std::string tmp;
    171174                raw_string_ostream str(tmp);
     
    280283}
    281284
    282 void isTopologicallyOrdered(const PabloBlock & block, const OrderingVerifier & parent) {
     285void isTopologicallyOrdered(const PabloBlock * block, const OrderingVerifier & parent) {
    283286    OrderingVerifier ov(parent);
    284     for (const Statement * stmt : block) {
     287    for (const Statement * stmt : *block) {
    285288        if (LLVM_UNLIKELY(isa<While>(stmt))) {
    286289            isTopologicallyOrdered(cast<While>(stmt)->getBody(), ov);
     
    306309                str << "function is not topologically ordered! ";
    307310                PabloPrinter::print(stmt->getOperand(i), str);
    308                 PabloPrinter::print(stmt, " was used before definition by ", str);
     311                str << " was used before definition by ";
     312                PabloPrinter::print(stmt, str);
    309313                throw std::runtime_error(str.str());
    310314            }
     
    335339    } catch(std::runtime_error err) {
    336340        raw_os_ostream out(std::cerr);
    337         PabloPrinter::print(function.getEntryBlock().statements(), out);
     341        PabloPrinter::print(function, out);
    338342        out.flush();
    339343        if (location.empty()) {
Note: See TracChangeset for help on using the changeset viewer.