1596 int label_position = instr->label_position(); 1597 if( label_position != -1 ) { 1598 // Set/Save the label, stored in labelOper::_branch_label 1599 fprintf(fp," virtual void label_set( Label* label, uint block_num );\n"); 1600 fprintf(fp," virtual void save_label( Label** label, uint* block_num );\n"); 1601 } 1602 1603 // If this instruction contains a methodOper 1604 // Declare Node::methods that set operand method's contents 1605 int method_position = instr->method_position(); 1606 if( method_position != -1 ) { 1607 // Set the address method, stored in methodOper::_method 1608 fprintf(fp," virtual void method_set( intptr_t method );\n"); 1609 } 1610 1611 // virtual functions for attributes 1612 // 1613 // Each instruction attribute results in a virtual call of same name. 1614 // The ins_cost is not handled here. 1615 Attribute *attr = instr->_attribs; 1616 bool avoid_back_to_back = false; 1617 while (attr != NULL) { 1618 if (strcmp (attr->_ident, "ins_cost") != 0 && 1619 strncmp(attr->_ident, "ins_field_", 10) != 0 && 1620 // Must match function in node.hpp: return type bool, no prefix "ins_". 1621 strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") != 0 && 1622 strcmp (attr->_ident, "ins_short_branch") != 0) { 1623 fprintf(fp, " virtual int %s() const { return %s; }\n", attr->_ident, attr->_val); 1624 } 1625 // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag 1626 if (!strcmp(attr->_ident, "ins_avoid_back_to_back") != 0 && attr->int_val(*this) != 0) 1627 avoid_back_to_back = true; 1628 if (strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") == 0) 1629 fprintf(fp, " virtual bool is_TrapBasedCheckNode() const { return %s; }\n", attr->_val); 1630 1631 attr = (Attribute *)attr->_next; 1632 } 1633 1634 // virtual functions for encode and format 1635 1636 // Virtual function for evaluating the constant. 1637 if (instr->is_mach_constant()) { 1638 fprintf(fp," virtual void eval_constant(Compile* C);\n"); 1639 } 1640 1641 // Output the opcode function and the encode function here using the 1642 // encoding class information in the _insencode slot. 1643 if ( instr->_insencode ) { 1644 if (instr->postalloc_expands()) { 1645 fprintf(fp," virtual bool requires_postalloc_expand() const { return true; }\n"); 1646 fprintf(fp," virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_);\n"); 1647 } else { 1648 fprintf(fp," virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;\n"); 1649 } 1650 } 1782 if ( can_cisc_spill() && instr->is_cisc_alternate() ) { 1783 if ( node_flags_set ) { 1784 fprintf(fp," | Flag_is_cisc_alternate"); 1785 } else { 1786 fprintf(fp,"init_flags(Flag_is_cisc_alternate"); 1787 node_flags_set = true; 1788 } 1789 } 1790 1791 // flag: if this instruction has short branch form 1792 if ( instr->has_short_branch_form() ) { 1793 if ( node_flags_set ) { 1794 fprintf(fp," | Flag_may_be_short_branch"); 1795 } else { 1796 fprintf(fp,"init_flags(Flag_may_be_short_branch"); 1797 node_flags_set = true; 1798 } 1799 } 1800 1801 // flag: if this instruction should not be generated back to back. 1802 if ( avoid_back_to_back ) { 1803 if ( node_flags_set ) { 1804 fprintf(fp," | Flag_avoid_back_to_back"); 1805 } else { 1806 fprintf(fp,"init_flags(Flag_avoid_back_to_back"); 1807 node_flags_set = true; 1808 } 1809 } 1810 1811 // Check if machine instructions that USE memory, but do not DEF memory, 1812 // depend upon a node that defines memory in machine-independent graph. 1813 if ( instr->needs_anti_dependence_check(_globalNames) ) { 1814 if ( node_flags_set ) { 1815 fprintf(fp," | Flag_needs_anti_dependence_check"); 1816 } else { 1817 fprintf(fp,"init_flags(Flag_needs_anti_dependence_check"); 1818 node_flags_set = true; 1819 } 1820 } 1821 1822 // flag: if this instruction is implemented with a call 1823 if ( instr->_has_call ) { 1824 if ( node_flags_set ) { 1825 fprintf(fp," | Flag_has_call"); 1826 } else { | 1596 int label_position = instr->label_position(); 1597 if( label_position != -1 ) { 1598 // Set/Save the label, stored in labelOper::_branch_label 1599 fprintf(fp," virtual void label_set( Label* label, uint block_num );\n"); 1600 fprintf(fp," virtual void save_label( Label** label, uint* block_num );\n"); 1601 } 1602 1603 // If this instruction contains a methodOper 1604 // Declare Node::methods that set operand method's contents 1605 int method_position = instr->method_position(); 1606 if( method_position != -1 ) { 1607 // Set the address method, stored in methodOper::_method 1608 fprintf(fp," virtual void method_set( intptr_t method );\n"); 1609 } 1610 1611 // virtual functions for attributes 1612 // 1613 // Each instruction attribute results in a virtual call of same name. 1614 // The ins_cost is not handled here. 1615 Attribute *attr = instr->_attribs; 1616 Attribute *avoid_back_to_back_attr = NULL; 1617 while (attr != NULL) { 1618 if (strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") == 0) { 1619 fprintf(fp, " virtual bool is_TrapBasedCheckNode() const { return %s; }\n", attr->_val); 1620 } else if (strcmp (attr->_ident, "ins_cost") != 0 && 1621 strncmp(attr->_ident, "ins_field_", 10) != 0 && 1622 // Must match function in node.hpp: return type bool, no prefix "ins_". 1623 strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") != 0 && 1624 strcmp (attr->_ident, "ins_short_branch") != 0) { 1625 fprintf(fp, " virtual int %s() const { return %s; }\n", attr->_ident, attr->_val); 1626 } 1627 if (strcmp(attr->_ident, "ins_avoid_back_to_back") == 0) { 1628 avoid_back_to_back_attr = attr; 1629 } 1630 attr = (Attribute *)attr->_next; 1631 } 1632 1633 // virtual functions for encode and format 1634 1635 // Virtual function for evaluating the constant. 1636 if (instr->is_mach_constant()) { 1637 fprintf(fp," virtual void eval_constant(Compile* C);\n"); 1638 } 1639 1640 // Output the opcode function and the encode function here using the 1641 // encoding class information in the _insencode slot. 1642 if ( instr->_insencode ) { 1643 if (instr->postalloc_expands()) { 1644 fprintf(fp," virtual bool requires_postalloc_expand() const { return true; }\n"); 1645 fprintf(fp," virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_);\n"); 1646 } else { 1647 fprintf(fp," virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;\n"); 1648 } 1649 } 1781 if ( can_cisc_spill() && instr->is_cisc_alternate() ) { 1782 if ( node_flags_set ) { 1783 fprintf(fp," | Flag_is_cisc_alternate"); 1784 } else { 1785 fprintf(fp,"init_flags(Flag_is_cisc_alternate"); 1786 node_flags_set = true; 1787 } 1788 } 1789 1790 // flag: if this instruction has short branch form 1791 if ( instr->has_short_branch_form() ) { 1792 if ( node_flags_set ) { 1793 fprintf(fp," | Flag_may_be_short_branch"); 1794 } else { 1795 fprintf(fp,"init_flags(Flag_may_be_short_branch"); 1796 node_flags_set = true; 1797 } 1798 } 1799 1800 // flag: if this instruction should not be generated back to back. 1801 if (avoid_back_to_back_attr != NULL) { 1802 if (node_flags_set) { 1803 fprintf(fp," | (%s)", avoid_back_to_back_attr->_val); 1804 } else { 1805 fprintf(fp,"init_flags((%s)", avoid_back_to_back_attr->_val); 1806 node_flags_set = true; 1807 } 1808 } 1809 1810 // Check if machine instructions that USE memory, but do not DEF memory, 1811 // depend upon a node that defines memory in machine-independent graph. 1812 if ( instr->needs_anti_dependence_check(_globalNames) ) { 1813 if ( node_flags_set ) { 1814 fprintf(fp," | Flag_needs_anti_dependence_check"); 1815 } else { 1816 fprintf(fp,"init_flags(Flag_needs_anti_dependence_check"); 1817 node_flags_set = true; 1818 } 1819 } 1820 1821 // flag: if this instruction is implemented with a call 1822 if ( instr->_has_call ) { 1823 if ( node_flags_set ) { 1824 fprintf(fp," | Flag_has_call"); 1825 } else { |