diff --git a/expr.cpp b/expr.cpp index c7cd1522..aed5d45c 100644 --- a/expr.cpp +++ b/expr.cpp @@ -128,6 +128,9 @@ Expr::ReplacePolyType(const PolyType *polyType, const Type *replacement) { case ConstExprID: copy = (Expr*)new ConstExpr(*(ConstExpr*)this); break; + case SymbolExprID: + copy = (Expr*)new SymbolExpr(*(SymbolExpr*)this); + break; case PtrDerefExprID: copy = (Expr*)new PtrDerefExpr(*(PtrDerefExpr*)this); break; @@ -8138,6 +8141,7 @@ SymbolExpr::Optimize() { return this; } +/* Expr * SymbolExpr::ReplacePolyType(const PolyType *from, const Type *to) { if (!symbol) @@ -8145,7 +8149,7 @@ SymbolExpr::ReplacePolyType(const PolyType *from, const Type *to) { SymbolExpr *copy = new SymbolExpr(this); - copy->symbol = new Symbol(*symbol); + //copy->symbol = new Symbol(*symbol); if (Type::EqualForReplacement(symbol->type->GetBaseType(), from)) { copy->symbol->type = PolyType::ReplaceType(symbol->type, to); @@ -8153,6 +8157,7 @@ SymbolExpr::ReplacePolyType(const PolyType *from, const Type *to) { return copy; } +*/ int diff --git a/expr.h b/expr.h index 65dc1236..9ee9710d 100644 --- a/expr.h +++ b/expr.h @@ -691,7 +691,7 @@ public: Symbol *GetBaseSymbol() const; Expr *TypeCheck(); Expr *Optimize(); - Expr *ReplacePolyType(const PolyType *from, const Type *to); + //Expr *ReplacePolyType(const PolyType *from, const Type *to); void Print() const; int EstimateCost() const; diff --git a/func.cpp b/func.cpp index 8776a9fc..da7ba0ca 100644 --- a/func.cpp +++ b/func.cpp @@ -127,6 +127,7 @@ Function::Function(Symbol *s, Stmt *c) { const FunctionType *type = CastType(sym->type); Assert(type != NULL); + printf("Function %s symbol types: ", sym->name.c_str()); for (int i = 0; i < type->GetNumParameters(); ++i) { const char *paramName = type->GetParameterName(i).c_str(); Symbol *sym = m->symbolTable->LookupVariable(paramName); @@ -135,9 +136,14 @@ Function::Function(Symbol *s, Stmt *c) { args.push_back(sym); const Type *t = type->GetParameterType(i); + printf(" %s: %s==%s, ", sym->name.c_str(), + t->GetString().c_str(), + sym->type->GetString().c_str()); + if (sym != NULL && CastType(t) == NULL) sym->parentFunction = this; } + printf("\n"); if (type->isTask #ifdef ISPC_NVPTX_ENABLED diff --git a/stmt.cpp b/stmt.cpp index e8841a87..0e116dba 100644 --- a/stmt.cpp +++ b/stmt.cpp @@ -105,6 +105,9 @@ Stmt::ReplacePolyType(const PolyType *polyType, const Type *replacement) { case ExprStmtID: copy = (Stmt*)new ExprStmt(*(ExprStmt*)this); break; + case ForeachStmtID: + copy = (Stmt*)new ForeachStmt(*(ForeachStmt*)this); + break; case ForeachActiveStmtID: copy = (Stmt*)new ForeachActiveStmt(*(ForeachActiveStmt*)this); break; @@ -1557,6 +1560,7 @@ ForeachStmt::ForeachStmt(const std::vector &lvs, stmts(s) { } +/* ForeachStmt::ForeachStmt(ForeachStmt *base) : Stmt(base->pos, ForeachStmtID) { dimVariables = base->dimVariables; @@ -1565,6 +1569,7 @@ ForeachStmt::ForeachStmt(ForeachStmt *base) isTiled = base->isTiled; stmts = base->stmts; } +*/ /* Given a uniform counter value in the memory location pointed to by @@ -1809,8 +1814,10 @@ ForeachStmt::EmitCode(FunctionEmitContext *ctx) const { // Start and end value for this loop dimension llvm::Value *sv = startExprs[i]->GetValue(ctx); llvm::Value *ev = endExprs[i]->GetValue(ctx); - if (sv == NULL || ev == NULL) + if (sv == NULL || ev == NULL) { + fprintf(stderr, "ev is NULL again :(\n"); return; + } startVals.push_back(sv); endVals.push_back(ev); @@ -2270,6 +2277,7 @@ ForeachStmt::TypeCheck() { return anyErrors ? NULL : this; } +/* Stmt * ForeachStmt::ReplacePolyType(const PolyType *from, const Type *to) { if (!stmts) @@ -2280,12 +2288,13 @@ ForeachStmt::ReplacePolyType(const PolyType *from, const Type *to) { for (size_t i=0; idimVariables[i]->type; if (Type::EqualForReplacement(t->GetBaseType(), from)) { - t = PolyType::ReplaceType(t, to); + copy->dimVariables[i]->type = PolyType::ReplaceType(t, to); } } return copy; } +*/ int diff --git a/stmt.h b/stmt.h index 7d5bb0d2..ee2cd8fc 100644 --- a/stmt.h +++ b/stmt.h @@ -285,7 +285,7 @@ public: void Print(int indent) const; Stmt *TypeCheck(); - Stmt *ReplacePolyType(const PolyType *from, const Type *to); + //Stmt *ReplacePolyType(const PolyType *from, const Type *to); int EstimateCost() const; std::vector dimVariables; @@ -294,7 +294,7 @@ public: bool isTiled; Stmt *stmts; private: - ForeachStmt(ForeachStmt *base); + //ForeachStmt(ForeachStmt *base); };