diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-26 18:09:19 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-26 18:09:19 -0600 |
commit | 3f75a3cd12eb4eb2f34a5b6e07f82e7ebf51fe03 (patch) | |
tree | f4e7ea2f7a2128ad24e26c98055fa515a7761b13 | |
parent | 15e8ff480e7a75f4dce8c8d41da157cf51bd3cb8 (diff) | |
download | chill-3f75a3cd12eb4eb2f34a5b6e07f82e7ebf51fe03.tar.gz chill-3f75a3cd12eb4eb2f34a5b6e07f82e7ebf51fe03.tar.bz2 chill-3f75a3cd12eb4eb2f34a5b6e07f82e7ebf51fe03.zip |
rinning
-rw-r--r-- | src/chillmodule.cc | 4 | ||||
-rwxr-xr-x | src/ir_clang.cc | 41 |
2 files changed, 6 insertions, 39 deletions
diff --git a/src/chillmodule.cc b/src/chillmodule.cc index 5e78be3..591b77e 100644 --- a/src/chillmodule.cc +++ b/src/chillmodule.cc @@ -332,13 +332,13 @@ static void add_known(std::string cond_expr) { GEQ_Handle h = f_root->add_GEQ(); for (std::map<std::string, int>::iterator it = (*cond)[j].begin(); it != (*cond)[j].end(); it++) { try { - int dim = from_string<int>(it->first); + int dim = std::stoi(it->first); if (dim == 0) h.update_const(it->second); else throw std::invalid_argument("only symbolic variables are allowed in known condition"); } - catch (std::ios::failure e) { + catch (std::invalid_argument &e) { Free_Var_Decl *g = NULL; for (unsigned i = 0; i < myloop->freevar.size(); i++) { std::string name = myloop->freevar[i]->base_name(); diff --git a/src/ir_clang.cc b/src/ir_clang.cc index da20d3c..81bdcf7 100755 --- a/src/ir_clang.cc +++ b/src/ir_clang.cc @@ -2269,14 +2269,12 @@ IR_clangCode::~IR_clangCode() { //chillfunc->print(); //fprintf(stderr, "Constant Folding before\n"); - //chillfunc->print(); chillfunc->constantFold(); //fprintf(stderr, "\nConstant Folding after\n"); //chillfunc->print(); chillfunc->cleanUpVarDecls(); - - //chillfunc->dump(); + //chillfunc->dump(); // TODO should output the entire file, not just the function we're working on chillAST_SourceFile *src = chillfunc->getSourceFile(); @@ -2611,42 +2609,21 @@ std::vector<IR_Control *> IR_clangCode::FindOneLevelControlStructure(const IR_Bl controls.push_back(new IR_chillLoop(this, (chillAST_ForStmt *) blockast)); } - //else if (blockast->getType() == CHILLAST_NODE_IFSTMT) { - // controls.push_back( new IR_clangIf( this, (chillAST_IfStmt *)blockast)); - //} else if (blockast->getType() == CHILLAST_NODE_COMPOUNDSTMT || blockast->getType() == CHILLAST_NODE_FUNCTIONDECL) { if (blockast->getType() == CHILLAST_NODE_FUNCTIONDECL) { - //fprintf(stderr, "ir_clanc.cc blockast->getType() == CHILLAST_NODE_FUNCTIONDECL\n"); - chillAST_FunctionDecl *FD = (chillAST_FunctionDecl *) blockast; chillAST_Node *bod = FD->getBody(); - //fprintf(stderr, "bod 0x%x\n", bod); - children = bod->getChildren(); - - //fprintf(stderr, "FunctionDecl body is of type %s\n", bod->getTypeString()); - //fprintf(stderr, "found a top level FunctionDecl (Basic Block)\n"); - //fprintf(stderr, "basic block has %d statements\n", children.size() ); - //fprintf(stderr, "basic block is:\n"); - //bod->print(); } else /* CompoundStmt */ { - //fprintf(stderr, "found a top level Basic Block\n"); children = blockast->getChildren(); } int numchildren = children->size(); - //fprintf(stderr, "basic block has %d statements\n", numchildren); - //fprintf(stderr, "basic block is:\n"); - //fprintf(stderr, "{\n"); - //blockast->print(); - //fprintf(stderr, "}\n"); - int ns; IR_chillBlock *basicblock = new IR_chillBlock(this); // no statements for (int i = 0; i < numchildren; i++) { - //fprintf(stderr, "child %d is of type %s\n", i, children[i]->getTypeString()); CHILLAST_NODE_TYPE typ = (*children)[i]->getType(); if (typ == CHILLAST_NODE_LOOP) { if (numchildren == 1) { @@ -2654,7 +2631,6 @@ std::vector<IR_Control *> IR_clangCode::FindOneLevelControlStructure(const IR_Bl } else { CHILL_DEBUG_PRINT("found a For statement (Loop) at %d within a Basic Block\n", i); } - //children[i]->print(); printf("\n"); fflush(stdout); ns = basicblock->numstatements(); if (ns) { @@ -2681,21 +2657,12 @@ std::vector<IR_Control *> IR_clangCode::FindOneLevelControlStructure(const IR_Bl } } // for each child ns = basicblock->numstatements(); - //fprintf(stderr, "ns %d\n", ns); - if (ns != 0) { - if (ns != numchildren) { + if (ns!=0 && ns != numchildren) { //fprintf(stderr, "end of body ends the run of %d statements in the Basic Block\n", ns); controls.push_back(basicblock); - } else { - //fprintf(stderr, "NOT sending straightline run of statements, because it would be the entire block. There are no control statements in the block\n"); } - } - //else fprintf(stderr, "NOT sending the last run of %d statements\n", ns); - - } else { - CHILL_ERROR("block is a %s???\n", blockast->getTypeString()); - exit(-1); - } + } else + CHILL_DEBUG_PRINT("Single statement block of type %s\n", blockast->getTypeString()); CHILL_DEBUG_PRINT("returning vector of %d controls\n", controls.size()); return controls; |