258 // Returns the MachOper as determined by memory_operand(), for use, if
259 // needed by the caller. If (MachOper *)-1 is returned, base and index
260 // are set to NodeSentinel. If (MachOper *) NULL is returned, base and
261 // index are set to NULL.
262 const MachOper* memory_inputs(Node* &base, Node* &index) const;
263
264 // Helper for memory_inputs: Which operand carries the necessary info?
265 // By default, returns NULL, which means there is no such operand.
266 // If it returns (MachOper*)-1, this means there are multiple memories.
267 virtual const MachOper* memory_operand() const { return NULL; }
268
269 // Call "get_base_and_disp" to decide which category of memory is used here.
270 virtual const class TypePtr *adr_type() const;
271
272 // Negate conditional branches. Error for non-branch Nodes
273 virtual void negate();
274
275 // Apply peephole rule(s) to this instruction
276 virtual MachNode *peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C );
277
278 // Check for PC-Relative addressing
279 bool is_pc_relative() const { return (flags() & Flag_is_pc_relative) != 0; }
280
281 // Top-level ideal Opcode matched
282 virtual int ideal_Opcode() const { return Op_Node; }
283
284 // Set the branch inside jump MachNodes. Error for non-branch Nodes.
285 virtual void label_set( Label* label, uint block_num );
286
287 // Adds the label for the case
288 virtual void add_case_label( int switch_val, Label* blockLabel);
289
290 // Set the absolute address for methods
291 virtual void method_set( intptr_t addr );
292
293 // Should we clone rather than spill this instruction?
294 bool rematerialize() const;
295
296 // Get the pipeline info
297 static const Pipeline *pipeline_class();
298 virtual const Pipeline *pipeline() const;
299
300 #ifndef PRODUCT
508 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
509 virtual uint size(PhaseRegAlloc *ra_) const;
510
511 #ifndef PRODUCT
512 virtual const char *Name() const { return "MachSpillCopy"; }
513 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
514 #endif
515 };
516
517 //------------------------------MachNullChkNode--------------------------------
518 // Machine-dependent null-pointer-check Node. Points a real MachNode that is
519 // also some kind of memory op. Turns the indicated MachNode into a
520 // conditional branch with good latency on the ptr-not-null path and awful
521 // latency on the pointer-is-null path.
522
523 class MachNullCheckNode : public MachIdealNode {
524 public:
525 const uint _vidx; // Index of memop being tested
526 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachIdealNode(), _vidx(vidx) {
527 init_class_id(Class_MachNullCheck);
528 init_flags(Flag_is_Branch | Flag_is_pc_relative);
529 add_req(ctrl);
530 add_req(memop);
531 }
532
533 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
534 virtual void label_set(Label* label, uint block_num);
535 virtual bool pinned() const { return true; };
536 virtual void negate() { }
537 virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; }
538 virtual uint ideal_reg() const { return NotAMachineReg; }
539 virtual const RegMask &in_RegMask(uint) const;
540 virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
541 #ifndef PRODUCT
542 virtual const char *Name() const { return "NullCheck"; }
543 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
544 #endif
545 };
546
547 //------------------------------MachProjNode----------------------------------
548 // Machine-dependent Ideal projections (how is that for an oxymoron). Really
549 // just MachNodes made by the Ideal world that replicate simple projections
550 // but with machine-dependent input & output register masks. Generally
551 // produced as part of calling conventions. Normally I make MachNodes as part
552 // of the Matcher process, but the Matcher is ill suited to issues involving
553 // frame handling, so frame handling is all done in the Ideal world with
554 // occasional callbacks to the machine model for important info.
555 class MachProjNode : public ProjNode {
556 public:
557 MachProjNode( Node *multi, uint con, const RegMask &out, uint ideal_reg ) : ProjNode(multi,con), _rout(out), _ideal_reg(ideal_reg) {}
558 RegMask _rout;
559 const uint _ideal_reg;
560 enum projType {
561 unmatched_proj = 0, // Projs for Control, I/O, memory not matched
562 fat_proj = 999 // Projs killing many regs, defined by _rout
563 };
564 virtual int Opcode() const;
565 virtual const Type *bottom_type() const;
566 virtual const TypePtr *adr_type() const;
567 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
568 virtual const RegMask &out_RegMask() const { return _rout; }
569 virtual uint ideal_reg() const { return _ideal_reg; }
570 // Need size_of() for virtual ProjNode::clone()
571 virtual uint size_of() const { return sizeof(MachProjNode); }
572 #ifndef PRODUCT
573 virtual void dump_spec(outputStream *st) const;
574 #endif
575 };
576
577 //------------------------------MachIfNode-------------------------------------
578 // Machine-specific versions of IfNodes
579 class MachIfNode : public MachNode {
580 virtual uint size_of() const { return sizeof(*this); } // Size is bigger
581 public:
582 float _prob; // Probability branch goes either way
583 float _fcnt; // Frequency counter
584 MachIfNode() : MachNode() {
585 init_class_id(Class_MachIf);
586 }
587 #ifndef PRODUCT
588 virtual void dump_spec(outputStream *st) const;
589 #endif
590 };
591
592 //------------------------------MachFastLockNode-------------------------------------
593 // Machine-specific versions of FastLockNodes
594 class MachFastLockNode : public MachNode {
595 virtual uint size_of() const { return sizeof(*this); } // Size is bigger
596 public:
597 BiasedLockingCounters* _counters;
598
599 MachFastLockNode() : MachNode() {}
600 };
601
602 //------------------------------MachReturnNode--------------------------------
603 // Machine-specific versions of subroutine returns
604 class MachReturnNode : public MachNode {
605 virtual uint size_of() const; // Size is bigger
606 public:
607 RegMask *_in_rms; // Input register masks, set during allocation
608 ReallocMark _nesting; // assertion check for reallocations
609 const TypePtr* _adr_type; // memory effects of call or return
610 MachReturnNode() : MachNode() {
611 init_class_id(Class_MachReturn);
614
615 void set_adr_type(const TypePtr* atp) { _adr_type = atp; }
616
617 virtual const RegMask &in_RegMask(uint) const;
618 virtual bool pinned() const { return true; };
619 virtual const TypePtr *adr_type() const;
620 };
621
622 //------------------------------MachSafePointNode-----------------------------
623 // Machine-specific versions of safepoints
624 class MachSafePointNode : public MachReturnNode {
625 public:
626 OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC
627 JVMState* _jvms; // Pointer to list of JVM State Objects
628 uint _jvmadj; // Extra delta to jvms indexes (mach. args)
629 OopMap* oop_map() const { return _oop_map; }
630 void set_oop_map(OopMap* om) { _oop_map = om; }
631
632 MachSafePointNode() : MachReturnNode(), _oop_map(NULL), _jvms(NULL), _jvmadj(0) {
633 init_class_id(Class_MachSafePoint);
634 init_flags(Flag_is_safepoint_node);
635 }
636
637 virtual JVMState* jvms() const { return _jvms; }
638 void set_jvms(JVMState* s) {
639 _jvms = s;
640 }
641 bool is_safepoint_node() const { return (flags() & Flag_is_safepoint_node) != 0; }
642 virtual const Type *bottom_type() const;
643
644 virtual const RegMask &in_RegMask(uint) const;
645
646 // Functionality from old debug nodes
647 Node *returnadr() const { return in(TypeFunc::ReturnAdr); }
648 Node *frameptr () const { return in(TypeFunc::FramePtr); }
649
650 Node *local(const JVMState* jvms, uint idx) const {
651 assert(verify_jvms(jvms), "jvms must match");
652 return in(_jvmadj + jvms->locoff() + idx);
653 }
654 Node *stack(const JVMState* jvms, uint idx) const {
655 assert(verify_jvms(jvms), "jvms must match");
656 return in(_jvmadj + jvms->stkoff() + idx);
657 }
658 Node *monitor_obj(const JVMState* jvms, uint idx) const {
659 assert(verify_jvms(jvms), "jvms must match");
660 return in(_jvmadj + jvms->monitor_obj_offset(idx));
661 }
685 virtual uint cmp( const Node &n ) const;
686 virtual uint size_of() const = 0; // Size is bigger
687 public:
688 const TypeFunc *_tf; // Function type
689 address _entry_point; // Address of the method being called
690 float _cnt; // Estimate of number of times called
691 uint _argsize; // Size of argument block on stack
692
693 const TypeFunc* tf() const { return _tf; }
694 const address entry_point() const { return _entry_point; }
695 const float cnt() const { return _cnt; }
696 uint argsize() const { return _argsize; }
697
698 void set_tf(const TypeFunc* tf) { _tf = tf; }
699 void set_entry_point(address p) { _entry_point = p; }
700 void set_cnt(float c) { _cnt = c; }
701 void set_argsize(int s) { _argsize = s; }
702
703 MachCallNode() : MachSafePointNode() {
704 init_class_id(Class_MachCall);
705 init_flags(Flag_is_Call);
706 }
707
708 virtual const Type *bottom_type() const;
709 virtual bool pinned() const { return false; }
710 virtual const Type *Value( PhaseTransform *phase ) const;
711 virtual const RegMask &in_RegMask(uint) const;
712 virtual int ret_addr_offset() { return 0; }
713
714 bool returns_long() const { return tf()->return_type() == T_LONG; }
715 bool return_value_is_used() const;
716 #ifndef PRODUCT
717 virtual void dump_spec(outputStream *st) const;
718 #endif
719 };
720
721 //------------------------------MachCallJavaNode------------------------------
722 // "Base" class for machine-specific versions of subroutine calls
723 class MachCallJavaNode : public MachCallNode {
724 protected:
725 virtual uint cmp( const Node &n ) const;
|
258 // Returns the MachOper as determined by memory_operand(), for use, if
259 // needed by the caller. If (MachOper *)-1 is returned, base and index
260 // are set to NodeSentinel. If (MachOper *) NULL is returned, base and
261 // index are set to NULL.
262 const MachOper* memory_inputs(Node* &base, Node* &index) const;
263
264 // Helper for memory_inputs: Which operand carries the necessary info?
265 // By default, returns NULL, which means there is no such operand.
266 // If it returns (MachOper*)-1, this means there are multiple memories.
267 virtual const MachOper* memory_operand() const { return NULL; }
268
269 // Call "get_base_and_disp" to decide which category of memory is used here.
270 virtual const class TypePtr *adr_type() const;
271
272 // Negate conditional branches. Error for non-branch Nodes
273 virtual void negate();
274
275 // Apply peephole rule(s) to this instruction
276 virtual MachNode *peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C );
277
278 // Top-level ideal Opcode matched
279 virtual int ideal_Opcode() const { return Op_Node; }
280
281 // Set the branch inside jump MachNodes. Error for non-branch Nodes.
282 virtual void label_set( Label* label, uint block_num );
283
284 // Adds the label for the case
285 virtual void add_case_label( int switch_val, Label* blockLabel);
286
287 // Set the absolute address for methods
288 virtual void method_set( intptr_t addr );
289
290 // Should we clone rather than spill this instruction?
291 bool rematerialize() const;
292
293 // Get the pipeline info
294 static const Pipeline *pipeline_class();
295 virtual const Pipeline *pipeline() const;
296
297 #ifndef PRODUCT
505 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
506 virtual uint size(PhaseRegAlloc *ra_) const;
507
508 #ifndef PRODUCT
509 virtual const char *Name() const { return "MachSpillCopy"; }
510 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
511 #endif
512 };
513
514 //------------------------------MachNullChkNode--------------------------------
515 // Machine-dependent null-pointer-check Node. Points a real MachNode that is
516 // also some kind of memory op. Turns the indicated MachNode into a
517 // conditional branch with good latency on the ptr-not-null path and awful
518 // latency on the pointer-is-null path.
519
520 class MachNullCheckNode : public MachIdealNode {
521 public:
522 const uint _vidx; // Index of memop being tested
523 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachIdealNode(), _vidx(vidx) {
524 init_class_id(Class_MachNullCheck);
525 init_flags(Flag_is_Branch);
526 add_req(ctrl);
527 add_req(memop);
528 }
529
530 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
531 virtual void label_set(Label* label, uint block_num);
532 virtual bool pinned() const { return true; };
533 virtual void negate() { }
534 virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; }
535 virtual uint ideal_reg() const { return NotAMachineReg; }
536 virtual const RegMask &in_RegMask(uint) const;
537 virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
538 #ifndef PRODUCT
539 virtual const char *Name() const { return "NullCheck"; }
540 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
541 #endif
542 };
543
544 //------------------------------MachProjNode----------------------------------
545 // Machine-dependent Ideal projections (how is that for an oxymoron). Really
546 // just MachNodes made by the Ideal world that replicate simple projections
547 // but with machine-dependent input & output register masks. Generally
548 // produced as part of calling conventions. Normally I make MachNodes as part
549 // of the Matcher process, but the Matcher is ill suited to issues involving
550 // frame handling, so frame handling is all done in the Ideal world with
551 // occasional callbacks to the machine model for important info.
552 class MachProjNode : public ProjNode {
553 public:
554 MachProjNode( Node *multi, uint con, const RegMask &out, uint ideal_reg ) : ProjNode(multi,con), _rout(out), _ideal_reg(ideal_reg) {
555 init_class_id(Class_MachProj);
556 }
557 RegMask _rout;
558 const uint _ideal_reg;
559 enum projType {
560 unmatched_proj = 0, // Projs for Control, I/O, memory not matched
561 fat_proj = 999 // Projs killing many regs, defined by _rout
562 };
563 virtual int Opcode() const;
564 virtual const Type *bottom_type() const;
565 virtual const TypePtr *adr_type() const;
566 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
567 virtual const RegMask &out_RegMask() const { return _rout; }
568 virtual uint ideal_reg() const { return _ideal_reg; }
569 // Need size_of() for virtual ProjNode::clone()
570 virtual uint size_of() const { return sizeof(MachProjNode); }
571 #ifndef PRODUCT
572 virtual void dump_spec(outputStream *st) const;
573 #endif
574 };
575
576 //------------------------------MachIfNode-------------------------------------
577 // Machine-specific versions of IfNodes
578 class MachIfNode : public MachNode {
579 virtual uint size_of() const { return sizeof(*this); } // Size is bigger
580 public:
581 float _prob; // Probability branch goes either way
582 float _fcnt; // Frequency counter
583 MachIfNode() : MachNode() {
584 init_class_id(Class_MachIf);
585 }
586 #ifndef PRODUCT
587 virtual void dump_spec(outputStream *st) const;
588 #endif
589 };
590
591 //------------------------------MachGotoNode-----------------------------------
592 // Machine-specific versions of GotoNodes
593 class MachGotoNode : public MachNode {
594 public:
595 MachGotoNode() : MachNode() {
596 init_class_id(Class_MachGoto);
597 }
598 };
599
600 //------------------------------MachFastLockNode-------------------------------------
601 // Machine-specific versions of FastLockNodes
602 class MachFastLockNode : public MachNode {
603 virtual uint size_of() const { return sizeof(*this); } // Size is bigger
604 public:
605 BiasedLockingCounters* _counters;
606
607 MachFastLockNode() : MachNode() {}
608 };
609
610 //------------------------------MachReturnNode--------------------------------
611 // Machine-specific versions of subroutine returns
612 class MachReturnNode : public MachNode {
613 virtual uint size_of() const; // Size is bigger
614 public:
615 RegMask *_in_rms; // Input register masks, set during allocation
616 ReallocMark _nesting; // assertion check for reallocations
617 const TypePtr* _adr_type; // memory effects of call or return
618 MachReturnNode() : MachNode() {
619 init_class_id(Class_MachReturn);
622
623 void set_adr_type(const TypePtr* atp) { _adr_type = atp; }
624
625 virtual const RegMask &in_RegMask(uint) const;
626 virtual bool pinned() const { return true; };
627 virtual const TypePtr *adr_type() const;
628 };
629
630 //------------------------------MachSafePointNode-----------------------------
631 // Machine-specific versions of safepoints
632 class MachSafePointNode : public MachReturnNode {
633 public:
634 OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC
635 JVMState* _jvms; // Pointer to list of JVM State Objects
636 uint _jvmadj; // Extra delta to jvms indexes (mach. args)
637 OopMap* oop_map() const { return _oop_map; }
638 void set_oop_map(OopMap* om) { _oop_map = om; }
639
640 MachSafePointNode() : MachReturnNode(), _oop_map(NULL), _jvms(NULL), _jvmadj(0) {
641 init_class_id(Class_MachSafePoint);
642 }
643
644 virtual JVMState* jvms() const { return _jvms; }
645 void set_jvms(JVMState* s) {
646 _jvms = s;
647 }
648 virtual const Type *bottom_type() const;
649
650 virtual const RegMask &in_RegMask(uint) const;
651
652 // Functionality from old debug nodes
653 Node *returnadr() const { return in(TypeFunc::ReturnAdr); }
654 Node *frameptr () const { return in(TypeFunc::FramePtr); }
655
656 Node *local(const JVMState* jvms, uint idx) const {
657 assert(verify_jvms(jvms), "jvms must match");
658 return in(_jvmadj + jvms->locoff() + idx);
659 }
660 Node *stack(const JVMState* jvms, uint idx) const {
661 assert(verify_jvms(jvms), "jvms must match");
662 return in(_jvmadj + jvms->stkoff() + idx);
663 }
664 Node *monitor_obj(const JVMState* jvms, uint idx) const {
665 assert(verify_jvms(jvms), "jvms must match");
666 return in(_jvmadj + jvms->monitor_obj_offset(idx));
667 }
691 virtual uint cmp( const Node &n ) const;
692 virtual uint size_of() const = 0; // Size is bigger
693 public:
694 const TypeFunc *_tf; // Function type
695 address _entry_point; // Address of the method being called
696 float _cnt; // Estimate of number of times called
697 uint _argsize; // Size of argument block on stack
698
699 const TypeFunc* tf() const { return _tf; }
700 const address entry_point() const { return _entry_point; }
701 const float cnt() const { return _cnt; }
702 uint argsize() const { return _argsize; }
703
704 void set_tf(const TypeFunc* tf) { _tf = tf; }
705 void set_entry_point(address p) { _entry_point = p; }
706 void set_cnt(float c) { _cnt = c; }
707 void set_argsize(int s) { _argsize = s; }
708
709 MachCallNode() : MachSafePointNode() {
710 init_class_id(Class_MachCall);
711 }
712
713 virtual const Type *bottom_type() const;
714 virtual bool pinned() const { return false; }
715 virtual const Type *Value( PhaseTransform *phase ) const;
716 virtual const RegMask &in_RegMask(uint) const;
717 virtual int ret_addr_offset() { return 0; }
718
719 bool returns_long() const { return tf()->return_type() == T_LONG; }
720 bool return_value_is_used() const;
721 #ifndef PRODUCT
722 virtual void dump_spec(outputStream *st) const;
723 #endif
724 };
725
726 //------------------------------MachCallJavaNode------------------------------
727 // "Base" class for machine-specific versions of subroutine calls
728 class MachCallJavaNode : public MachCallNode {
729 protected:
730 virtual uint cmp( const Node &n ) const;
|