47 // increment(variable, value) - increment variable by value |
47 // increment(variable, value) - increment variable by value |
48 // simple operations: AddI, SubI, AndI, LShiftI, etc. |
48 // simple operations: AddI, SubI, AndI, LShiftI, etc. |
49 // Example: |
49 // Example: |
50 // Node* limit = ?? |
50 // Node* limit = ?? |
51 // IdealVariable i(kit), j(kit); |
51 // IdealVariable i(kit), j(kit); |
52 // declares_done(); |
52 // declarations_done(); |
53 // Node* exit = make_label(1); // 1 goto |
53 // Node* exit = make_label(1); // 1 goto |
54 // set(j, ConI(0)); |
54 // set(j, ConI(0)); |
55 // loop(i, ConI(0), BoolTest::lt, limit); { |
55 // loop(i, ConI(0), BoolTest::lt, limit); { |
56 // if_then(value(i), BoolTest::gt, ConI(5)) { |
56 // if_then(value(i), BoolTest::gt, ConI(5)) { |
57 // set(j, ConI(1)); |
57 // set(j, ConI(1)); |
99 PhaseGVN& gvn() const { return _gvn; } |
99 PhaseGVN& gvn() const { return _gvn; } |
100 // Create a new cvstate filled with nulls |
100 // Create a new cvstate filled with nulls |
101 Node* new_cvstate(); // Create a new cvstate |
101 Node* new_cvstate(); // Create a new cvstate |
102 Node* cvstate() { return _cvstate; } // current cvstate |
102 Node* cvstate() { return _cvstate; } // current cvstate |
103 Node* copy_cvstate(); // copy current cvstate |
103 Node* copy_cvstate(); // copy current cvstate |
104 void set_ctrl(Node* ctrl) { _cvstate->set_req(TypeFunc::Control, ctrl); } |
104 |
105 |
|
106 // Should this assert this is a MergeMem??? |
|
107 void set_all_memory(Node* mem){ _cvstate->set_req(TypeFunc::Memory, mem); } |
|
108 void set_memory(Node* mem, uint alias_idx ); |
105 void set_memory(Node* mem, uint alias_idx ); |
109 void do_memory_merge(Node* merging, Node* join); |
106 void do_memory_merge(Node* merging, Node* join); |
110 void clear(Node* m); // clear a cvstate |
107 void clear(Node* m); // clear a cvstate |
111 void stop() { clear(_cvstate); } // clear current cvstate |
108 void stop() { clear(_cvstate); } // clear current cvstate |
112 Node* delay_transform(Node* n); |
109 Node* delay_transform(Node* n); |
130 |
127 |
131 // Users should not care about slices only MergedMem so no access for them. |
128 // Users should not care about slices only MergedMem so no access for them. |
132 Node* memory(uint alias_idx); |
129 Node* memory(uint alias_idx); |
133 |
130 |
134 public: |
131 public: |
135 IdealKit(PhaseGVN &gvn, Node* control, Node* memory, bool delay_all_transforms = false); |
132 IdealKit(PhaseGVN &gvn, Node* control, Node* memory, bool delay_all_transforms = false, bool has_declarations = false); |
136 ~IdealKit() { |
133 ~IdealKit() { |
137 stop(); |
134 stop(); |
138 drain_delay_transform(); |
135 drain_delay_transform(); |
139 } |
136 } |
140 // Control |
137 // Control |
141 Node* ctrl() { return _cvstate->in(TypeFunc::Control); } |
138 Node* ctrl() { return _cvstate->in(TypeFunc::Control); } |
|
139 void set_ctrl(Node* ctrl) { _cvstate->set_req(TypeFunc::Control, ctrl); } |
142 Node* top() { return C->top(); } |
140 Node* top() { return C->top(); } |
143 MergeMemNode* merged_memory() { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); } |
141 MergeMemNode* merged_memory() { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); } |
|
142 void set_all_memory(Node* mem) { _cvstate->set_req(TypeFunc::Memory, mem); } |
144 void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); } |
143 void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); } |
145 Node* value(IdealVariable& v) { return _cvstate->in(first_var + v.id()); } |
144 Node* value(IdealVariable& v) { return _cvstate->in(first_var + v.id()); } |
146 void dead(IdealVariable& v) { set(v, (Node*)NULL); } |
145 void dead(IdealVariable& v) { set(v, (Node*)NULL); } |
147 void if_then(Node* left, BoolTest::mask relop, Node* right, |
146 void if_then(Node* left, BoolTest::mask relop, Node* right, |
148 float prob = PROB_FAIR, float cnt = COUNT_UNKNOWN, |
147 float prob = PROB_FAIR, float cnt = COUNT_UNKNOWN, |
153 float prob = PROB_LIKELY(0.9), float cnt = COUNT_UNKNOWN); |
152 float prob = PROB_LIKELY(0.9), float cnt = COUNT_UNKNOWN); |
154 void end_loop(); |
153 void end_loop(); |
155 Node* make_label(int goto_ct); |
154 Node* make_label(int goto_ct); |
156 void bind(Node* lab); |
155 void bind(Node* lab); |
157 void goto_(Node* lab, bool bind = false); |
156 void goto_(Node* lab, bool bind = false); |
158 void declares_done(); |
157 void declarations_done(); |
159 void drain_delay_transform(); |
158 void drain_delay_transform(); |
160 |
159 |
161 Node* IfTrue(IfNode* iff) { return transform(new (C,1) IfTrueNode(iff)); } |
160 Node* IfTrue(IfNode* iff) { return transform(new (C,1) IfTrueNode(iff)); } |
162 Node* IfFalse(IfNode* iff) { return transform(new (C,1) IfFalseNode(iff)); } |
161 Node* IfFalse(IfNode* iff) { return transform(new (C,1) IfFalseNode(iff)); } |
163 |
162 |