494 }
495 virtual uint size_of() const { return sizeof(*this); }
496 void set_out_RegMask(const RegMask &out) { _out = &out; }
497 void set_in_RegMask(const RegMask &in) { _in = ∈ }
498 virtual const RegMask &out_RegMask() const { return *_out; }
499 virtual const RegMask &in_RegMask(uint) const { return *_in; }
500 virtual const class Type *bottom_type() const { return _type; }
501 virtual uint ideal_reg() const { return _type->ideal_reg(); }
502 virtual uint oper_input_base() const { return 1; }
503 uint implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream* st ) const;
504
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 //------------------------------MachBranchNode--------------------------------
515 // Abstract machine branch Node
516 class MachBranchNode : public MachIdealNode {
517 public:
518 MachBranchNode() : MachIdealNode() {
519 init_class_id(Class_MachBranch);
520 }
521 virtual void label_set(Label* label, uint block_num) = 0;
522 virtual void save_label(Label** label, uint* block_num) = 0;
523
524 // Support for short branches
525 virtual MachNode *short_branch_version(Compile* C) { return NULL; }
526
527 virtual bool pinned() const { return true; };
528 };
529
530 //------------------------------MachNullChkNode--------------------------------
531 // Machine-dependent null-pointer-check Node. Points a real MachNode that is
532 // also some kind of memory op. Turns the indicated MachNode into a
533 // conditional branch with good latency on the ptr-not-null path and awful
|
494 }
495 virtual uint size_of() const { return sizeof(*this); }
496 void set_out_RegMask(const RegMask &out) { _out = &out; }
497 void set_in_RegMask(const RegMask &in) { _in = ∈ }
498 virtual const RegMask &out_RegMask() const { return *_out; }
499 virtual const RegMask &in_RegMask(uint) const { return *_in; }
500 virtual const class Type *bottom_type() const { return _type; }
501 virtual uint ideal_reg() const { return _type->ideal_reg(); }
502 virtual uint oper_input_base() const { return 1; }
503 uint implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream* st ) const;
504
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 // Inserted when coalescing of a two-address-instruction node and its input fails
515 class TwoAddressSpillNode : public MachSpillCopyNode {
516 public:
517 TwoAddressSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
518 #ifndef PRODUCT
519 virtual const char* Name() const { return "TwoAddressSpill"; }
520 #endif
521 };
522
523 // Inserted when coalescing of a phi node and its input fails
524 class PhiInputSpillNode : public MachSpillCopyNode {
525 public:
526 PhiInputSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
527 #ifndef PRODUCT
528 virtual const char* Name() const { return "PhiInputSpill"; }
529 #endif
530 };
531
532 // Inserted as debug info spills to safepoints in non-frequent blocks
533 class DebugUseSpillNode : public MachSpillCopyNode {
534 public:
535 DebugUseSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
536 #ifndef PRODUCT
537 virtual const char* Name() const { return "DebugUseSpill"; }
538 #endif
539 };
540
541 // Pre-split compares of loop-phis
542 class LoopPhiInputSpillNode : public MachSpillCopyNode {
543 public:
544 LoopPhiInputSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
545 #ifndef PRODUCT
546 virtual const char* Name() const { return "LoopPhiInputSpill"; }
547 #endif
548 };
549
550 // An lrg marked as spilled will be spilled to memory right
551 // after its definition, if in high pressure region or the lrg is bound
552 class DefinitionSpillNode : public MachSpillCopyNode {
553 public:
554 DefinitionSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
555 #ifndef PRODUCT
556 virtual const char* Name() const { return "DefinitionSpill"; }
557 #endif
558 };
559
560 // A register to register move
561 class RegToRegSpillNode : public MachSpillCopyNode {
562 public:
563 RegToRegSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
564 #ifndef PRODUCT
565 virtual const char* Name() const { return "RegToRegSpill"; }
566 #endif
567 };
568
569 // A register to memory move
570 class RegToMemSpillNode : public MachSpillCopyNode {
571 public:
572 RegToMemSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
573 #ifndef PRODUCT
574 virtual const char* Name() const { return "RegToMemSpill"; }
575 #endif
576 };
577
578 // A memory to register move
579 class MemToRegSpillNode : public MachSpillCopyNode {
580 public:
581 MemToRegSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
582 #ifndef PRODUCT
583 virtual const char* Name() const { return "MemToRegSpill"; }
584 #endif
585 };
586
587 // When coalescing phi nodes in PhaseChaitin::Split(), a move spill is inserted if the phi and its input
588 // resides at different locations (i.e. reg or mem)
589 class PhiLocationDifferToInputLocationSpillNode : public MachSpillCopyNode {
590 public:
591 PhiLocationDifferToInputLocationSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
592 #ifndef PRODUCT
593 virtual const char* Name() const { return "PhiLocationDifferToInputLocationSpill"; }
594 #endif
595 };
596
597 // Spill base pointer to memory at safepoint
598 class BasePointerToMemSpillNode : public MachSpillCopyNode {
599 public:
600 BasePointerToMemSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
601 #ifndef PRODUCT
602 virtual const char* Name() const { return "BasePointerToMemSpill"; }
603 #endif
604 };
605
606 // When rematerializing a node we stretch the inputs liveranges, and they might be stretched beyond a new
607 // definition point, therefore we split out new copies instead
608 class InputToRematerializationSpillNode : public MachSpillCopyNode {
609 public:
610 InputToRematerializationSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
611 #ifndef PRODUCT
612 virtual const char* Name() const { return "InputToRematerializationSpill"; }
613 #endif
614 };
615
616 // Spill use at a call
617 class CallUseSpillNode : public MachSpillCopyNode {
618 public:
619 CallUseSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
620 #ifndef PRODUCT
621 virtual const char* Name() const { return "CallUseSpill"; }
622 #endif
623 };
624
625 // An lrg marked as spill that is bound and needs to be spilled at a use
626 class BoundSpillNode : public MachSpillCopyNode {
627 public:
628 BoundSpillNode(Node *n, const RegMask &in, const RegMask &out) : MachSpillCopyNode(n, in, out) {}
629 #ifndef PRODUCT
630 virtual const char* Name() const { return "BoundSpill"; }
631 #endif
632 };
633
634 //------------------------------MachBranchNode--------------------------------
635 // Abstract machine branch Node
636 class MachBranchNode : public MachIdealNode {
637 public:
638 MachBranchNode() : MachIdealNode() {
639 init_class_id(Class_MachBranch);
640 }
641 virtual void label_set(Label* label, uint block_num) = 0;
642 virtual void save_label(Label** label, uint* block_num) = 0;
643
644 // Support for short branches
645 virtual MachNode *short_branch_version(Compile* C) { return NULL; }
646
647 virtual bool pinned() const { return true; };
648 };
649
650 //------------------------------MachNullChkNode--------------------------------
651 // Machine-dependent null-pointer-check Node. Points a real MachNode that is
652 // also some kind of memory op. Turns the indicated MachNode into a
653 // conditional branch with good latency on the ptr-not-null path and awful
|