1534 // virtual functions for attributes |
1534 // virtual functions for attributes |
1535 // |
1535 // |
1536 // Each instruction attribute results in a virtual call of same name. |
1536 // Each instruction attribute results in a virtual call of same name. |
1537 // The ins_cost is not handled here. |
1537 // The ins_cost is not handled here. |
1538 Attribute *attr = instr->_attribs; |
1538 Attribute *attr = instr->_attribs; |
|
1539 bool avoid_back_to_back = false; |
1539 while (attr != NULL) { |
1540 while (attr != NULL) { |
1540 if (strcmp(attr->_ident,"ins_cost") && |
1541 if (strcmp(attr->_ident,"ins_cost") && |
1541 strcmp(attr->_ident,"ins_short_branch")) { |
1542 strcmp(attr->_ident,"ins_short_branch")) { |
1542 fprintf(fp," int %s() const { return %s; }\n", |
1543 fprintf(fp," int %s() const { return %s; }\n", |
1543 attr->_ident, attr->_val); |
1544 attr->_ident, attr->_val); |
1544 } |
1545 } |
|
1546 // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag |
|
1547 if (!strcmp(attr->_ident,"ins_avoid_back_to_back") && attr->int_val(*this) != 0) |
|
1548 avoid_back_to_back = true; |
1545 attr = (Attribute *)attr->_next; |
1549 attr = (Attribute *)attr->_next; |
1546 } |
1550 } |
1547 |
1551 |
1548 // virtual functions for encode and format |
1552 // virtual functions for encode and format |
1549 |
1553 |
1698 if ( instr->has_short_branch_form() ) { |
1702 if ( instr->has_short_branch_form() ) { |
1699 if ( node_flags_set ) { |
1703 if ( node_flags_set ) { |
1700 fprintf(fp," | Flag_may_be_short_branch"); |
1704 fprintf(fp," | Flag_may_be_short_branch"); |
1701 } else { |
1705 } else { |
1702 fprintf(fp,"init_flags(Flag_may_be_short_branch"); |
1706 fprintf(fp,"init_flags(Flag_may_be_short_branch"); |
|
1707 node_flags_set = true; |
|
1708 } |
|
1709 } |
|
1710 |
|
1711 // flag: if this instruction should not be generated back to back. |
|
1712 if ( avoid_back_to_back ) { |
|
1713 if ( node_flags_set ) { |
|
1714 fprintf(fp," | Flag_avoid_back_to_back"); |
|
1715 } else { |
|
1716 fprintf(fp,"init_flags(Flag_avoid_back_to_back"); |
1703 node_flags_set = true; |
1717 node_flags_set = true; |
1704 } |
1718 } |
1705 } |
1719 } |
1706 |
1720 |
1707 // Check if machine instructions that USE memory, but do not DEF memory, |
1721 // Check if machine instructions that USE memory, but do not DEF memory, |