diff options
-rwxr-xr-x | src/ir_chill.cc | 29 | ||||
-rw-r--r-- | src/irtools.cc | 9 | ||||
-rw-r--r-- | src/transformations/loop.cc | 31 |
3 files changed, 9 insertions, 60 deletions
diff --git a/src/ir_chill.cc b/src/ir_chill.cc index 54c9b3b..8ff9ed1 100755 --- a/src/ir_chill.cc +++ b/src/ir_chill.cc @@ -549,8 +549,6 @@ IR_clangCode::IR_clangCode(const char *filename, const char *proc_name, const ch } IR_clangCode::IR_clangCode(const char *fname, const char *proc_name) : IR_Code() { CHILL_DEBUG_PRINT("IR_xxxxCode::IR_xxxxCode()\n"); - //fprintf(stderr, "IR_clangCode::IR_clangCode( filename %s, procedure %s )\n", filename, proc_name); - filename = strdup(fname); // filename is internal to IR_clangCode procedurename = strdup(proc_name); outfilename = NULL; @@ -559,27 +557,15 @@ IR_clangCode::IR_clangCode(const char *fname, const char *proc_name) : IR_Code() char *argv[2]; argv[0] = strdup("chill"); argv[1] = strdup(filename); - - // use clang to parse the input file ? (or is that already done?) - //fprintf(stderr, "IR_clangCode::IR_clangCode(), parsing input file %s\n", argv[1]); - - // this causes opening and parsing of the file. + // this causes opening and parsing of the file. // this is the only call to Instance that has an argument list or file name IR_clangCode_Global_Init *pInstance = IR_clangCode_Global_Init::Instance(argv); if (pInstance) { - aClangCompiler *Clang = pInstance->ClangCompiler; - //fprintf(stderr, "Clang is 0x%x\n", Clang); - - //fprintf(stderr, "want to get pointer to clang ast for procedure %s\n", proc_name); pInstance->setCurrentFunction(NULL); // we have no function AST yet - entire_file_AST = Clang->entire_file_AST; // ugly that same name, different classes chillAST_FunctionDecl *localFD = Clang->findprocedurebyname(strdup(proc_name)); // stored locally - //fprintf(stderr, "back from findprocedurebyname( %s )\n", proc_name ); - //localFD->print(); - pInstance->setCurrentFunction(localFD); CHILL_DEBUG_BEGIN @@ -592,11 +578,7 @@ IR_clangCode::IR_clangCode(const char *fname, const char *proc_name) : IR_Code() chillfunc = localFD; } - CHILL_DEBUG_PRINT("returning after reading source file and finding function\n\n"); - - //chillfunc->dump( 0, stderr); - } @@ -1022,15 +1004,6 @@ IR_Block *IR_clangCode::MergeNeighboringControlStructures(const std::vector<IR_C IR_Block *IR_clangCode::GetCode() const { // return IR_Block corresponding to current function? - //fprintf(stderr, "IR_clangCode::GetCode()\n"); - //Stmt *s = func_->getBody(); // clang statement, and clang getBody - //fprintf(stderr, "chillfunc 0x%x\n", chillfunc); - - //chillAST_Node *bod = chillfunc->getBody(); // chillAST - //fprintf(stderr, "printing the function getBody()\n"); - //fprintf(stderr, "sourceManager 0x%x\n", sourceManager); - //bod->print(); - return new IR_chillBlock(this, chillfunc); } diff --git a/src/irtools.cc b/src/irtools.cc index 784f6e4..e5666ce 100644 --- a/src/irtools.cc +++ b/src/irtools.cc @@ -214,20 +214,13 @@ bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, last_dim = itn->payload; } - if (last_dim == -1) - return true; - for (int i = 0; i <= last_dim; i++) { if (dv.lbounds[i] > 0) return true; else if (dv.lbounds[i] < 0) return false; } - - if (before) - return true; - else - return false; + return before; } return true; diff --git a/src/transformations/loop.cc b/src/transformations/loop.cc index 8f56be6..faf33e6 100644 --- a/src/transformations/loop.cc +++ b/src/transformations/loop.cc @@ -478,9 +478,6 @@ void Loop::align_loops(std::vector<ir_tree_node*> &ir_tree, std::vector<std::str CG_outputRepr *ivar = ocg->CreateIdent(iname); vars_to_be_replaced.push_back(clp->index()->name()); vars_replacement.push_back(ivar); - ocg->CreateSubstitutedStmt(0,new CG_chillRepr(clp->chillforstmt->getInit()),vars_to_be_replaced,vars_replacement,false); - ocg->CreateSubstitutedStmt(0,new CG_chillRepr(clp->chillforstmt->getInc()),vars_to_be_replaced,vars_replacement,false); - ocg->CreateSubstitutedStmt(0,new CG_chillRepr(clp->chillforstmt->getCond()),vars_to_be_replaced,vars_replacement,false); // FIXME: this breaks abstraction if (clp->step_size()<0) { IR_CONDITION_TYPE cond = clp->conditionoperator; @@ -493,7 +490,13 @@ void Loop::align_loops(std::vector<ir_tree_node*> &ir_tree, std::vector<std::str CG_outputRepr *inv = ocg->CreateMinus(NULL,ivar); vars_to_be_replaced.push_back(iname); vars_replacement.push_back(inv); - } + clp->chillforstmt->setCond(new chillAST_BinaryOperator(((CG_chillRepr*)(clp->chillupperbound))->chillnodes[0],((chillAST_BinaryOperator*)(clp->chillforstmt->getCond()))->getOp() + ,((CG_chillRepr*)ivar)->chillnodes[0])); + } else + clp->chillforstmt->setCond(new chillAST_BinaryOperator(((CG_chillRepr*)ivar)->chillnodes[0],((chillAST_BinaryOperator*)(clp->chillforstmt->getCond()))->getOp() + ,((CG_chillRepr*)(clp->chillupperbound))->chillnodes[0])); + clp->chillforstmt->setInit(new chillAST_BinaryOperator(((CG_chillRepr*)ivar)->chillnodes[0],"=",((CG_chillRepr*)(clp->chilllowerbound))->chillnodes[0])); + clp->chillforstmt->setInc(new chillAST_BinaryOperator(((CG_chillRepr*)ivar)->chillnodes[0],"+=",new chillAST_IntegerLiteral(clp->step_size_))); // Ready to recurse align_loops(ir_tree[i]->children,vars_to_be_replaced,vars_replacement,level+1); } @@ -669,26 +672,6 @@ Loop::Loop(const IR_Control *control) { stmt[canReduce[i]].reductionOp = opType; } } - - // printing out stuff for debugging - CHILL_DEBUG_BEGIN - std::cout << "STATEMENTS THAT CAN BE REDUCED: \n"; - for (int i = 0; i < canReduce.size(); i++) { - std::cout << "------- " << canReduce[i] << " ------- " - << stmt[canReduce[i]].reduction << "\n"; - ir->printStmt(stmt[canReduce[i]].code); // Manu - if (stmt[canReduce[i]].reductionOp == IR_OP_PLUS) - std::cout << "Reduction type:: + \n"; - else if (stmt[canReduce[i]].reductionOp == IR_OP_MINUS) - std::cout << "Reduction type:: - \n"; - else if (stmt[canReduce[i]].reductionOp == IR_OP_MULTIPLY) - std::cout << "Reduction type:: * \n"; - else if (stmt[canReduce[i]].reductionOp == IR_OP_DIVIDE) - std::cout << "Reduction type:: / \n"; - else - std::cout << "Unknown reduction type\n"; - } - CHILL_DEBUG_END // cleanup the IR tree CHILL_DEBUG_PRINT("init dumb transformation relations\n"); |