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
00038
00039 #include "c_breeze.h"
00040
00041
00042
00043
00044
00045 conditiongotoNode::conditiongotoNode(labelNode * label, indexNode * left,
00046 unsigned int op_id, indexNode * right,
00047 const Coord coord):
00048 gotoNode(label, coord, Condition),
00049 _oper1(left),
00050 _oper2(right)
00051 {
00052 Operator * new_op = Operators::table[op_id];
00053 op(new_op);
00054 }
00055
00056
00057
00058
00059
00060 void conditiongotoNode::op(Operator * op) {
00061 if ( op->is_comparison() )
00062 _op = op;
00063 else
00064
00065 ;
00066 }
00067
00068
00069
00070
00071
00072 void conditiongotoNode::visit(Visitor * the_visitor)
00073 {
00074 the_visitor->at_conditiongoto(this);
00075 }
00076
00077 void conditiongotoNode::walk(Walker & the_walker)
00078 {
00079 Walker::Order ord = the_walker.order();
00080
00081 if ( ord == Walker::Preorder || ord == Walker::Both )
00082 the_walker.at_conditiongoto(this, Walker::Preorder);
00083
00084 if ( the_walker.depth() == Walker::Subtree ) {
00085
00086
00087 left()->walk(the_walker);
00088 right()->walk(the_walker);
00089 }
00090
00091 if ( ord == Walker::Postorder || ord == Walker::Both )
00092 the_walker.at_conditiongoto(this, Walker::Postorder);
00093 }
00094
00095
00096
00097
00098
00099 Node * conditiongotoNode::change(Changer & the_changer, bool redispatch)
00100 {
00101 Changer::Order ord = the_changer.order();
00102 conditiongotoNode * the_condgoto = this;
00103
00104 if ( ( ord == Changer::Preorder || ord == Changer::Both ) && !redispatch )
00105 the_condgoto =
00106 (conditiongotoNode *) the_changer.at_conditiongoto(the_condgoto,
00107 Changer::Preorder);
00108
00109 if ( the_condgoto ) {
00110 if ( the_condgoto != this )
00111 return the_condgoto->change(the_changer, true);
00112
00113 indexNode * old_left = the_condgoto->left();
00114 indexNode * new_left = (indexNode *) old_left->change(the_changer);
00115 if ( old_left != new_left )
00116 the_condgoto->left(new_left);
00117
00118 indexNode * old_right = the_condgoto->right();
00119 indexNode * new_right = (indexNode *) old_right->change(the_changer);
00120 if ( old_right != new_right )
00121 the_condgoto->right(new_right);
00122 }
00123
00124 if ( ( ord == Changer::Postorder || ord == Changer::Both ) && !redispatch)
00125 the_condgoto =
00126 (conditiongotoNode *) the_changer.at_conditiongoto(the_condgoto,
00127 Changer::Postorder);
00128
00129 return the_condgoto;
00130 }
00131
00132
00133
00134
00135
00136 void conditiongotoNode::output_stmt(output_context & ct, Node * parent)
00137 {
00138 ct << "if";
00139 ct.space();
00140 ct << '(' ;
00141 ct.space();
00142
00143 left()->output(ct, this);
00144 ct.space();
00145 ct << op()->print();
00146 ct.space();
00147 right()->output(ct, this);
00148
00149 ct << ')';
00150 ct.space();
00151
00152 gotoNode::output_stmt(ct, parent);
00153 }
00154
00155
00156
00157
00158
00159 void conditiongotoNode::dataflow(FlowVal * v, FlowProblem & fp)
00160 {
00161
00162 }