1611 // virtual functions for attributes |
1611 // virtual functions for attributes |
1612 // |
1612 // |
1613 // Each instruction attribute results in a virtual call of same name. |
1613 // Each instruction attribute results in a virtual call of same name. |
1614 // The ins_cost is not handled here. |
1614 // The ins_cost is not handled here. |
1615 Attribute *attr = instr->_attribs; |
1615 Attribute *attr = instr->_attribs; |
1616 bool avoid_back_to_back = false; |
1616 Attribute *avoid_back_to_back_attr = NULL; |
1617 while (attr != NULL) { |
1617 while (attr != NULL) { |
1618 if (strcmp (attr->_ident, "ins_cost") != 0 && |
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 && |
1619 strncmp(attr->_ident, "ins_field_", 10) != 0 && |
1621 strncmp(attr->_ident, "ins_field_", 10) != 0 && |
1620 // Must match function in node.hpp: return type bool, no prefix "ins_". |
1622 // Must match function in node.hpp: return type bool, no prefix "ins_". |
1621 strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") != 0 && |
1623 strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") != 0 && |
1622 strcmp (attr->_ident, "ins_short_branch") != 0) { |
1624 strcmp (attr->_ident, "ins_short_branch") != 0) { |
1623 fprintf(fp, " virtual int %s() const { return %s; }\n", attr->_ident, attr->_val); |
1625 fprintf(fp, " virtual int %s() const { return %s; }\n", attr->_ident, attr->_val); |
1624 } |
1626 } |
1625 // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag |
1627 if (strcmp(attr->_ident, "ins_avoid_back_to_back") == 0) { |
1626 if (!strcmp(attr->_ident, "ins_avoid_back_to_back") != 0 && attr->int_val(*this) != 0) |
1628 avoid_back_to_back_attr = attr; |
1627 avoid_back_to_back = true; |
1629 } |
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; |
1630 attr = (Attribute *)attr->_next; |
1632 } |
1631 } |
1633 |
1632 |
1634 // virtual functions for encode and format |
1633 // virtual functions for encode and format |
1635 |
1634 |
1797 node_flags_set = true; |
1796 node_flags_set = true; |
1798 } |
1797 } |
1799 } |
1798 } |
1800 |
1799 |
1801 // flag: if this instruction should not be generated back to back. |
1800 // flag: if this instruction should not be generated back to back. |
1802 if ( avoid_back_to_back ) { |
1801 if (avoid_back_to_back_attr != NULL) { |
1803 if ( node_flags_set ) { |
1802 if (node_flags_set) { |
1804 fprintf(fp," | Flag_avoid_back_to_back"); |
1803 fprintf(fp," | (%s)", avoid_back_to_back_attr->_val); |
1805 } else { |
1804 } else { |
1806 fprintf(fp,"init_flags(Flag_avoid_back_to_back"); |
1805 fprintf(fp,"init_flags((%s)", avoid_back_to_back_attr->_val); |
1807 node_flags_set = true; |
1806 node_flags_set = true; |
1808 } |
1807 } |
1809 } |
1808 } |
1810 |
1809 |
1811 // Check if machine instructions that USE memory, but do not DEF memory, |
1810 // Check if machine instructions that USE memory, but do not DEF memory, |