173 // Check whether o is a valid oper.
174 static bool notAnOper(const MachOper *o) {
175 if (o == NULL) return true;
176 if (((intptr_t)o & 1) != 0) return true;
177 if (*(address*)o == badAddress) return true; // kill by Node::destruct
178 return false;
179 }
180 #endif // !PRODUCT
181 };
182
183 //------------------------------MachNode---------------------------------------
184 // Base type for all machine specific nodes. All node classes generated by the
185 // ADLC inherit from this class.
186 class MachNode : public Node {
187 public:
188 MachNode() : Node((uint)0), _num_opnds(0), _opnds(NULL) {
189 init_class_id(Class_Mach);
190 }
191 // Required boilerplate
192 virtual uint size_of() const { return sizeof(MachNode); }
193 virtual int Opcode() const; // Always equal to MachNode
194 virtual uint rule() const = 0; // Machine-specific opcode
195 // Number of inputs which come before the first operand.
196 // Generally at least 1, to skip the Control input
197 virtual uint oper_input_base() const { return 1; }
198 // Position of constant base node in node's inputs. -1 if
199 // no constant base node input.
200 virtual uint mach_constant_base_node_input() const { return (uint)-1; }
201
202 // Copy inputs and operands to new node of instruction.
203 // Called from cisc_version() and short_branch_version().
204 // !!!! The method's body is defined in ad_<arch>.cpp file.
205 void fill_new_machnode(MachNode *n) const;
206
207 // Return an equivalent instruction using memory for cisc_operand position
208 virtual MachNode *cisc_version(int offset);
209 // Modify this instruction's register mask to use stack version for cisc_operand
210 virtual void use_cisc_RegMask();
211
212 // Support for short branches
213 bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; }
691
692 //------------------------------MachProjNode----------------------------------
693 // Machine-dependent Ideal projections (how is that for an oxymoron). Really
694 // just MachNodes made by the Ideal world that replicate simple projections
695 // but with machine-dependent input & output register masks. Generally
696 // produced as part of calling conventions. Normally I make MachNodes as part
697 // of the Matcher process, but the Matcher is ill suited to issues involving
698 // frame handling, so frame handling is all done in the Ideal world with
699 // occasional callbacks to the machine model for important info.
700 class MachProjNode : public ProjNode {
701 public:
702 MachProjNode( Node *multi, uint con, const RegMask &out, uint ideal_reg ) : ProjNode(multi,con), _rout(out), _ideal_reg(ideal_reg) {
703 init_class_id(Class_MachProj);
704 }
705 RegMask _rout;
706 const uint _ideal_reg;
707 enum projType {
708 unmatched_proj = 0, // Projs for Control, I/O, memory not matched
709 fat_proj = 999 // Projs killing many regs, defined by _rout
710 };
711 virtual int Opcode() const;
712 virtual const Type *bottom_type() const;
713 virtual const TypePtr *adr_type() const;
714 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
715 virtual const RegMask &out_RegMask() const { return _rout; }
716 virtual uint ideal_reg() const { return _ideal_reg; }
717 // Need size_of() for virtual ProjNode::clone()
718 virtual uint size_of() const { return sizeof(MachProjNode); }
719 #ifndef PRODUCT
720 virtual void dump_spec(outputStream *st) const;
721 #endif
722 };
723
724 //------------------------------MachIfNode-------------------------------------
725 // Machine-specific versions of IfNodes
726 class MachIfNode : public MachBranchNode {
727 virtual uint size_of() const { return sizeof(*this); } // Size is bigger
728 public:
729 float _prob; // Probability branch goes either way
730 float _fcnt; // Frequency counter
731 MachIfNode() : MachBranchNode() {
|
173 // Check whether o is a valid oper.
174 static bool notAnOper(const MachOper *o) {
175 if (o == NULL) return true;
176 if (((intptr_t)o & 1) != 0) return true;
177 if (*(address*)o == badAddress) return true; // kill by Node::destruct
178 return false;
179 }
180 #endif // !PRODUCT
181 };
182
183 //------------------------------MachNode---------------------------------------
184 // Base type for all machine specific nodes. All node classes generated by the
185 // ADLC inherit from this class.
186 class MachNode : public Node {
187 public:
188 MachNode() : Node((uint)0), _num_opnds(0), _opnds(NULL) {
189 init_class_id(Class_Mach);
190 }
191 // Required boilerplate
192 virtual uint size_of() const { return sizeof(MachNode); }
193 virtual uint Opcode() const; // Always equal to MachNode
194 virtual uint rule() const = 0; // Machine-specific opcode
195 // Number of inputs which come before the first operand.
196 // Generally at least 1, to skip the Control input
197 virtual uint oper_input_base() const { return 1; }
198 // Position of constant base node in node's inputs. -1 if
199 // no constant base node input.
200 virtual uint mach_constant_base_node_input() const { return (uint)-1; }
201
202 // Copy inputs and operands to new node of instruction.
203 // Called from cisc_version() and short_branch_version().
204 // !!!! The method's body is defined in ad_<arch>.cpp file.
205 void fill_new_machnode(MachNode *n) const;
206
207 // Return an equivalent instruction using memory for cisc_operand position
208 virtual MachNode *cisc_version(int offset);
209 // Modify this instruction's register mask to use stack version for cisc_operand
210 virtual void use_cisc_RegMask();
211
212 // Support for short branches
213 bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; }
691
692 //------------------------------MachProjNode----------------------------------
693 // Machine-dependent Ideal projections (how is that for an oxymoron). Really
694 // just MachNodes made by the Ideal world that replicate simple projections
695 // but with machine-dependent input & output register masks. Generally
696 // produced as part of calling conventions. Normally I make MachNodes as part
697 // of the Matcher process, but the Matcher is ill suited to issues involving
698 // frame handling, so frame handling is all done in the Ideal world with
699 // occasional callbacks to the machine model for important info.
700 class MachProjNode : public ProjNode {
701 public:
702 MachProjNode( Node *multi, uint con, const RegMask &out, uint ideal_reg ) : ProjNode(multi,con), _rout(out), _ideal_reg(ideal_reg) {
703 init_class_id(Class_MachProj);
704 }
705 RegMask _rout;
706 const uint _ideal_reg;
707 enum projType {
708 unmatched_proj = 0, // Projs for Control, I/O, memory not matched
709 fat_proj = 999 // Projs killing many regs, defined by _rout
710 };
711 virtual uint Opcode() const;
712 virtual const Type *bottom_type() const;
713 virtual const TypePtr *adr_type() const;
714 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
715 virtual const RegMask &out_RegMask() const { return _rout; }
716 virtual uint ideal_reg() const { return _ideal_reg; }
717 // Need size_of() for virtual ProjNode::clone()
718 virtual uint size_of() const { return sizeof(MachProjNode); }
719 #ifndef PRODUCT
720 virtual void dump_spec(outputStream *st) const;
721 #endif
722 };
723
724 //------------------------------MachIfNode-------------------------------------
725 // Machine-specific versions of IfNodes
726 class MachIfNode : public MachBranchNode {
727 virtual uint size_of() const { return sizeof(*this); } // Size is bigger
728 public:
729 float _prob; // Probability branch goes either way
730 float _fcnt; // Frequency counter
731 MachIfNode() : MachBranchNode() {
|