diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-22 12:11:16 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-22 12:11:16 -0600 |
commit | f27e01a039195c379fd6716c4870858789941365 (patch) | |
tree | 86aeeae55bb324400e4e24ab5bab18a80ff6db94 | |
parent | efda1444166c8d4f8dd7d7b085868f1596b3b9fb (diff) | |
download | chill-f27e01a039195c379fd6716c4870858789941365.tar.gz chill-f27e01a039195c379fd6716c4870858789941365.tar.bz2 chill-f27e01a039195c379fd6716c4870858789941365.zip |
new debug interface
-rw-r--r-- | include/chill_ast.hh | 6 | ||||
-rw-r--r-- | include/chilldebug.h | 17 | ||||
-rwxr-xr-x | include/ir_clang.hh | 4 | ||||
-rw-r--r-- | include/ir_code.hh | 1 | ||||
-rw-r--r-- | src/chill.cc | 4 | ||||
-rw-r--r-- | src/chillmodule.cc | 2 | ||||
-rwxr-xr-x | src/ir_clang.cc | 2 |
7 files changed, 24 insertions, 12 deletions
diff --git a/include/chill_ast.hh b/include/chill_ast.hh index a0cfe2d..43eb106 100644 --- a/include/chill_ast.hh +++ b/include/chill_ast.hh @@ -293,8 +293,8 @@ public: } virtual void replaceChild( chillAST_node *old, chillAST_node *newchild ) { - fprintf(stderr,"(%s) forgot to implement replaceChild() ... using generic\n" ,Chill_AST_Node_Names[asttype]); - fprintf(stderr, "%d children\n", children.size()); + fprintf(stderr,"(%s) forgot to implement replaceChild() ... using generic\n" ,Chill_AST_Node_Names[asttype]); + fprintf(stderr, "%d children\n", children.size()); for (int i=0; i<children.size(); i++) { if (children[i] == old) { children[i] = newchild; @@ -302,7 +302,7 @@ public: return; } } - fprintf(stderr, "%s %p generic replaceChild called with oldchild that was not a child\n", + fprintf(stderr, "%s %p generic replaceChild called with oldchild that was not a child\n", getTypeString(), this) ; fprintf(stderr, "printing\n"); print(); fprintf(stderr, "\nchild: "); diff --git a/include/chilldebug.h b/include/chilldebug.h index 8678749..f187955 100644 --- a/include/chilldebug.h +++ b/include/chilldebug.h @@ -1,13 +1,20 @@ - -// a central place to turn on debugging messages - #ifndef DEBUGCHILL_H #define DEBUGCHILL_H +#ifndef NDEBUG // means that CMAKE_BUILD_TYPE=Debug +#define DEBUGCHILL +#endif + #ifdef DEBUGCHILL -#define DEBUG_PRINT(args...) fprintf(stderr, args ) +#define CHILL_DEBUG_PRINT(format,args...) fprintf(stderr,"%s,%s,LN%d:\n\t" format,__FILE__,__FUNCTION__,__LINE__, ##args ) +#define CHILL_DEBUG_BEGIN { \ + fprintf(stderr,"%s,%s,LN%d:\n",__FILE__,__FUNCTION__,__LINE__); +#define CHILL_DEBUG_END } #else -#define DEBUG_PRINT(args...) do {} while(0) /* Don't do anything */ +#define CHILL_DEBUG_PRINT(format,args...) do {} while(0) /* Don't do anything */ +#define CHILL_DEBUG_BEGIN do { +#define CHILL_DEBUG_END } while (0); #endif + #endif diff --git a/include/ir_clang.hh b/include/ir_clang.hh index 50fb5dd..b283359 100755 --- a/include/ir_clang.hh +++ b/include/ir_clang.hh @@ -80,7 +80,9 @@ struct IR_chillArraySymbol: public IR_ArraySymbol { bool operator==(const IR_Symbol &that) const; IR_Symbol *clone() const; // TODO Hack to pass build - IR_CONSTANT_TYPE elem_type() const {return IR_CONSTANT_UNKNOWN;}; + IR_CONSTANT_TYPE elem_type() const { + fprintf(stderr,"Not implemented elem_type in IR_chillArraySymbol"); + return IR_CONSTANT_UNKNOWN;}; }; diff --git a/include/ir_code.hh b/include/ir_code.hh index 850bcc3..f52d147 100644 --- a/include/ir_code.hh +++ b/include/ir_code.hh @@ -248,6 +248,7 @@ struct IR_While: public IR_Control { // Abstract class for compiler IR. +// TODO made a lot of definition to pass instantiation for IR_clangCode class IR_Code { protected: // the only data members in IR_Code are Omega classes diff --git a/src/chill.cc b/src/chill.cc index b91d383..a3ad57f 100644 --- a/src/chill.cc +++ b/src/chill.cc @@ -28,7 +28,7 @@ std::vector<int> loops; //--- int main( int argc, char* argv[] ) { - DEBUG_PRINT("%s main()\n", argv[0]); + CHILL_DEBUG_PRINT("%s main()\n", argv[0]); if (argc > 2) { fprintf(stderr, "Usage: %s [script_file]\n", argv[0]); exit(-1); @@ -74,7 +74,7 @@ int main( int argc, char* argv[] ) int lnum_end; lnum_start = get_loop_num_start(); lnum_end = get_loop_num_end(); - DEBUG_PRINT("calling ROSE code gen? loop num %d\n", lnum); + CHILL_DEBUG_PRINT("calling ROSE code gen? loop num %d\n", lnum_start); delete ir_code; } Py_Finalize(); diff --git a/src/chillmodule.cc b/src/chillmodule.cc index fa6e001..5a7d575 100644 --- a/src/chillmodule.cc +++ b/src/chillmodule.cc @@ -771,7 +771,7 @@ static void register_globals(PyObject* m) { PyMODINIT_FUNC initchill(void) // pass C methods to python { - DEBUG_PRINT("in C, initchill() to set up C methods to be called from python\n"); + CHILL_DEBUG_PRINT("in C, initchill() to set up C methods to be called from python\n"); PyObject* m = Py_InitModule("chill", ChillMethods); register_globals(m); } diff --git a/src/ir_clang.cc b/src/ir_clang.cc index 0157436..16deff3 100755 --- a/src/ir_clang.cc +++ b/src/ir_clang.cc @@ -41,6 +41,7 @@ History: #include "code_gen/CG_chillRepr.h" #include "code_gen/CG_chillBuilder.h" #include <vector> +#include <chilldebug.h> #include "chill_ast.hh" @@ -2473,6 +2474,7 @@ IR_ArrayRef *IR_clangCode::CreateArrayRef(const IR_ArraySymbol *sym, std::vector // now we've got the vardecl AND the indeces to make a chillAST that represents the array reference // TODO Passing NULL for chillAST node? + CHILL_DEBUG_PRINT("Passed NULL as chillAST node"); chillAST_ArraySubscriptExpr *ASE = new chillAST_ArraySubscriptExpr( vd, inds, NULL); auto ref = new IR_chillArrayRef( this, ASE, 0 ); |