summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/chillcg/src/CG_chillBuilder.cc259
-rwxr-xr-xlib/codegen/src/CG.cc205
-rwxr-xr-xlib/codegen/src/CG_utils.cc99
3 files changed, 94 insertions, 469 deletions
diff --git a/lib/chillcg/src/CG_chillBuilder.cc b/lib/chillcg/src/CG_chillBuilder.cc
index dc02447..966c20f 100755
--- a/lib/chillcg/src/CG_chillBuilder.cc
+++ b/lib/chillcg/src/CG_chillBuilder.cc
@@ -384,29 +384,21 @@ namespace omega {
CG_outputRepr *lower,
CG_outputRepr *upper,
CG_outputRepr *step) const {
- fprintf(stderr, "\nCG_chillBuilder::CreateInductive()\n");
if (index == NULL || lower == NULL || upper == NULL) {
- fprintf(stderr, "Code generation: invalid arguments to CreateInductive\n");
+ CG_ERROR("Code generation: invalid arguments to CreateInductive\n");
return NULL;
}
-
-
if (step == NULL) {
- //IntegerLiteral *ilit = new (astContext_)IntegerLiteral(*astContext_, llvm::APInt(32, 1), bint->desugar(), SourceLocation());
- //step = new CG_chillRepr(ilit);
-
chillAST_IntegerLiteral *intlit = new chillAST_IntegerLiteral(1);
step = new CG_chillRepr(intlit);
}
-
- //static_cast<CG_chillRepr*>(index)->printChillNodes();
+ //static_cast<CG_chillRepr*>(index)->printChillNodes();
//static_cast<CG_chillRepr*>(lower)->printChillNodes();
//static_cast<CG_chillRepr*>(upper)->printChillNodes();
//static_cast<CG_chillRepr*>(step )->printChillNodes();
// index should be a DeclRefExpr
std::vector<chillAST_Node*> nodes = static_cast<CG_chillRepr*>(index)->getChillCode();
- //fprintf(stderr, "%d index nodes\n", nodes.size());
chillAST_Node *indexnode = nodes[0];
if (strcmp("DeclRefExpr", indexnode->getTypeString())) {
fprintf(stderr, "CG_chillBuilder::CreateInductive index is not a DeclRefExpr\n");
@@ -420,20 +412,14 @@ namespace omega {
}
nodes = static_cast<CG_chillRepr*>(lower)->getChillCode();
- //fprintf(stderr, "%d lower nodes\n", nodes.size());
chillAST_Node *lowernode = nodes[0];
- //fprintf(stderr, "lower node is %s\n", lowernode->getTypeString());
-
+
nodes = static_cast<CG_chillRepr*>(upper)->getChillCode();
- //fprintf(stderr, "%d upper nodes\n", nodes.size());
chillAST_Node *uppernode = nodes[0];
- //fprintf(stderr, "upper node is %s\n", uppernode->getTypeString());
-
+
nodes = static_cast<CG_chillRepr*>(step)->getChillCode();
- //fprintf(stderr, "%d step nodes\n", nodes.size());
chillAST_Node *stepnode = nodes[0];
- //fprintf(stderr, "step node is %s\n", stepnode->getTypeString());
-
+
// unclear is this will always be the same
// TODO error checking && incr vs decr
chillAST_BinaryOperator *init = new chillAST_BinaryOperator( indexnode, "=", lowernode);
@@ -569,18 +555,15 @@ namespace omega {
// basic int, identifier gen operations
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateInt(int i) const {
- fprintf(stderr, "CG_chillBuilder::CreateInt( %d )\n",i);
- chillAST_IntegerLiteral *il = new chillAST_IntegerLiteral(i); // parent not available
+ chillAST_IntegerLiteral *il = new chillAST_IntegerLiteral(i);
return new CG_chillRepr(il);
}
CG_outputRepr* CG_chillBuilder::CreateFloat(float f) const {
- //fprintf(stderr, "CG_chillBuilder::CreateFloat( %f )\n", f);
- chillAST_FloatingLiteral *fl = new chillAST_FloatingLiteral(f, 1, NULL); // parent not available
+ chillAST_FloatingLiteral *fl = new chillAST_FloatingLiteral(f, 1, NULL);
return new CG_chillRepr(fl);
}
CG_outputRepr* CG_chillBuilder::CreateDouble(double d) const {
- //fprintf(stderr, "CG_chillBuilder::CreateInt( %f )\n",d);
- chillAST_FloatingLiteral *dl = new chillAST_FloatingLiteral(d, 1, NULL); // parent not available
+ chillAST_FloatingLiteral *dl = new chillAST_FloatingLiteral(d, 2, NULL);
return new CG_chillRepr(dl);
}
@@ -594,41 +577,25 @@ namespace omega {
//----------------------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateIdent(const std::string &_s) const {
- fprintf(stderr, "CG_chillBuilder::CreateIdent( %s )\n", _s.c_str());
-
chillAST_VarDecl* already_parameter = symbolTableFindName(symtab_, _s.c_str());
chillAST_VarDecl* already_internal = symbolTableFindName(symtab2_, _s.c_str());
- if ( already_parameter ) {
- fprintf(stderr, "%s was already a parameter??\n", _s.c_str());
- }
- if ( already_internal ) {
- //fprintf(stderr, "%s was already defined in the function body\n", _s.c_str());
- //printSymbolTable(symtab2_); printf("dammit\n"); fflush(stdout);
- }
+ if ( already_parameter )
+ CG_DEBUG_PRINT("%s was already a parameter??\n", _s.c_str());
+ if ( already_internal )
+ CG_DEBUG_PRINT("%s was already defined in the function body\n", _s.c_str());
if ( (!already_parameter) && (! already_internal)) {
- fprintf(stderr, "CG_roseBuilder.cc L919 adding symbol %s to symtab2_ because it was not already there\n", _s.c_str());
-
- //fprintf(stderr, "parameters were: %p\n", symtab_);
- //printSymbolTable( symtab_ );
- //fprintf(stderr, "\nbody symbols were: %p\n", symtab2_);
- //printSymbolTable( symtab2_ );
- //fprintf(stderr, "\n\n");
- //fprintf(stderr, "there were already %d entries in body\n", symtab2_->size());
-
- // this is copying roseBuilder, but is probably wrong. it is assuming
+ CG_DEBUG_PRINT("adding symbol %s to symtab2_ because it was not already there\n", _s.c_str());
+ // this is copying roseBuilder, but is probably wrong. it is assuming
// that the ident is a direct child of the current function
- chillAST_VarDecl *vd = new chillAST_VarDecl( "int", _s.c_str(), "", currentfunction->getBody()); // parent not available TODO
+ chillAST_VarDecl *vd = new chillAST_VarDecl( "int", _s.c_str(), "", currentfunction->getBody());
currentfunction->addVariableToScope( vd ); // use symtab2_ ?
chillAST_DeclRefExpr *dre = new chillAST_DeclRefExpr( "int", _s.c_str(), (chillAST_Node*)vd); // parent not available
- //fprintf(stderr, "made a new chillRepr from "); dre->dump(); fflush(stdout);
return new CG_chillRepr( dre );
}
-
-
// variable was already defined as either a parameter or internal variable to the function.
// NOW WHAT?? gotta return something
@@ -648,72 +615,38 @@ namespace omega {
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreatePlus(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- fprintf(stderr, "CG_chillBuilder::CreatePlus()\n");
-
-
- if(rop == NULL) return lop; // ??
+ if (rop == NULL) return lop;
else if(lop == NULL) return rop;
chillAST_Node *left = ((CG_chillRepr*)lop)->chillnodes[0];
chillAST_Node *right = ((CG_chillRepr*)rop)->chillnodes[0];
- chillAST_BinaryOperator *bop = new chillAST_BinaryOperator( left, "+", right); // parent not available
+ chillAST_BinaryOperator *bop = new chillAST_BinaryOperator( left, "+", right);
return new CG_chillRepr( bop );
- /*
- Expr *lhs = static_cast<CG_chillRepr*>(lop)->GetExpression();
- Expr *rhs = static_cast<CG_chillRepr*>(rop)->GetExpression();
-
- // Not sure about type!!
- fprintf(stderr, "about to die in CG_chillBuilder ~line 628 CREATE PLUS\n");
- BinaryOperator *ins = new (astContext_)BinaryOperator(lhs,
- rhs,
- BO_Add,
- lhs->getType(), // qualifyier type
- VK_LValue, //Expression Value Kind, following the C++11 scheme
- OK_Ordinary, // expression object kind, A further classification of the kind of object referenced by an l-value or x-value.
- SourceLocation(),
- false ); // fpContractable ??
-
- delete lop; delete rop;
-
- //fprintf(stderr, " NEW binary operator 0x%x\n", ins);
- fprintf(stderr, "CG_chillBuilder::CreatePlus ins 0x%x\n", ins);
- return new CG_chillRepr(ins);
- */
}
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateMinus(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- //fprintf(stderr, "CG_chillBuilder::CreateMinus( lop %p rop %p)\n", lop, rop);
- fprintf(stderr, "CG_chillBuilder::CreateMinus()\n");
-
if(rop == NULL) {
- fprintf(stderr, "CG_chillBuilder::CreateMinus(), right side is NULL\n");
- return lop; // from protonu's version.
-
- int *i = 0;
- int j = i[0]; // segfault
+ CG_ERROR("right side is NULL\n");
+ return lop;
}
CG_chillRepr *clop = (CG_chillRepr *) lop;
CG_chillRepr *crop = (CG_chillRepr *) rop;
- if(clop == NULL) { // this is really a unary operator ???
- //fprintf(stderr, "CG_chillBuilder::CreateMinus() unary\n");
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
- chillAST_UnaryOperator *ins = new chillAST_UnaryOperator("-", true, rAST->clone()); // clone?
- delete crop; // ?? note: the chillRepr, not the chillAST_Node
+ if(clop == NULL) {
+ chillAST_Node *rAST = crop->chillnodes[0];
+ chillAST_UnaryOperator *ins = new chillAST_UnaryOperator("-", true, rAST->clone());
+ delete crop;
return new CG_chillRepr(ins);
} else {
- //fprintf(stderr, "binary\n");
- chillAST_Node *lAST = clop->chillnodes[0]; // always just one?
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
- //lAST->print(); printf(" - ");
- //rAST->print(); printf("\n"); fflush(stdout);
-
- chillAST_BinaryOperator *bop = new chillAST_BinaryOperator(lAST->clone(), "-", rAST->clone()); // clone??
+ chillAST_Node *lAST = clop->chillnodes[0];
+ chillAST_Node *rAST = crop->chillnodes[0];
+
+ chillAST_BinaryOperator *bop = new chillAST_BinaryOperator(lAST->clone(), "-", rAST->clone());
- delete clop; delete crop; // ?? note: the chillReprs, not the chillAST_Nodes
+ delete clop; delete crop;
return new CG_chillRepr(bop);
}
}
@@ -722,8 +655,8 @@ namespace omega {
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateTimes(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- fprintf(stderr, "CG_chillBuilder::CreateTimes()\n");
if (rop == NULL || lop == NULL) {
+ CG_ERROR("Operand for times is null\n");
if (rop != NULL) {
rop->clear();
delete rop;
@@ -738,18 +671,11 @@ namespace omega {
CG_chillRepr *clop = (CG_chillRepr *) lop;
CG_chillRepr *crop = (CG_chillRepr *) rop;
- chillAST_Node *lAST = clop->chillnodes[0]; // always just one?
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
-
- fprintf(stderr, "building ");
- lAST->print(0, stderr);
- fprintf(stderr, " * ");
- rAST->print(0, stderr);
- fprintf(stderr, "\n");
-
+ chillAST_Node *lAST = clop->chillnodes[0];
+ chillAST_Node *rAST = crop->chillnodes[0];
+
chillAST_BinaryOperator *binop = new chillAST_BinaryOperator( lAST, "*", rAST);
- delete lop; delete rop; // ??
- //fprintf(stderr, "CG_chillBuilder::CreateTimes() returning a CG_chillRepr with a binop inside\n");
+ delete lop; delete rop;
return new CG_chillRepr( binop );
}
@@ -765,9 +691,8 @@ namespace omega {
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateIntegerDivide(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- //fprintf(stderr, "CG_chillBuilder::CreatIntegerDivide()\n");
if (rop == NULL) {
- fprintf(stderr, "Code generation: divide by NULL\n");
+ CG_ERROR("divide by NULL\n");
return NULL;
}
else if ( lop == NULL ) {
@@ -778,15 +703,9 @@ namespace omega {
CG_chillRepr *clop = (CG_chillRepr *) lop;
CG_chillRepr *crop = (CG_chillRepr *) rop;
- chillAST_Node *lAST = clop->chillnodes[0]; // always just one?
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
-
- //fprintf(stderr, "building ");
- //lAST->print(0, stderr);
- //fprintf(stderr, " / ");
- //rAST->print(0, stderr);
- //fprintf(stderr, " ??\n");
-
+ chillAST_Node *lAST = clop->chillnodes[0];
+ chillAST_Node *rAST = crop->chillnodes[0];
+
chillAST_BinaryOperator *binop = new chillAST_BinaryOperator( lAST, "/", rAST);
delete lop; delete rop; // ??
return new CG_chillRepr( binop );
@@ -795,20 +714,12 @@ namespace omega {
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateIntegerFloor(CG_outputRepr* lop, CG_outputRepr* rop) const {
- //fprintf(stderr, "CG_chillBuilder::CreateIntegerFloor()\n");
-
CG_chillRepr *clop = (CG_chillRepr *) lop;
CG_chillRepr *crop = (CG_chillRepr *) rop;
- chillAST_Node *lAST = clop->chillnodes[0]; // always just one?
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
-
- //fprintf(stderr, "building ");
- //lAST->print(0, stderr);
- //fprintf(stderr, " / ");
- //rAST->print(0, stderr);
- //fprintf(stderr, " ??\n");
-
+ chillAST_Node *lAST = clop->chillnodes[0];
+ chillAST_Node *rAST = crop->chillnodes[0];
+
chillAST_BinaryOperator *binop = new chillAST_BinaryOperator( lAST, "/", rAST);
return new CG_chillRepr( binop );
}
@@ -818,11 +729,7 @@ namespace omega {
//-----------------------------------------------------------------------------
CG_outputRepr* CG_chillBuilder::CreateIntegerMod(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- //fprintf(stderr, "CG_chillBuilder::CreateIntegerMod() NEEDS WORK\n");
- //fprintf(stderr, "LHS "); lop->dump();
- //fprintf(stderr, "RHS "); rop->dump();
-
- CG_chillRepr *l = (CG_chillRepr *) lop;
+ CG_chillRepr *l = (CG_chillRepr *) lop;
CG_chillRepr *r = (CG_chillRepr *) rop;
chillAST_Node *lhs = l->GetCode();
@@ -830,89 +737,31 @@ namespace omega {
chillAST_BinaryOperator *BO = new chillAST_BinaryOperator(lhs, "%", rhs );
return new CG_chillRepr(BO);
-
- /*
- if (rop == NULL || lop == NULL) {
- return NULL;
- }
-
- Expr *op1 = static_cast<CG_chillRepr*>(lop)->GetExpression();
- Expr *op2 = static_cast<CG_chillRepr*>(rop)->GetExpression();
-
- // Not sure about type!!
- fprintf(stderr, "gonna die in CG_chillBuilder.cc ~line 394\n");
- BinaryOperator *ins = NULL; // new (astContext_)BinaryOperator(op1, op2, BO_Rem, op1->getType(), SourceLocation());
-
- delete lop; delete rop;
- return new CG_chillRepr(ins);
- */
}
-
-
-
- //-----------------------------------------------------------------------------
+
CG_outputRepr *CG_chillBuilder::CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const {
return CreateMinus(NULL, CreateIntegerFloor(CreateMinus(NULL, lop), rop));
}
-
-
-
- //-----------------------------------------------------------------------------
- // binary logical operations
- //-----------------------------------------------------------------------------
+
CG_outputRepr* CG_chillBuilder::CreateAnd(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- fprintf(stderr, "CG_chillBuilder::CreateAnd()\n");
if (rop == NULL)
return lop;
else if (lop == NULL)
return rop;
-
- /* if (rop == NULL || lop == NULL ) {
- fprintf(stderr, "returning NULL!\n");
- return NULL;
- }*/
-
+
CG_chillRepr *clop = (CG_chillRepr *) lop;
CG_chillRepr *crop = (CG_chillRepr *) rop;
- chillAST_Node *lAST = clop->chillnodes[0]; // always just one?
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
-
- //fprintf(stderr, "building ");
- //lAST->print(0, stderr);
- //fprintf(stderr, " && ");
- //rAST->print(0, stderr);
- //fprintf(stderr, " ??\n");
-
+ chillAST_Node *lAST = clop->chillnodes[0];
+ chillAST_Node *rAST = crop->chillnodes[0];
+
chillAST_BinaryOperator *binop = new chillAST_BinaryOperator( lAST, "&&", rAST);
return new CG_chillRepr( binop );
}
-
-
- //-----------------------------------------------------------------------------
- // binary relational operations
- //-----------------------------------------------------------------------------
- // CG_outputRepr* CG_chillBuilder::CreateGE(CG_outputRepr *lop, // use the outputBuilder version
- // CG_outputRepr *rop) const {
- //
- // Expr *op1 = static_cast<CG_chillRepr*>(lop)->GetExpression();
- // Expr *op2 = static_cast<CG_chillRepr*>(rop)->GetExpression();
-
- // Not sure about type!!
- // fprintf(stderr, "about to die in CG_chillBuilder ~line 480\n");
-
- // BinaryOperator *ins = NULL; // new (astContext_)BinaryOperator(op1, op2, BO_GE, op1->getType(), SourceLocation());
-
- // delete lop; delete rop;
- // return new CG_chillRepr(ins);
- // }
-
-
- //-----------------------------------------------------------------------------
+
CG_outputRepr* CG_chillBuilder::CreateLE(CG_outputRepr *lop,
CG_outputRepr *rop) const {
- //fprintf(stderr, "CG_chillBuilder::CreateLE()\n");
if (rop == NULL || lop == NULL) {
return NULL;
}
@@ -920,15 +769,9 @@ namespace omega {
CG_chillRepr *clop = (CG_chillRepr *) lop;
CG_chillRepr *crop = (CG_chillRepr *) rop;
- chillAST_Node *lAST = clop->chillnodes[0]; // always just one?
- chillAST_Node *rAST = crop->chillnodes[0]; // always just one?
-
- //fprintf(stderr, "building ");
- //lAST->print(0, stderr);
- //fprintf(stderr, " <= ");
- //rAST->print(0, stderr);
- //fprintf(stderr, " ??\n");
-
+ chillAST_Node *lAST = clop->chillnodes[0];
+ chillAST_Node *rAST = crop->chillnodes[0];
+
chillAST_BinaryOperator *binop = new chillAST_BinaryOperator( lAST, "<=", rAST);
delete lop; delete rop; // ??
return new CG_chillRepr( binop );
diff --git a/lib/codegen/src/CG.cc b/lib/codegen/src/CG.cc
index 5d903c4..3b46c72 100755
--- a/lib/codegen/src/CG.cc
+++ b/lib/codegen/src/CG.cc
@@ -34,6 +34,7 @@
#include <code_gen/codegen_error.h>
#include <stack>
#include <string.h>
+#include <code_gen/CGdebug.h>
namespace omega {
@@ -55,7 +56,6 @@ namespace omega {
const std::vector<CG_outputRepr *> &stmts,
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > uninterpreted_symbols,
bool printString) const {
- fprintf(stderr, "\nCG_result::printRepr(ocg, stmts) \n");
//Anand: making a tweak to allocate twice the original number of dynamically allocated variables
//for use with Uninterpreted function symbols
@@ -67,7 +67,7 @@ namespace omega {
int num_unin = uninterpreted_symbols.size();
int num_active = active_.size();
if (num_unin < num_active) {
- fprintf(stderr, "CG.cc CG_result::printRepr(), not enough uninterpreted symbols (%d) for active statements (5d)\n", num_unin, num_active);
+ CG_ERROR("not enough uninterpreted symbols (%d) for active statements (%d)\n", num_unin, num_active);
exit(-1);
}
@@ -80,7 +80,6 @@ namespace omega {
int num_levels = num_level();
for (int s = 0; s < active_.size(); s++) {
- fprintf(stderr, "\ns %d\n", s);
std::vector<std::string> loop_vars;
if (active_.get(s)) {
@@ -166,8 +165,6 @@ namespace omega {
//--end
#endif
-
- fprintf(stderr, "\n\n\n\nprintRepr recursing ??? return printRepr( ... )\n");
return printRepr(1, ocg, stmts, aotf, uninterpreted_symbols, printString);
}
@@ -176,11 +173,9 @@ namespace omega {
std::string CG_result::printString(
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > uninterpreted_symbols) const {
- fprintf(stderr, "CG.cc line 164, CG_result::printString()\n");
CG_stringBuilder ocg;
std::vector<CG_outputRepr *> stmts(codegen_->xforms_.size());
- fprintf(stderr, "stmts.size() %d\n", stmts.size());
for (int i = 0; i < stmts.size(); i++)
stmts[i] = new CG_stringRepr("s" + to_string(i));
@@ -194,7 +189,6 @@ namespace omega {
if (repr != NULL) {
std::string s = repr->GetString();
- //fprintf(stderr, "\nCG.cc L197 repr->GetString() = '%s'\n\n\n", s.c_str());
delete repr;
return s;
} else
@@ -313,7 +307,7 @@ namespace omega {
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > unin,
bool printString) const {
- fprintf(stderr, "CG_split::printRepr()\n");
+ CG_DEBUG_PRINT("CG_split::printRepr()\n");
int numfly = assigned_on_the_fly.size();
//fprintf(stderr, "assigned on the fly %d\n", numfly );
//for (int i=0; i<numfly; i++) {
@@ -377,7 +371,6 @@ namespace omega {
}
CG_result *CG_split::clone() const {
- //fprintf(stderr, "CG_split::clone()\n");
std::vector<CG_result *> clauses(clauses_.size());
for (int i = 0; i < clauses_.size(); i++)
clauses[i] = clauses_[i]->clone();
@@ -478,7 +471,7 @@ namespace omega {
}
// loop iterates more than once, extract bounds now
else {
- fprintf(stderr, "loop iterates more than once, extract bounds now\n");
+ CG_DEBUG_PRINT("loop iterates more than once, extract bounds now\n");
needLoop_ = true;
bounds_ = Relation(hull.n_set());
@@ -1100,8 +1093,6 @@ namespace omega {
const std::vector<CG_outputRepr *> &stmts,
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > unin, bool printString) const {
-
- fprintf(stderr, "CG_loop::printRepr() w assigned_on_the_fly gonna call printRepr with more arguments\n");
//int numfly = assigned_on_the_fly.size();
//fprintf(stderr, "assigned on the fly %d\n", numfly );
//for (int i=0; i<numfly; i++) {
@@ -1112,7 +1103,6 @@ namespace omega {
// int val = p.second;
// //fprintf(stderr, "0x%x %d\n", tr, val);
//}
-
return printRepr(true, indent, ocg, stmts, assigned_on_the_fly, unin, printString);
}
@@ -1125,19 +1115,12 @@ namespace omega {
CG_outputBuilder *ocg, const std::vector<CG_outputRepr *> &stmts,
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > unin, bool printString) const {
- fprintf(stderr, "\n*** CG.cc CG_loop printrepr with more arguments\n");
-
-
- // debugging output
- int numfly = assigned_on_the_fly.size();
- fprintf(stderr, "assigned on the fly %d\n", numfly ); // Anand makes twice as many
- for (int i=0; i<numfly; i++) {
- //fprintf(stderr, "i %d\n", i);
+ int numfly = assigned_on_the_fly.size(); // Anand makes twice as many
+ for (int i=0; i<numfly; i++) {
std::pair<CG_outputRepr *, int>p = assigned_on_the_fly[i];
CG_outputRepr *tr = NULL;
if (p.first != NULL) tr = p.first->clone();
int val = p.second;
- //fprintf(stderr, "0x%x %d\n", tr, val);
}
//Anand: adding support for Replacing substituted variables within
@@ -1157,36 +1140,24 @@ namespace omega {
else
guardRepr = NULL;
- fprintf(stderr, "after guard assigned on the fly %d\n", numfly );
- for (int i=0; i<numfly; i++) {
- //fprintf(stderr, "i %d\n", i);
+ for (int i=0; i<numfly; i++) {
std::pair<CG_outputRepr *, int>p = assigned_on_the_fly[i];
CG_outputRepr *tr = NULL;
if (p.first != NULL) tr = p.first->clone();
int val = p.second;
- //fprintf(stderr, "0x%x %d\n", tr, val);
}
- fprintf(stderr, "done flying\n");
Relation cur_known = Intersection(copy(known_), copy(guard_));
cur_known.simplify();
- fprintf(stderr, "checking needloop\n");
if (needLoop_) {
- fprintf(stderr, "needLoop_\n");
-
if (checkLoopLevel)
if (level_ == checkLoopLevel)
if (active_.get(stmtForLoopCheck))
fillInBounds = true;
-
- fprintf(stderr, "ctrlRepr = output_loop()\n");
CG_outputRepr *ctrlRepr = output_loop(ocg, bounds_, level_, cur_known,
aotf, unin[stmt_num]);
-
fillInBounds = false;
-
- fprintf(stderr, "in needLoop_ bodyrepr = \n");
int ind = (guardRepr == NULL) ? indent + 1 : indent + 2;
CG_outputRepr *bodyRepr = body_->printRepr(ind,
ocg,
@@ -1203,7 +1174,6 @@ namespace omega {
if (!smtNonSplitLevels.empty()) {
- fprintf(stderr, "!smtNonSplitLevels.empty()\n");
bool blockLoop = false;
bool threadLoop = false;
bool sync = false;
@@ -1231,24 +1201,24 @@ namespace omega {
}
}
if (blockLoop && threadLoop) {
- fprintf(stderr,
- "Warning, have %d level more than once in smtNonSplitLevels\n",
- level_);
+ CG_DEBUG_PRINT("Warning, have %d level more than once in smtNonSplitLevels\n", level_);
threadLoop = false;
}
std::string preferredIdx;
- fprintf(stderr, "loopIdxNames.size() %d\n", loopIdxNames.size());
- for (int i=0; i<loopIdxNames.size(); i++) {
- fprintf(stderr, "\n");
- for (int j=0; j<loopIdxNames[i].size(); j++) {
- fprintf(stderr, "i %d j %d %s\n", i, j,loopIdxNames[i][j].c_str() );
+ CG_DEBUG_BEGIN
+ fprintf(stderr, "loopIdxNames.size() %d\n", loopIdxNames.size());
+ for (int i=0; i<loopIdxNames.size(); i++) {
+ fprintf(stderr, "\n");
+ for (int j=0; j<loopIdxNames[i].size(); j++) {
+ fprintf(stderr, "i %d j %d %s\n", i, j,loopIdxNames[i][j].c_str() );
+ }
}
- }
- fprintf(stderr, "firstActiveStmt %d\n", firstActiveStmt);
- fprintf(stderr, "loopIdxNames[firstActiveStmt].size() %d\n", loopIdxNames[firstActiveStmt].size());
- fprintf(stderr, "level_ %d /2 %d\n", level_, level_/2);
+ fprintf(stderr, "firstActiveStmt %d\n", firstActiveStmt);
+ fprintf(stderr, "loopIdxNames[firstActiveStmt].size() %d\n", loopIdxNames[firstActiveStmt].size());
+ fprintf(stderr, "level_ %d /2 %d\n", level_, level_/2);
+ CG_DEBUG_END
if (loopIdxNames.size()
&& (level_ / 2) - 1 < loopIdxNames[firstActiveStmt].size()) {
@@ -1306,40 +1276,23 @@ namespace omega {
return ocg->CreateIf(indent, guardRepr, loopRepr, NULL);
}
else {
- fprintf(stderr, "NOT needloop_\n");
-
+ CG_DEBUG_PRINT("NOT needloop_\n");
std::pair<CG_outputRepr *, std::pair<CG_outputRepr *, int> > result =
output_assignment(ocg, bounds_, level_, cur_known, aotf, unin[stmt_num]);
-
- //fprintf(stderr, "RESULT 0x%x 0x%x %d\n", result.first, result.second.first, result.second.second );
-
-
guardRepr = ocg->CreateAnd(guardRepr, result.first);
- //fprintf(stderr, "RESULT 0x%x 0x%x %d\n", result.first, result.second.first, result.second.second );
-
- //fprintf(stderr, "after guardRepr assigned on the fly %d\n", numfly );
- for (int i=0; i<numfly; i++) {
- //fprintf(stderr, "i %d\n", i);
+ for (int i=0; i<numfly; i++) {
std::pair<CG_outputRepr *, int>p = assigned_on_the_fly[i];
CG_outputRepr *tr = NULL;
if (p.first != NULL) tr = p.first->clone();
int val = p.second;
- //fprintf(stderr, "0x%x %d\n", tr, val);
- }
-
-
+ }
if (result.second.second < CodeGen::var_substitution_threshold) {
- //fprintf(stderr, "var_substitution_threshold %d < %d level_ = %d\n", result.second.second, CodeGen::var_substitution_threshold, level_);
std::vector<std::pair<CG_outputRepr *, int> > aotf =
assigned_on_the_fly;
aotf[level_ - 1] = result.second;
- //fprintf(stderr, "RESULT 0x%x second 0x%x %d\n", result.first, result.second.first, result.second.second );
-
if(!printString) {
for (std::map<std::string, std::vector<CG_outputRepr *> >::iterator i =
unin[stmt_num].begin(); i != unin[stmt_num].end(); i++) {
-
-
std::vector<CG_outputRepr *> to_push;
for (int j = 0; j < i->second.size(); j++) {
std::string index =
@@ -1356,18 +1309,13 @@ namespace omega {
} // for
} // if
- //fprintf(stderr, "aotf !!\n");
- for (int i=0; i<numfly; i++) {
- //fprintf(stderr, "i %d\n", i);
+ for (int i=0; i<numfly; i++) {
std::pair<CG_outputRepr *, int>p = aotf[i];
CG_outputRepr *tr = NULL;
if (p.first != NULL) { tr = p.first->clone(); }
int val = p.second;
}
-
- //fprintf(stderr, "\nbodyRepr =\n");
- //body_->dump(); // this dies
- int ind = (guardRepr == NULL) ? indent : indent + 1;
+ int ind = (guardRepr == NULL) ? indent : indent + 1;
CG_outputRepr *bodyRepr = body_->printRepr(ind, ocg, stmts, aotf, unin,
printString);
@@ -1377,7 +1325,6 @@ namespace omega {
else
return ocg->CreateIf(indent, guardRepr, bodyRepr, NULL);
} else {
- //fprintf(stderr, "NOT var_substitution_threshold gonna call output_ident()\n");
int ind = (guardRepr == NULL) ? indent : indent + 1;
CG_outputRepr *assignRepr = ocg->CreateAssignment(
ind,
@@ -1394,102 +1341,6 @@ namespace omega {
else
return ocg->CreateIf(indent, guardRepr,
ocg->StmtListAppend(assignRepr, bodyRepr), NULL);
-
- /* DEAD CODE
- std::pair<EQ_Handle, int> result_ = find_simplest_assignment(
- copy(bounds_), copy(bounds_).set_var(level_),
- assigned_on_the_fly);
- bool found_func = false;
- Variable_ID v2;
- int arity;
- for (Constr_Vars_Iter cvi(result_.first); cvi; cvi++)
- if (cvi.curr_var()->kind() == Global_Var) {
- Global_Var_ID g = cvi.curr_var()->get_global_var();
- if ((g->arity() > 0)) {
-
- found_func = true;
- arity = g->arity();
- //copy(R).print();
- v2 = copy(bounds_).get_local(g,
- cvi.curr_var()->function_of());
-
- break;
- }
- }
-
- bool is_array = false;
- if (found_func) {
-
- is_array = ocg->QueryInspectorType(
- v2->get_global_var()->base_name());
-
- }
- if (!found_func || !is_array) {
-
- CG_outputRepr *assignRepr = ocg->CreateAssignment(
- (guardRepr == NULL) ? indent : indent + 1,
- output_ident(ocg, bounds_,
- const_cast<CG_loop *>(this)->bounds_.set_var(
- level_), assigned_on_the_fly),
- result.second.first);
-
- CG_outputRepr *bodyRepr = body_->printRepr(
- (guardRepr == NULL) ? indent : indent + 1, ocg, stmts,
- assigned_on_the_fly);
- if (guardRepr == NULL)
- return ocg->StmtListAppend(assignRepr, bodyRepr);
- else
- return ocg->CreateIf(indent, guardRepr,
- ocg->StmtListAppend(assignRepr, bodyRepr), NULL);
-
- } else {
-
- std::vector<CG_outputRepr *> index_expr;
-
- CG_outputRepr* lb = ocg->CreateArrayRefExpression(
- v2->get_global_var()->base_name(),
- output_ident(ocg, bounds_,
- const_cast<CG_loop *>(this)->bounds_.set_var(2),
- assigned_on_the_fly));
-
- for (int i = arity; i > 1; i--) {
-
- index_expr.push_back(
- ocg->CreateArrayRefExpression(
- v2->get_global_var()->base_name(),
- output_ident(ocg, bounds_,
- const_cast<CG_loop *>(this)->bounds_.set_var(
- 2 * i),
- assigned_on_the_fly)));
-
- //}
-
- }
-
- CG_outputRepr *ub;
- if (index_expr.size() > 1)
- ub = ocg->CreateInvoke("max", index_expr);
- else
- ub = index_expr[0];
- CG_outputRepr *le = ocg->CreateMinus(ub, ocg->CreateInt(1));
- CG_outputRepr *inductive = ocg->CreateInductive(
- output_ident(ocg, bounds_,
- const_cast<CG_loop *>(this)->bounds_.set_var(
- level_), assigned_on_the_fly), lb, le,
- NULL);
-
- CG_outputRepr *bodyRepr = body_->printRepr(
- (guardRepr == NULL) ? indent : indent + 1, ocg, stmts,
- assigned_on_the_fly);
-
- if (guardRepr == NULL) {
- return ocg->CreateLoop(indent, inductive, bodyRepr);
- } else
- return ocg->CreateIf(indent, guardRepr,
- ocg->CreateLoop(indent + 1, inductive, bodyRepr),
- NULL);
- }
- */
}
}
}
@@ -1531,7 +1382,6 @@ namespace omega {
CG_result *CG_loop::clone() const {
- //fprintf(stderr, "CG_loop::clone()\n");
return new CG_loop(codegen_, active_, level_, body_->clone());
}
@@ -1658,16 +1508,12 @@ namespace omega {
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > unin,
bool printString) const {
- fprintf(stderr, "CG_leaf::printRepr()\n");
int numfly = assigned_on_the_fly.size();
- //fprintf(stderr, "assigned on the fly %d\n", numfly );
- for (int i=0; i<numfly; i++) {
- //fprintf(stderr, "i %d\n", i);
+ for (int i=0; i<numfly; i++) {
std::pair<CG_outputRepr *, int>p = assigned_on_the_fly[i];
CG_outputRepr *tr = NULL;
if (p.first != NULL) tr = p.first->clone();
int val = p.second;
- //fprintf(stderr, "0x%x %d\n", tr, val);
}
return leaf_print_repr(active_, guards_, NULL, known_, indent, ocg,
@@ -1678,7 +1524,6 @@ namespace omega {
CG_result *CG_leaf::clone() const {
- //fprintf(stderr, "CG_leaf::clone()\n");
return new CG_leaf(codegen_, active_);
}
diff --git a/lib/codegen/src/CG_utils.cc b/lib/codegen/src/CG_utils.cc
index 19bb6c9..95f94ec 100755
--- a/lib/codegen/src/CG_utils.cc
+++ b/lib/codegen/src/CG_utils.cc
@@ -22,6 +22,7 @@
#include <code_gen/codegen_error.h>
#include <math.h>
#include <stack>
+#include <code_gen/CGdebug.h>
namespace omega {
@@ -274,36 +275,29 @@ namespace omega {
Variable_ID v,
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin) {
- fprintf(stderr, "output_ident( %s )\n", v->name().c_str());
+ CG_DEBUG_PRINT("output_ident( %s )\n", v->name().c_str());
const_cast<Relation &>(R).setup_names(); // hack
if (v->kind() == Input_Var) {
int pos = v->get_position();
if (assigned_on_the_fly[pos - 1].first != NULL) {
- //fprintf(stderr, "on the fly pos=%d\n", pos);
CG_outputRepr *tmp = assigned_on_the_fly[pos-1].first->clone();
- //fprintf(stderr, "tmp on the fly (0x%x)\n", tmp);
return tmp;
}
else {
- //fprintf(stderr, "creating Ident for %s\n", v->name().c_str());
CG_outputRepr *tmp = ocg->CreateIdent(v->name());
- //fprintf(stderr, "ident created for %s\n", v->name().c_str());
return tmp;
}
}
else if (v->kind() == Global_Var) {
- //fprintf(stderr, "CG_utils.cc output_ident() Global_Var\n");
if (v->get_global_var()->arity() == 0) {
- //fprintf(stderr, "arity 0\n");
return ocg->CreateIdent(v->name());
}
else {
/* This should be improved to take into account the possible elimination
of the set variables. */
int arity = v->get_global_var()->arity();
- //fprintf(stderr, "arity %dn", arity );
std::vector<CG_outputRepr *> argList;
if (unin.find(v->get_global_var()->base_name()) != unin.end()) {
@@ -363,19 +357,14 @@ namespace omega {
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin) {
- //fprintf(stderr, "output_assignment( )\n");
int numfly = assigned_on_the_fly.size();
- //fprintf(stderr, "assigned on the fly %d\n", numfly );
- for (int i=0; i<numfly; i++) {
- //fprintf(stderr, "i %d\n", i);
+ for (int i=0; i<numfly; i++) {
std::pair<CG_outputRepr *, int>p = assigned_on_the_fly[i];
CG_outputRepr *tr = NULL;
if (p.first != NULL) tr = p.first->clone();
int val = p.second;
- //fprintf(stderr, "0x%x %d\n", tr, val);
}
-
-
+
Variable_ID v = const_cast<Relation &>(R).set_var(level);
Conjunct *c = const_cast<Relation &>(R).single_conjunct();
@@ -650,9 +639,6 @@ namespace omega {
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin) {
std::vector<CG_outputRepr *> subs;
-
- fprintf(stderr, "CG_utils.cc output_substitutions()\n");
-
for (int i = 1; i <= R.n_out(); i++) {
Relation mapping(R.n_out(), 1);
F_And *f_root = mapping.add_and();
@@ -665,16 +651,13 @@ namespace omega {
Variable_ID v = r.output_var(1);
CG_outputRepr *repr = NULL;
- fprintf(stderr, "v %s\n", v->char_name());
std::pair<EQ_Handle, int> result = find_simplest_assignment(r, v, assigned_on_the_fly);
if (result.second < INT_MAX) {
- //fprintf(stderr, "output_substitutions() calling output_substitution_repr()\n");
- repr = output_substitution_repr(ocg, result.first, v, true, r,
+ repr = output_substitution_repr(ocg, result.first, v, true, r,
assigned_on_the_fly, unin);
- if (repr == NULL) fprintf(stderr, "IN IF, repr for %s assigned NULL\n", v->char_name());
+ if (repr == NULL) CG_ERROR("IN IF, repr for %s assigned NULL\n", v->char_name());
}
else {
- //fprintf(stderr, "else\n");
std::pair<bool, GEQ_Handle> result = find_floor_definition(R, v);
if (result.first)
try {
@@ -685,7 +668,7 @@ namespace omega {
}
}
- if (repr == NULL) fprintf(stderr, "repr NULL\n");
+ if (repr == NULL) CG_ERROR("repr NULL\n");
if (repr != NULL) {
subs.push_back(repr);
}
@@ -699,7 +682,7 @@ namespace omega {
//h.update_coef(mapping1.input_var(i), -1);
//Relation r = Composition(mapping1, copy(mapping));
//r.simplify();
-
+
Relation r = copy(R);
Variable_ID v = r.output_var(k);
@@ -718,7 +701,7 @@ namespace omega {
Variable_ID v1 = cvi.curr_var();
if (v1->kind() == Input_Var)
variables.push_back(v1);
-
+
}
*/
repr_ = output_substitution_repr(ocg, result.first, v, true,
@@ -839,8 +822,6 @@ namespace omega {
} // for int k
}
}
-
- fprintf(stderr, "CG_utils.cc output_substitutions() DONE\n\n");
return subs;
}
@@ -1195,7 +1176,6 @@ namespace omega {
const Relation &R,
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin) {
- fprintf(stderr, "output_guard()\n");
assert(R.n_out()==0);
CG_outputRepr *result = NULL;
@@ -1204,7 +1184,6 @@ namespace omega {
// e.g. 4i=5*j
for (EQ_Iterator e = c->EQs(); e; e++)
if (!(*e).has_wildcards()) {
- //fprintf(stderr, "EQ\n");
CG_outputRepr *lhs = NULL;
CG_outputRepr *rhs = NULL;
for (Constr_Vars_Iter cvi(*e); cvi; cvi++) {
@@ -1509,8 +1488,6 @@ namespace omega {
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin,
std::set<Variable_ID> excluded_floor_vars) {
- fprintf(stderr, "output_inequality_repr() v %s\n", v->name().c_str());
-
const_cast<Relation &>(R).setup_names(); // hack
coef_t a = inequality.get_coef(v);
@@ -1527,12 +1504,9 @@ namespace omega {
cvi.curr_var(),
excluded_floor_vars);
if (!result.first) {
- fprintf(stderr, "\n\n*** heading into NEW CODE\n");
-
coef_t coef_ = cvi.curr_coef();
result2 = find_floor_definition_temp(R, cvi.curr_var(),
excluded_floor_vars);
-
for (Constr_Vars_Iter cvi_(
result2[result2.size() - 1].second); cvi_; cvi_++) {
if (cvi_.curr_var()->kind() != Wildcard_Var
@@ -1545,8 +1519,6 @@ namespace omega {
ocg->CreateInt(-coef_));
repr = ocg->CreateTimes(ocg->CreateInt(-coef_),
repr);
-
- fprintf(stderr, "returning a TIMES\n");
return repr;
}
@@ -1667,8 +1639,6 @@ namespace omega {
const Relation &known,
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin) {
-
- fprintf(stderr, "output_lower_bound_repr()\n");
assert(inequality.get_coef(v) > 0);
CG_outputRepr* zero_;
if (wc == NULL
@@ -1772,11 +1742,7 @@ namespace omega {
const Relation &known,
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::map<std::string, std::vector<CG_outputRepr *> > unin) {
-
- fprintf(stderr, "CG_utils.cc output_loop()\n");
std::pair<EQ_Handle, Variable_ID> result = find_simplest_stride(R, const_cast<Relation &>(R).set_var(level));
- fprintf(stderr, "found stride\n");
-
if (result.second != NULL)
assert(abs(result.first.get_coef(const_cast<Relation &>(R).set_var(level))) == 1);
@@ -1788,19 +1754,14 @@ namespace omega {
for (GEQ_Iterator e(const_cast<Relation &>(R).single_conjunct()->GEQs());
e;
e++) {
- fprintf(stderr, "new e\n");
coef_t coef = (*e).get_coef(const_cast<Relation &>(R).set_var(level));
-
- fprintf(stderr, "coef %d\n", coef);
if (coef > 0) {
CG_outputRepr *repr = output_lower_bound_repr(ocg, *e, const_cast<Relation &>(R).set_var(level), result.first, result.second, R, known, assigned_on_the_fly, unin);
- fprintf(stderr, "got a repr\n");
- if (repr == NULL) fprintf(stderr, "repr NULL\n");
-
- if (repr == NULL)
+ if (repr == NULL) {
+ CG_ERROR("NULL lowerbound, assumed zero\n");
repr = ocg->CreateInt(0);
+ }
lbList.push_back(repr);
-
if ((*e).is_const(const_cast<Relation &>(R).set_var(level))){
if(!result.second) {
@@ -2604,10 +2565,6 @@ namespace omega {
const std::vector<std::pair<CG_outputRepr *, int> > &assigned_on_the_fly,
std::vector<std::map<std::string, std::vector<CG_outputRepr *> > > unin) {
- fprintf(stderr, "loop_print_repr() guard_repr ");
- if (guard_repr == NULL) fprintf(stderr, "NULL\n");
- else fprintf(stderr, "NOT NULL\n");
-
if (start >= end)
return NULL;
@@ -2628,9 +2585,7 @@ namespace omega {
stmts,
assigned_on_the_fly,
unin));
-
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive\n");
- stmt_list = ocg->StmtListAppend(stmt_list,
+ stmt_list = ocg->StmtListAppend(stmt_list,
loop_print_repr(active,
loops,
i,
@@ -2644,12 +2599,9 @@ namespace omega {
stmts,
assigned_on_the_fly,
unin));
-
- //fprintf(stderr, "guard_repr 0x%x\n", guard_repr);
if (guard_repr == NULL)
return stmt_list;
else {
- fprintf(stderr, "CG_utils.cc loop_print_repr() CreateIf()\n");
return ocg->CreateIf(indent, guard_repr, stmt_list, NULL);
}
}
@@ -2682,8 +2634,7 @@ namespace omega {
guard_repr = ocg->CreateAnd(guard_repr, new_guard_repr);
Relation new_guard = Intersection(copy(guard), copy(then_cond));
new_guard.simplify();
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive 2\n");
- return loop_print_repr(active, loops, start, end, new_guard, guard_repr,
+ return loop_print_repr(active, loops, start, end, new_guard, guard_repr,
indent, remap, xforms, ocg, stmts, aotf, unin);
}
else if (j == i && end > j) {
@@ -2694,9 +2645,7 @@ namespace omega {
new_guard.simplify();
new_guard.print(stderr);
new_guard.print_with_subs(stderr);
-
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive 3\n");
- CG_outputRepr *stmt_list = loop_print_repr(active,
+ CG_outputRepr *stmt_list = loop_print_repr(active,
loops,
start,
i,
@@ -2709,9 +2658,7 @@ namespace omega {
stmts,
aotf,
unin);
-
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive 4\n");
- stmt_list = ocg->StmtListAppend(stmt_list,
+ stmt_list = ocg->StmtListAppend(stmt_list,
loop_print_repr(active,
loops,
j,
@@ -2729,7 +2676,6 @@ namespace omega {
if (guard_repr == NULL)
return stmt_list;
else {
- fprintf(stderr, "CG_utils.cc loop_print_repr() CreateIf() 2\n");
return ocg->CreateIf(indent, guard_repr, stmt_list, NULL);
}
}
@@ -2737,8 +2683,6 @@ namespace omega {
int new_indent = (guard_repr==NULL)?indent:indent+1;
Relation then_new_guard = Intersection(copy(guard), copy(then_cond));
then_new_guard.simplify();
-
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive 5\n");
CG_outputRepr *then_stmt_list = loop_print_repr(active,
loops,
start,
@@ -2755,8 +2699,6 @@ namespace omega {
Relation else_new_guard = Intersection(copy(guard), copy(else_cond));
else_new_guard.simplify();
-
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive 6\n");
CG_outputRepr *else_stmt_list = loop_print_repr(active,
loops,
i,
@@ -2770,15 +2712,11 @@ namespace omega {
stmts,
aotf,
unin);
-
- fprintf(stderr, "CG_utils.cc loop_print_repr() CreateIf() 3\n");
- CG_outputRepr *stmt_list = ocg->CreateIf(new_indent,
+ CG_outputRepr *stmt_list = ocg->CreateIf(new_indent,
new_guard_repr,
then_stmt_list,
else_stmt_list);
-
- fprintf(stderr,"CG_utils.cc loop_print_repr recursive 7\n");
- stmt_list = ocg->StmtListAppend(stmt_list,
+ stmt_list = ocg->StmtListAppend(stmt_list,
loop_print_repr(active,
loops,
j,
@@ -2797,7 +2735,6 @@ namespace omega {
if (guard_repr == NULL)
return stmt_list;
else {
- fprintf(stderr, "CG_utils.cc loop_print_repr() CreateIf() 4\n");
return ocg->CreateIf(indent, guard_repr, stmt_list, NULL);
}
}