165 int _inst_mem_id; // Instance memory id (node index of the memory Phi)
166 int _inst_id; // Instance id of the memory slice.
167 const int _inst_index; // Alias index of the instance memory slice.
168 // Array elements references have the same alias_idx but different offset.
169 const int _inst_offset; // Offset of the instance memory slice.
170 // Size is bigger to hold the _adr_type field.
171 virtual uint hash() const; // Check the type
172 virtual bool cmp( const Node &n ) const;
173 virtual uint size_of() const { return sizeof(*this); }
174
175 // Determine if CMoveNode::is_cmove_id can be used at this join point.
176 Node* is_cmove_id(PhaseTransform* phase, int true_path);
177 bool wait_for_region_igvn(PhaseGVN* phase);
178 bool is_data_loop(RegionNode* r, Node* uin, const PhaseGVN* phase);
179
180 static Node* clone_through_phi(Node* root_phi, const Type* t, uint c, PhaseIterGVN* igvn);
181 static Node* merge_through_phi(Node* root_phi, PhaseIterGVN* igvn);
182
183 bool must_wait_for_region_in_irreducible_loop(PhaseGVN* phase) const;
184
185 public:
186 // Node layout (parallels RegionNode):
187 enum { Region, // Control input is the Phi's region.
188 Input // Input values are [1..len)
189 };
190
191 PhiNode( Node *r, const Type *t, const TypePtr* at = nullptr,
192 const int imid = -1,
193 const int iid = TypeOopPtr::InstanceTop,
194 const int iidx = Compile::AliasIdxTop,
195 const int ioffs = Type::OffsetTop )
196 : TypeNode(t,r->req()),
197 _adr_type(at),
198 _inst_mem_id(imid),
199 _inst_id(iid),
200 _inst_index(iidx),
201 _inst_offset(ioffs)
202 {
203 init_class_id(Class_Phi);
204 init_req(0, r);
238 int is_diamond_phi() const;
239 bool try_clean_memory_phi(PhaseIterGVN* igvn);
240 virtual int Opcode() const;
241 virtual bool pinned() const { return in(0) != nullptr; }
242 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
243
244 void set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; }
245 int inst_mem_id() const { return _inst_mem_id; }
246 int inst_id() const { return _inst_id; }
247 int inst_index() const { return _inst_index; }
248 int inst_offset() const { return _inst_offset; }
249 bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) {
250 return type()->basic_type() == tp->basic_type() &&
251 inst_mem_id() == mem_id &&
252 inst_id() == id &&
253 inst_index() == index &&
254 inst_offset() == offset &&
255 type()->higher_equal(tp);
256 }
257
258 virtual const Type* Value(PhaseGVN* phase) const;
259 virtual Node* Identity(PhaseGVN* phase);
260 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
261 virtual const RegMask &out_RegMask() const;
262 virtual const RegMask &in_RegMask(uint) const;
263 #ifndef PRODUCT
264 virtual void dump_spec(outputStream *st) const;
265 #endif
266 #ifdef ASSERT
267 void verify_adr_type(VectorSet& visited, const TypePtr* at) const;
268 void verify_adr_type(bool recursive = false) const;
269 #else //ASSERT
270 void verify_adr_type(bool recursive = false) const {}
271 #endif //ASSERT
272
273 const TypeTuple* collect_types(PhaseGVN* phase) const;
274 };
275
276 //------------------------------GotoNode---------------------------------------
277 // GotoNodes perform direct branches.
431 static IfNode* make_with_same_profile(IfNode* if_node_profile, Node* ctrl, BoolNode* bol);
432
433 virtual int Opcode() const;
434 virtual bool pinned() const { return true; }
435 virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
436 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
437 virtual const Type* Value(PhaseGVN* phase) const;
438 virtual int required_outcnt() const { return 2; }
439 virtual const RegMask &out_RegMask() const;
440 Node* fold_compares(PhaseIterGVN* phase);
441 static Node* up_one_dom(Node* curr, bool linear_only = false);
442 bool is_zero_trip_guard() const;
443 Node* dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool pin_array_access_nodes);
444 ProjNode* uncommon_trap_proj(CallStaticJavaNode*& call, Deoptimization::DeoptReason reason = Deoptimization::Reason_none) const;
445
446 // Takes the type of val and filters it through the test represented
447 // by if_proj and returns a more refined type if one is produced.
448 // Returns null is it couldn't improve the type.
449 static const TypeInt* filtered_int_type(PhaseGVN* phase, Node* val, Node* if_proj);
450
451 AssertionPredicateType assertion_predicate_type() const {
452 return _assertion_predicate_type;
453 }
454
455 #ifndef PRODUCT
456 virtual void dump_spec(outputStream *st) const;
457 #endif
458
459 bool same_condition(const Node* dom, PhaseIterGVN* igvn) const;
460 };
461
462 class RangeCheckNode : public IfNode {
463 private:
464 int is_range_check(Node*& range, Node*& index, jint& offset);
465
466 public:
467 RangeCheckNode(Node* control, Node* bol, float p, float fcnt) : IfNode(control, bol, p, fcnt) {
468 init_class_id(Class_RangeCheck);
469 }
470
704 virtual int Opcode() const;
705 virtual bool pinned() const { return true; };
706 virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
707 virtual const Type* Value(PhaseGVN* phase) const;
708 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
709 virtual int required_outcnt() const { return 2; }
710 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const { }
711 virtual uint size(PhaseRegAlloc *ra_) const { return 0; }
712 #ifndef PRODUCT
713 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
714 #endif
715 };
716
717 //------------------------------BlackholeNode----------------------------
718 // Blackhole all arguments. This node would survive through the compiler
719 // the effects on its arguments, and would be finally matched to nothing.
720 class BlackholeNode : public MultiNode {
721 public:
722 BlackholeNode(Node* ctrl) : MultiNode(1) {
723 init_req(TypeFunc::Control, ctrl);
724 }
725 virtual int Opcode() const;
726 virtual uint ideal_reg() const { return 0; } // not matched in the AD file
727 virtual const Type* bottom_type() const { return TypeTuple::MEMBAR; }
728
729 const RegMask &in_RegMask(uint idx) const {
730 // Fake the incoming arguments mask for blackholes: accept all registers
731 // and all stack slots. This would avoid any redundant register moves
732 // for blackhole inputs.
733 return RegMask::All;
734 }
735 #ifndef PRODUCT
736 virtual void format(PhaseRegAlloc* ra, outputStream* st) const;
737 #endif
738 };
739
740
741 #endif // SHARE_OPTO_CFGNODE_HPP
|
165 int _inst_mem_id; // Instance memory id (node index of the memory Phi)
166 int _inst_id; // Instance id of the memory slice.
167 const int _inst_index; // Alias index of the instance memory slice.
168 // Array elements references have the same alias_idx but different offset.
169 const int _inst_offset; // Offset of the instance memory slice.
170 // Size is bigger to hold the _adr_type field.
171 virtual uint hash() const; // Check the type
172 virtual bool cmp( const Node &n ) const;
173 virtual uint size_of() const { return sizeof(*this); }
174
175 // Determine if CMoveNode::is_cmove_id can be used at this join point.
176 Node* is_cmove_id(PhaseTransform* phase, int true_path);
177 bool wait_for_region_igvn(PhaseGVN* phase);
178 bool is_data_loop(RegionNode* r, Node* uin, const PhaseGVN* phase);
179
180 static Node* clone_through_phi(Node* root_phi, const Type* t, uint c, PhaseIterGVN* igvn);
181 static Node* merge_through_phi(Node* root_phi, PhaseIterGVN* igvn);
182
183 bool must_wait_for_region_in_irreducible_loop(PhaseGVN* phase) const;
184
185 bool can_push_inline_types_down(PhaseGVN* phase, bool can_reshape, ciInlineKlass*& inline_klass);
186 InlineTypeNode* push_inline_types_down(PhaseGVN* phase, bool can_reshape, ciInlineKlass* inline_klass);
187
188 public:
189 // Node layout (parallels RegionNode):
190 enum { Region, // Control input is the Phi's region.
191 Input // Input values are [1..len)
192 };
193
194 PhiNode( Node *r, const Type *t, const TypePtr* at = nullptr,
195 const int imid = -1,
196 const int iid = TypeOopPtr::InstanceTop,
197 const int iidx = Compile::AliasIdxTop,
198 const int ioffs = Type::OffsetTop )
199 : TypeNode(t,r->req()),
200 _adr_type(at),
201 _inst_mem_id(imid),
202 _inst_id(iid),
203 _inst_index(iidx),
204 _inst_offset(ioffs)
205 {
206 init_class_id(Class_Phi);
207 init_req(0, r);
241 int is_diamond_phi() const;
242 bool try_clean_memory_phi(PhaseIterGVN* igvn);
243 virtual int Opcode() const;
244 virtual bool pinned() const { return in(0) != nullptr; }
245 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
246
247 void set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; }
248 int inst_mem_id() const { return _inst_mem_id; }
249 int inst_id() const { return _inst_id; }
250 int inst_index() const { return _inst_index; }
251 int inst_offset() const { return _inst_offset; }
252 bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) {
253 return type()->basic_type() == tp->basic_type() &&
254 inst_mem_id() == mem_id &&
255 inst_id() == id &&
256 inst_index() == index &&
257 inst_offset() == offset &&
258 type()->higher_equal(tp);
259 }
260
261 bool can_be_inline_type() const {
262 return EnableValhalla && _type->isa_instptr() && _type->is_instptr()->can_be_inline_type();
263 }
264
265 Node* try_push_inline_types_down(PhaseGVN* phase, bool can_reshape);
266 DEBUG_ONLY(bool can_push_inline_types_down(PhaseGVN* phase);)
267
268 virtual const Type* Value(PhaseGVN* phase) const;
269 virtual Node* Identity(PhaseGVN* phase);
270 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
271 virtual const RegMask &out_RegMask() const;
272 virtual const RegMask &in_RegMask(uint) const;
273 #ifndef PRODUCT
274 virtual void dump_spec(outputStream *st) const;
275 #endif
276 #ifdef ASSERT
277 void verify_adr_type(VectorSet& visited, const TypePtr* at) const;
278 void verify_adr_type(bool recursive = false) const;
279 #else //ASSERT
280 void verify_adr_type(bool recursive = false) const {}
281 #endif //ASSERT
282
283 const TypeTuple* collect_types(PhaseGVN* phase) const;
284 };
285
286 //------------------------------GotoNode---------------------------------------
287 // GotoNodes perform direct branches.
441 static IfNode* make_with_same_profile(IfNode* if_node_profile, Node* ctrl, BoolNode* bol);
442
443 virtual int Opcode() const;
444 virtual bool pinned() const { return true; }
445 virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
446 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
447 virtual const Type* Value(PhaseGVN* phase) const;
448 virtual int required_outcnt() const { return 2; }
449 virtual const RegMask &out_RegMask() const;
450 Node* fold_compares(PhaseIterGVN* phase);
451 static Node* up_one_dom(Node* curr, bool linear_only = false);
452 bool is_zero_trip_guard() const;
453 Node* dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool pin_array_access_nodes);
454 ProjNode* uncommon_trap_proj(CallStaticJavaNode*& call, Deoptimization::DeoptReason reason = Deoptimization::Reason_none) const;
455
456 // Takes the type of val and filters it through the test represented
457 // by if_proj and returns a more refined type if one is produced.
458 // Returns null is it couldn't improve the type.
459 static const TypeInt* filtered_int_type(PhaseGVN* phase, Node* val, Node* if_proj);
460
461 bool is_flat_array_check(PhaseTransform* phase, Node** array = nullptr);
462
463 AssertionPredicateType assertion_predicate_type() const {
464 return _assertion_predicate_type;
465 }
466
467 #ifndef PRODUCT
468 virtual void dump_spec(outputStream *st) const;
469 #endif
470
471 bool same_condition(const Node* dom, PhaseIterGVN* igvn) const;
472 };
473
474 class RangeCheckNode : public IfNode {
475 private:
476 int is_range_check(Node*& range, Node*& index, jint& offset);
477
478 public:
479 RangeCheckNode(Node* control, Node* bol, float p, float fcnt) : IfNode(control, bol, p, fcnt) {
480 init_class_id(Class_RangeCheck);
481 }
482
716 virtual int Opcode() const;
717 virtual bool pinned() const { return true; };
718 virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
719 virtual const Type* Value(PhaseGVN* phase) const;
720 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
721 virtual int required_outcnt() const { return 2; }
722 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const { }
723 virtual uint size(PhaseRegAlloc *ra_) const { return 0; }
724 #ifndef PRODUCT
725 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
726 #endif
727 };
728
729 //------------------------------BlackholeNode----------------------------
730 // Blackhole all arguments. This node would survive through the compiler
731 // the effects on its arguments, and would be finally matched to nothing.
732 class BlackholeNode : public MultiNode {
733 public:
734 BlackholeNode(Node* ctrl) : MultiNode(1) {
735 init_req(TypeFunc::Control, ctrl);
736 init_class_id(Class_Blackhole);
737 }
738 virtual int Opcode() const;
739 virtual uint ideal_reg() const { return 0; } // not matched in the AD file
740 virtual const Type* bottom_type() const { return TypeTuple::MEMBAR; }
741
742 const RegMask &in_RegMask(uint idx) const {
743 // Fake the incoming arguments mask for blackholes: accept all registers
744 // and all stack slots. This would avoid any redundant register moves
745 // for blackhole inputs.
746 return RegMask::All;
747 }
748 #ifndef PRODUCT
749 virtual void format(PhaseRegAlloc* ra, outputStream* st) const;
750 #endif
751 };
752
753
754 #endif // SHARE_OPTO_CFGNODE_HPP
|