diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-10-09 20:11:37 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-10-09 20:11:37 -0600 |
commit | 2a2752adb4b32715926d3e565444fe2ea959f597 (patch) | |
tree | 2577d8aec38c34a47833c89ac5d41026754d6995 | |
parent | 41d53b28284bb6b8a9ef45de4d596734f64c3971 (diff) | |
download | chill-2a2752adb4b32715926d3e565444fe2ea959f597.tar.gz chill-2a2752adb4b32715926d3e565444fe2ea959f597.tar.bz2 chill-2a2752adb4b32715926d3e565444fe2ea959f597.zip |
clean up
-rw-r--r-- | include/chillAST/chillAST_node.hh | 21 | ||||
-rw-r--r-- | include/chillAST/chillASTs.hh | 8 | ||||
-rwxr-xr-x | lib/chillcg/src/CG_chillBuilder.cc | 2 | ||||
-rw-r--r-- | src/chillASTs.cc | 14 | ||||
-rwxr-xr-x | src/ir_clang.cc | 227 | ||||
-rw-r--r-- | src/transformations/loop.cc | 15 |
6 files changed, 60 insertions, 227 deletions
diff --git a/include/chillAST/chillAST_node.hh b/include/chillAST/chillAST_node.hh index 761d0e0..bc80e8a 100644 --- a/include/chillAST/chillAST_node.hh +++ b/include/chillAST/chillAST_node.hh @@ -40,8 +40,6 @@ protected: * @param nameMap a mapping from string to the corresponding declarations, stack is used to mimic scoping */ void fixReference(std::map<std::string, std::stack<chillAST_Node*> > nameMap); -public: - // TODO decide how to hide some data //! this Node's parent chillAST_Node *parent; //! this node's children the only entity that holds childs/subexpressions @@ -54,6 +52,8 @@ public: chillAST_TypedefTable *typedefTable; //! recordDecl scoping std::vector<chillAST_RecordDecl*> *recordTable; +public: + // TODO decide how to hide some data //! whether it is from a source file, when false it is from included files bool isFromSourceFile; //! the name of file this node from @@ -180,12 +180,28 @@ public: virtual bool isAUnion() { return false; }; + //! Get the symbol table in the contained scope virtual chillAST_SymbolTable *getSymbolTable() { return symbolTable; } + //! Get the typedef table in the contained scope virtual chillAST_TypedefTable *getTypedefTable() { return typedefTable; } + /*! + * @brief Add a variable declaration to the contained scope + * + * This will not automatically link the variable declaration as a child + * + * @param vd + */ virtual void addVariableToScope(chillAST_VarDecl *vd); + /*! + * @brief Add a typedef to the contained scope + * + * This will not automatically link the typedef as a child + * + * @param tdd + */ virtual void addTypedefToScope(chillAST_TypedefDecl *tdd); //! Non recursive version that tries to find the declaration in this node @@ -207,6 +223,7 @@ public: * @return The number of subexpressions */ virtual int getNumChildren() { return children.size(); }; + //! Deprecating, return the children as a list not eligible for multiplexing chillAST_NodeList *getChildren() { return &children; }; /*! diff --git a/include/chillAST/chillASTs.hh b/include/chillAST/chillASTs.hh index 25e6855..4b50479 100644 --- a/include/chillAST/chillASTs.hh +++ b/include/chillAST/chillASTs.hh @@ -514,9 +514,9 @@ public: // ADD MYSELF! loops.push_back(this); - int n = getBody()->children.size(); + int n = getBody()->getNumChildren(); for (int i = 0; i < n; i++) { - getBody()->children[i]->get_deep_loops(loops); + getBody()->getChild(i)->get_deep_loops(loops); } } @@ -524,10 +524,10 @@ public: void find_deepest_loops(std::vector<chillAST_ForStmt *> &loops) { std::vector<chillAST_ForStmt *> b; // deepest loops below me - int n = getBody()->children.size(); + int n = getBody()->getNumChildren(); for (int i = 0; i < n; i++) { std::vector<chillAST_ForStmt *> l; // deepest loops below one child - getBody()->children[i]->find_deepest_loops(l); + getBody()->getChild(i)->find_deepest_loops(l); if (l.size() > b.size()) { // a deeper nesting than we've seen b = l; } diff --git a/lib/chillcg/src/CG_chillBuilder.cc b/lib/chillcg/src/CG_chillBuilder.cc index 2613910..045320f 100755 --- a/lib/chillcg/src/CG_chillBuilder.cc +++ b/lib/chillcg/src/CG_chillBuilder.cc @@ -1077,7 +1077,7 @@ namespace omega { // vd did not have a name before vd->varname = strdup( data_members[i].c_str() ); - vd->parent = rd; // ?? + vd->setParent(rd); // ?? bool simplepointer = (vd->numdimensions == 1 && !vd->knownArraySizes); if (simplepointer) { diff --git a/src/chillASTs.cc b/src/chillASTs.cc index 30965d9..1e670a7 100644 --- a/src/chillASTs.cc +++ b/src/chillASTs.cc @@ -421,7 +421,7 @@ void chillAST_FunctionDecl::cleanUpVarDecls() { } for (int i = 0; i < deletethese.size(); i++) { - chillAST_Node *par = deletethese[i]->parent; + chillAST_Node *par = deletethese[i]->getParent(); par->removeChild(par->findChild(deletethese[i])); } @@ -1405,9 +1405,7 @@ chillAST_Node *chillAST_UnaryOperator::constantFold() { returnval = I; } else { chillAST_FloatingLiteral *FL = (chillAST_FloatingLiteral *) getSubExpr(); - chillAST_FloatingLiteral *F = new chillAST_FloatingLiteral(FL); // clone - F->parent = FL->parent; - + chillAST_FloatingLiteral *F = (chillAST_FloatingLiteral*)(FL->clone()); // clone F->value = -F->value; returnval = F; } @@ -2045,12 +2043,12 @@ void findFunctionDeclRecursive(chillAST_Node *node, const char *procname, vector // this is where the children can be used effectively. // we don't really care what kind of node we're at. We just check the node itself // and then its children is needed. - int numc = node->children.size(); + int numc = node->getNumChildren(); for (int i = 0; i < numc; i++) { if (node->isSourceFile()) - if (node->children[i]->isFunctionDecl()) - chillAST_FunctionDecl *fd = (chillAST_FunctionDecl *) node->children[i]; - findFunctionDeclRecursive(node->children[i], procname, funcs); + if (node->getChild(i)->isFunctionDecl()) + chillAST_FunctionDecl *fd = (chillAST_FunctionDecl *) node->getChild(i); + findFunctionDeclRecursive(node->getChild(i), procname, funcs); } return; } diff --git a/src/ir_clang.cc b/src/ir_clang.cc index 77e8d45..f31a0ac 100755 --- a/src/ir_clang.cc +++ b/src/ir_clang.cc @@ -765,7 +765,8 @@ chillAST_NodeList* ConvertTranslationUnit(TranslationUnitDecl *TUD, char *filena exit(-1); } topnode -> addChild(child); - if (D->isImplicit()) child->isFromSourceFile = false; + + if (D->isImplicit() || !globalSRCMAN->getFilename(D->getLocation()).equals(filename)) child->isFromSourceFile = false; } NL_RET(topnode); @@ -829,39 +830,26 @@ chillAST_NodeList* ConvertGenericClangAST(Stmt *s) { } else { // more work to do - fprintf(stderr, "ir_clang.cc ConvertGenericClangAST() UNHANDLED "); - //if (isa<Decl>(D)) fprintf(stderr, "Decl of kind %s\n", D->getDeclKindName() ); - if (isa<Stmt>(s))fprintf(stderr, "Stmt of type %s\n", s->getStmtClassName()); + if (isa<Decl>(D)) CHILL_ERROR("Decl of kind %s unhandled\n", D->getDeclKindName() ); + if (isa<Stmt>(s)) CHILL_ERROR("Stmt of type %s unhandled\n", s->getStmtClassName()); exit(-1); } return ret; } - - - - - - - - - // ---------------------------------------------------------------------------- // Class: IR_chillScalarSymbol // ---------------------------------------------------------------------------- std::string IR_chillScalarSymbol::name() const { - //return vd_->getNameAsString(); CLANG - //fprintf(stderr, "IR_chillScalarSymbol::name() %s\n", chillvd->varname); - return std::string(chillvd->varname); // CHILL + return std::string(chillvd->varname); // CHILL } // Return size in bytes int IR_chillScalarSymbol::size() const { - //return (vd_->getASTContext().getTypeSize(vd_->getType())) / 8; // ?? - fprintf(stderr, "IR_chillScalarSymbol::size() probably WRONG\n"); + CHILL_DEBUG_PRINT("IR_chillScalarSymbol::size() probably WRONG\n"); return (8); // bytes?? } @@ -902,39 +890,24 @@ int IR_chillArraySymbol::elem_size() const { int IR_chillArraySymbol::n_dim() const { - //fprintf(stderr, "IR_chillArraySymbol::n_dim()\n"); - //fprintf(stderr, "variable %s %s %s\n", chillvd->vartype, chillvd->varname, chillvd->arraypart); - //fprintf(stderr, "IR_chillArraySymbol::n_dim() %d\n", chillvd->numdimensions); - //fprintf(stderr, "IR_chillArraySymbol::n_dim() TODO \n"); exit(-1); return chillvd->numdimensions; } // TODO omega::CG_outputRepr *IR_chillArraySymbol::size(int dim) const { - fprintf(stderr, "IR_chillArraySymbol::n_size() TODO \n"); + CHILL_ERROR("IR_chillArraySymbol::n_size() TODO \n"); exit(-1); return NULL; } bool IR_chillArraySymbol::operator!=(const IR_Symbol &that) const { - //fprintf(stderr, "IR_xxxxArraySymbol::operator!= NOT EQUAL\n"); - //chillAST_VarDecl *chillvd; return chillvd != ((IR_chillArraySymbol *) &that)->chillvd; } bool IR_chillArraySymbol::operator==(const IR_Symbol &that) const { - //fprintf(stderr, "IR_xxxxArraySymbol::operator== EQUAL\n"); - //chillAST_VarDecl *chillvd; return chillvd == ((IR_chillArraySymbol *) &that)->chillvd; - /* - if (typeid(*this) != typeid(that)) - return false; - - const IR_chillArraySymbol *l_that = static_cast<const IR_chillArraySymbol *>(&that); - return this->vd_ == l_that->vd_ && this->offset_ == l_that->offset_; - */ } @@ -1001,11 +974,9 @@ bool IR_chillScalarRef::is_write() const { IR_ScalarSymbol *IR_chillScalarRef::symbol() const { - //VarDecl *vd = static_cast<VarDecl *>(vs_->getDecl()); - //fprintf(stderr, "ir_clang.cc IR_chillScalarRef::symbol()\n"); //exit(-1); chillAST_VarDecl *vd = NULL; if (chillvd) vd = chillvd; - return new IR_chillScalarSymbol(ir_, vd); // IR_chillScalarRef::symbol() + return new IR_chillScalarSymbol(ir_, vd); } @@ -1020,16 +991,15 @@ bool IR_chillScalarRef::operator==(const IR_Ref &that) const { omega::CG_outputRepr *IR_chillScalarRef::convert() { - //fprintf(stderr, "IR_chillScalarRef::convert() unimplemented\n"); exit(-1); - if (!dre) fprintf(stderr, "IR_chillScalarRef::convert() CLANG SCALAR REF has no dre\n"); + if (!dre) CHILL_ERROR("IR_chillScalarRef::convert() CLANG SCALAR REF has no dre\n"); omega::CG_chillRepr *result = new omega::CG_chillRepr(dre); delete this; return result; } IR_Ref *IR_chillScalarRef::clone() const { - if (dre) return new IR_chillScalarRef(ir_, dre); // use declrefexpr if it exists - return new IR_chillScalarRef(ir_, chillvd); // uses vardecl + if (dre) return new IR_chillScalarRef(ir_, dre); + return new IR_chillScalarRef(ir_, chillvd); } @@ -1038,8 +1008,7 @@ IR_Ref *IR_chillScalarRef::clone() const { // ---------------------------------------------------------------------------- bool IR_chillArrayRef::is_write() const { - - return (iswrite); // TODO + return (iswrite); // TODO } @@ -1318,11 +1287,10 @@ void findmanually(chillAST_Node *node, char *procname, std::vector<chillAST_Node // we don't really care what kind of node we're at. We just check the node itself // and then its children is needed. - int numc = node->children.size(); + int numc = node->getNumChildren(); - for (int i = 0; i < numc; i++) { - findmanually(node->children[i], procname, procs); - } + for (int i = 0; i < numc; i++) + findmanually(node->getChild(i), procname, procs); return; } @@ -1345,8 +1313,6 @@ IR_clangCode_Global_Init *IR_clangCode_Global_Init::Instance(char **argv) { aClangCompiler::aClangCompiler(char *filename) { - - //fprintf(stderr, "making a clang compiler for file %s\n", filename); SourceFileName = strdup(filename); // Arguments to pass to the clang frontend @@ -1354,15 +1320,10 @@ aClangCompiler::aClangCompiler(char *filename) { args.push_back(strdup(filename)); // The compiler invocation needs a DiagnosticsEngine so it can report problems - //IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); // temp diagnosticOptions = new DiagnosticOptions(); // private member of aClangCompiler pTextDiagnosticPrinter = new clang::TextDiagnosticPrinter(llvm::errs(), diagnosticOptions); // private member of aClangCompiler - - //llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagID(new clang::DiagnosticIDs()); - - //clang::DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient); diagnosticsEngine = new clang::DiagnosticsEngine(diagID, diagnosticOptions, pTextDiagnosticPrinter); // Create the compiler invocation @@ -1370,10 +1331,7 @@ aClangCompiler::aClangCompiler(char *filename) { // including data such as the include paths, the code generation options, // the warning flags, and so on. std::unique_ptr<clang::CompilerInvocation> CI(new clang::CompilerInvocation()); - //CI = new clang::CompilerInvocation; clang::CompilerInvocation::CreateFromArgs(*CI, &args[0], &args[0] + args.size(), *diagnosticsEngine); - - // Create the compiler instance Clang = new clang::CompilerInstance(); // TODO should have a better name ClangCompilerInstance @@ -1383,31 +1341,15 @@ aClangCompiler::aClangCompiler(char *filename) { //Clang.createDiagnostics(0, 0); -//#ifdef KIDDINGME - //fprintf(stderr, "target\n"); - // Initialize target info with the default triple for our platform. - //TargetOptions TO; - //TO.Triple = llvm::sys::getDefaultTargetTriple(); - //TargetInfo *TI = TargetInfo::CreateTargetInfo( Clang->getDiagnostics(), TO); - - // the above causes core dumps, because clang is stupid and frees the target multiple times, corrupting memory targetOptions = std::make_shared<clang::TargetOptions>(); targetOptions->Triple = llvm::sys::getDefaultTargetTriple(); TargetInfo *pti = TargetInfo::CreateTargetInfo(Clang->getDiagnostics(), targetOptions); Clang->setTarget(pti); - -//#endif - - - // ?? - //fprintf(stderr, "filemgr\n"); Clang->createFileManager(); FileManager &FileMgr = Clang->getFileManager(); fileManager = &FileMgr; - - //fprintf(stderr, "sourcemgr\n"); Clang->createSourceManager(FileMgr); SourceManager &SourceMgr = Clang->getSourceManager(); sourceManager = &SourceMgr; // ?? aclangcompiler copy @@ -1415,95 +1357,24 @@ aClangCompiler::aClangCompiler(char *filename) { Clang->setInvocation(CI.get()); // Replace the current invocation - - - //fprintf(stderr, "PP\n"); Clang->createPreprocessor(TU_Complete); - - - //clang::Preprocessor Pre = Clang->getPreprocessor(); - //preprocessor = &Pre; - - //fprintf(stderr, "CONTEXT\n"); - Clang->createASTContext(); // needs preprocessor + Clang->createASTContext(); // needs preprocessor astContext_ = &Clang->getASTContext(); - - - //fprintf(stderr, "filein\n"); const FileEntry *FileIn = FileMgr.getFile(filename); // needs preprocessor SourceMgr.setMainFileID(SourceMgr.createFileID(FileIn, clang::SourceLocation(), clang::SrcMgr::C_User)); - //DiagnosticConsumer DiagConsumer = Clang->getDiagnosticClient(); Clang->getDiagnosticClient().BeginSourceFile(Clang->getLangOpts(), &Clang->getPreprocessor()); - NULLASTConsumer TheConsumer; // must pass a consumer in to ParseAST(). This one does nothing - - //fprintf(stderr, "ready? Parse.\n"); CHILL_DEBUG_PRINT("actually parsing file %s using clang\n", filename); - ParseAST(Clang->getPreprocessor(), &TheConsumer, Clang->getASTContext()); - - // Translation Unit is contents of a file + // Translation Unit is contents of a file TranslationUnitDecl *TUD = astContext_->getTranslationUnitDecl(); - // TUD->dump(); // print it out - // create another AST, very similar to the clang AST but not written by idiots CHILL_DEBUG_PRINT("converting entire clang AST into chill AST (ir_clang.cc)\n"); chillAST_Node *wholefile = unwrap(ConvertTranslationUnit(TUD, filename)); - - fflush(stdout); - //fprintf(stderr, "printing whole file\n"); - //fprintf(stdout, "\n\n" ); fflush(stdout); - //wholefile->print(); - //wholefile->dump(); - //fflush(stdout); - entire_file_AST = (chillAST_SourceFile *) wholefile; - - astContext_ = &Clang->getASTContext(); - - //#define DOUBLE -#ifdef DOUBLE - fprintf(stderr, "DOUBLE\n"); - - fprintf(stderr, "\n\nCLANG dump of the file I parsed:\n"); - llvm::OwningPtr<clang::FrontendAction> Act2(new clang::ASTDumpAction()); - // here it actually does the FrontEndAction ?? - if (!Clang->ExecuteAction(*Act2)) { // ast dump using builtin function - exit(3); - } -#endif - fflush(stdout); - fflush(stderr); - fflush(stdout); - fflush(stderr); - fflush(stdout); - fflush(stderr); - fflush(stdout); - fflush(stderr); - - -#ifdef DONTDOTHIS - - // calling this Action seems to overwrite the astcontext and the AST. (!) - // don't ever do this, or you lose contact with the original AST (?) - - // Create an action and make the compiler instance carry it out - //llvm::OwningPtr<clang::CodeGenAction> Act(new clang::EmitLLVMOnlyAction()); - llvm::OwningPtr<clang::FrontendAction> Act(new clang::ASTDumpAction()); - - fprintf(stderr, "\n\ndump of the file I parsed:\n"); - // here it actually does the FrontEndAction ?? - if (!Clang->ExecuteAction(*Act)) { // ast dump using builtin function - exit(3); - } - fflush(stdout); -#endif - - - //fprintf(stderr, "leaving aClangCompiler::aClangCompiler( filename )\n"); } @@ -2048,9 +1919,9 @@ IR_Block *IR_clangCode::MergeNeighboringControlStructures(const std::vector<IR_C CHILL_DEBUG_PRINT("control %d is IR_CONTROL_LOOP\n", i); chillAST_ForStmt *loop = static_cast<IR_chillLoop *>(controls[i])->chillforstmt; if (parent == NULL) { - parent = loop->parent; + parent = loop->getParent(); } else { - if (parent != loop->parent) { + if (parent != loop->getParent()) { throw chill::error::ir("controls to merge not at the same level"); } } @@ -2063,9 +1934,9 @@ IR_Block *IR_clangCode::MergeNeighboringControlStructures(const std::vector<IR_C std::vector<chillAST_Node *> blockstmts = CB->statements; for (int j = 0; j < blockstmts.size(); j++) { if (parent == NULL) { - parent = blockstmts[j]->parent; + parent = blockstmts[j]->getParent(); } else { - if (parent != blockstmts[j]->parent) { + if (parent != blockstmts[j]->getParent()) { throw chill::error::ir( "ir_clang.cc IR_clangCode::MergeNeighboringControlStructures controls to merge not at the same level"); } @@ -2132,7 +2003,7 @@ void IR_clangCode::ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) { cloop = (struct IR_chillLoop *) old; chillAST_ForStmt *forstmt = cloop->chillforstmt; - par = forstmt->parent; + par = forstmt->getParent(); if (!par) { CHILL_ERROR("old parent was NULL\n"); CHILL_ERROR("ir_clang.cc that will not work very well.\n"); @@ -2178,7 +2049,7 @@ void IR_clangCode::ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) { break; case IR_CONTROL_BLOCK: { CHILL_ERROR("old is IR_CONTROL_BLOCK\n"); - par = ((IR_chillBlock*)old)->statements[0]->parent; + par = ((IR_chillBlock*)old)->statements[0]->getParent(); if (!par) { CHILL_ERROR("old parent was NULL\n"); CHILL_ERROR("ir_clang.cc that will not work very well.\n"); @@ -2214,60 +2085,24 @@ void IR_clangCode::ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) { void IR_clangCode::ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr) { - fprintf(stderr, "IR_xxxxCode::ReplaceExpression()\n"); - if (typeid(*old) == typeid(IR_chillArrayRef)) { - //fprintf(stderr, "expressions is IR_chillArrayRef\n"); IR_chillArrayRef *CAR = (IR_chillArrayRef *) old; chillAST_ArraySubscriptExpr *CASE = CAR->chillASE; - printf("\nreplacing old "); - CASE->print(); - printf("\n"); - fflush(stdout); omega::CG_chillRepr *crepr = (omega::CG_chillRepr *) repr; if (crepr->chillnodes.size() != 1) { - fprintf(stderr, "IR_clangCode::ReplaceExpression(), replacing with %d chillnodes???\n"); + CHILL_ERROR("IR_clangCode::ReplaceExpression(), replacing with %d chillnodes???\n"); //exit(-1); } chillAST_Node *newthing = crepr->chillnodes[0]; - fprintf(stderr, "with new "); - newthing->print(); - printf("\n\n"); - fflush(stdout); - if (!CASE->parent) { - fprintf(stderr, "IR_clangCode::ReplaceExpression() old has no parent ??\n"); + if (!CASE->getParent()) { + CHILL_ERROR("IR_clangCode::ReplaceExpression() old has no parent ??\n"); exit(-1); } - fprintf(stderr, "OLD parent = "); // of type %s\n", CASE->parent->getTypeString()); - if (CASE->parent->isImplicitCastExpr()) CASE->parent->parent->print(); - else CASE->parent->print(); - printf("\n"); - fflush(stdout); - - //CASE->parent->print(); printf("\n"); fflush(stdout); - //CASE->parent->parent->print(); printf("\n"); fflush(stdout); - //CASE->parent->parent->print(); printf("\n"); fflush(stdout); - //CASE->parent->parent->parent->print(); printf("\n"); fflush(stdout); - - CASE->parent->replaceChild(CASE, newthing); - - fprintf(stderr, "after replace parent is "); // of type %s\n", CASE->parent->getTypeString()); - if (CASE->parent->isImplicitCastExpr()) CASE->parent->parent->print(); - else CASE->parent->print(); - printf("\n\n"); - fflush(stdout); - - - - //CASE->parent->print(); printf("\n"); fflush(stdout); - //CASE->parent->parent->print(); printf("\n"); fflush(stdout); - //CASE->parent->parent->print(); printf("\n"); fflush(stdout); - //CASE->parent->parent->parent->print(); printf("\n"); fflush(stdout); - + CASE->getParent()->replaceChild(CASE, newthing); } else if (typeid(*old) == typeid(IR_chillScalarRef)) { fprintf(stderr, "IR_clangCode::ReplaceExpression() IR_chillScalarRef unhandled\n"); @@ -2287,13 +2122,9 @@ IR_CONDITION_TYPE IR_clangCode::QueryBooleanExpOperation(const omega::CG_outputR IR_OPERATION_TYPE IR_clangCode::QueryExpOperation(const omega::CG_outputRepr *repr) const { - //fprintf(stderr, "IR_clangCode::QueryExpOperation()\n"); - CG_chillRepr *crepr = (CG_chillRepr *) repr; chillAST_Node *node = crepr->chillnodes[0]; - //fprintf(stderr, "chillAST node type %s\n", node->getTypeString()); - - // really need to be more rigorous than this hack // TODO + // really need to be more rigorous than this hack // TODO if (node->isImplicitCastExpr()) node = ((chillAST_ImplicitCastExpr *) node)->getSubExpr(); if (node->isCStyleCastExpr()) node = ((chillAST_CStyleCastExpr *) node)->getSubExpr(); if (node->isParenExpr()) node = ((chillAST_ParenExpr *) node)->getSubExpr(); @@ -2470,7 +2301,7 @@ IR_Ref *IR_clangCode::Repr2Ref(const omega::CG_outputRepr *repr) const { } else if (node->isDeclRefExpr()) { return new IR_chillScalarRef(this, (chillAST_DeclRefExpr *) node); // uses DRE } else { - fprintf(stderr, "ir_clang.cc IR_clangCode::Repr2Ref() UNHANDLED node type %s\n", node->getTypeString()); + CHILL_ERROR("ir_clang.cc IR_clangCode::Repr2Ref() UNHANDLED node type %s\n", node->getTypeString()); exit(-1); } } diff --git a/src/transformations/loop.cc b/src/transformations/loop.cc index 409ece9..802cc98 100644 --- a/src/transformations/loop.cc +++ b/src/transformations/loop.cc @@ -1706,8 +1706,6 @@ std::vector<std::set<int> > Loop::typed_fusion(Graph<std::set<int>, bool> g, void Loop::setLexicalOrder(int dim, const std::set<int> &active, int starting_order, std::vector<std::vector<std::string> > idxNames) { - fprintf(stderr, "Loop::setLexicalOrder() %d idxNames active size %d starting_order %d\n", idxNames.size(), - active.size(), starting_order); if (active.size() == 0) return; @@ -1871,7 +1869,6 @@ void Loop::setLexicalOrder(int dim, const std::set<int> &active, assign_const(stmt[cur_stmt].xform, j, 0); order++; } else { // recurse ! - fprintf(stderr, "Loop:setLexicalOrder() recursing\n"); setLexicalOrder(dim, cur_scc, order, idxNames); order += sz; } @@ -1957,11 +1954,8 @@ void Loop::setLexicalOrder(int dim, const std::set<int> &active, stmt[*it].xform.simplify(); } - if ((dim + 2) <= (stmt[ref_stmt_num].xform.n_out() - 1)) { // recurse ! - fprintf(stderr, "Loop:setLexicalOrder() recursing\n"); + if ((dim + 2) <= (stmt[ref_stmt_num].xform.n_out() - 1)) setLexicalOrder(dim + 2, s[i], order, idxNames); - } - order++; } //} @@ -2090,13 +2084,6 @@ void Loop::setLexicalOrder(int dim, const std::set<int> &active, */ } - fprintf(stderr, "LEAVING Loop::setLexicalOrder() %d idxNames\n", idxNames.size()); - for (int i = 0; i < idxNames.size(); i++) { - std::vector<std::string> what = idxNames[i]; - for (int j = 0; j < what.size(); j++) { - fprintf(stderr, "%2d %2d %s\n", i, j, what[j].c_str()); - } - } } |