00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef CBZ_META_H
00038 #define CBZ_META_H
00039
00040 #include "ast.h"
00041 #include "c_breeze.h"
00042
00043 class metaVariable
00044 {
00045 private:
00046
00047 string _name;
00048
00049 public:
00050
00051 metaVariable(string & name)
00052 : _name(name)
00053 {}
00054
00055 inline string & name() { return _name; }
00056 };
00057
00058
00059 class metaexprNode : public exprNode,
00060 public metaVariable
00061 {
00062 public:
00063
00064
00065
00066
00067 static bool is_meta_expr(char * name);
00068
00069
00070
00071
00072 static void add_meta_expr(char * name);
00073
00074
00075
00076
00077 static void clear();
00078
00079 private:
00080
00081 static list< string > meta_expr_variables;
00082
00083 public:
00084
00085 metaexprNode(idNode * id)
00086 : exprNode(Meta, 0, id->coord()),
00087 metaVariable(id->name())
00088 {
00089 delete id;
00090 }
00091
00092
00093
00094 virtual void eval() {}
00095
00096
00097
00098 virtual void visit(Visitor * the_visitor);
00099 virtual void walk(Walker & the_walker);
00100 virtual Node * change(Changer & the_changer, bool redispatch);
00101
00102
00103
00104 virtual void dataflow(FlowVal * v, FlowProblem & fp);
00105
00106
00107
00108 virtual Node * clone() const { return new metaexprNode ( *this ); }
00109
00110
00111
00112 virtual void output_expr(output_context & ct, Node * par, int prec, Assoc assoc);
00113
00114 };
00115
00116
00117
00118 class metastmtNode : public stmtNode,
00119 public metaVariable
00120 {
00121 public:
00122
00123
00124
00125
00126 static bool is_meta_stmt(char * name);
00127
00128
00129
00130
00131 static void add_meta_stmt(char * name);
00132
00133
00134
00135
00136 static void clear();
00137
00138 private:
00139
00140 static list< string > meta_stmt_variables;
00141
00142 public:
00143
00144 metastmtNode(idNode * id)
00145 : stmtNode(Meta, id->coord()),
00146 metaVariable(id->name())
00147 {
00148 delete id;
00149 }
00150
00151
00152
00153 virtual void visit(Visitor * the_visitor);
00154 virtual void walk(Walker & the_walker);
00155 virtual Node * change(Changer & the_changer, bool redispatch = false);
00156
00157
00158
00159 virtual void dataflow(FlowVal * v, FlowProblem & fp);
00160
00161
00162
00163 virtual Node * clone() const { return new metastmtNode ( *this ); }
00164
00165
00166 virtual void output_stmt(output_context & ct, Node * par);
00167
00168 };
00169
00170
00171 #endif //