#ifndef CG_chillRepr_h #define CG_chillRepr_h // Repr using chillAst internally #include #include #include #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif #include "chillAST/chillASTs.hh" namespace omega { class CG_chillRepr : public CG_outputRepr { friend class CG_chillBuilder; public: CG_chillRepr() { stmtclassname = strdup("NOTHING"); } char *type() const { return strdup("chill"); }; // std::vector chillnodes; // TODO make private void printChillNodes() const { for (int i = 0; i < chillnodes.size(); i++) chillnodes[i]->print(); fflush(stdout); }; CG_chillRepr(std::vector cnodes) { chillnodes = cnodes; } CG_chillRepr(chillAST_Node *chillast) { stmtclassname = strdup(chillast->getTypeString()); if (chillast->getType() == CHILLAST_NODE_COMPOUNDSTMT) { std::vector &children = *(chillast->getChildren()); int numchildren = children.size(); for (int i = 0; i < numchildren; i++) { chillnodes.push_back(children[i]); } } else { // for now, assume it's a single statement chillnodes.push_back(chillast); // ?? } } void addStatement(chillAST_Node *s) { chillnodes.push_back(s); }; std::vector getChillCode() const { return chillnodes; }; chillAST_Node *GetCode(); ~CG_chillRepr(); CG_outputRepr *clone() const; void clear(); //--------------------------------------------------------------------------- // Dump operations //--------------------------------------------------------------------------- void dump() const { printChillNodes(); }; void Dump() const; private: char *stmtclassname; // chill }; } // namespace #endif