comparison src/share/vm/adlc/output_h.cpp @ 14419:7373e44fa207

8024922: PPC64 (part 116): Extend adlc to generate fields into nodes. Summary: Similar to specifying functions returning constants (as ins_avoid_back_to_back()) adlc now accepts specifications with prefix ins_field_xxx(tp) and adds field xxx of type tp to the node. Reviewed-by: kvn
author goetz
date Thu, 19 Sep 2013 17:31:42 +0200
parents 705ef39fcaa9
children 2b8e28fdf503
comparison
equal deleted inserted replaced
14418:cfd05ec74089 14419:7373e44fa207
1537 fprintf(fp,"private:\n"); 1537 fprintf(fp,"private:\n");
1538 fprintf(fp," MachOper *_opnd_array[%d];\n", instr->num_opnds() ); 1538 fprintf(fp," MachOper *_opnd_array[%d];\n", instr->num_opnds() );
1539 if ( instr->is_ideal_jump() ) { 1539 if ( instr->is_ideal_jump() ) {
1540 fprintf(fp, " GrowableArray<Label*> _index2label;\n"); 1540 fprintf(fp, " GrowableArray<Label*> _index2label;\n");
1541 } 1541 }
1542 fprintf(fp,"public:\n"); 1542
1543 fprintf(fp, "public:\n");
1544
1545 Attribute *att = instr->_attribs;
1546 // Fields of the node specified in the ad file.
1547 while (att != NULL) {
1548 if (strncmp(att->_ident, "ins_field_", 10) == 0) {
1549 const char *field_name = att->_ident+10;
1550 const char *field_type = att->_val;
1551 fprintf(fp, " %s _%s;\n", field_type, field_name);
1552 }
1553 att = (Attribute *)att->_next;
1554 }
1555
1543 fprintf(fp," MachOper *opnd_array(uint operand_index) const {\n"); 1556 fprintf(fp," MachOper *opnd_array(uint operand_index) const {\n");
1544 fprintf(fp," assert(operand_index < _num_opnds, \"invalid _opnd_array index\");\n"); 1557 fprintf(fp," assert(operand_index < _num_opnds, \"invalid _opnd_array index\");\n");
1545 fprintf(fp," return _opnd_array[operand_index];\n"); 1558 fprintf(fp," return _opnd_array[operand_index];\n");
1546 fprintf(fp," }\n"); 1559 fprintf(fp," }\n");
1547 fprintf(fp," void set_opnd_array(uint operand_index, MachOper *operand) {\n"); 1560 fprintf(fp," void set_opnd_array(uint operand_index, MachOper *operand) {\n");
1584 // Each instruction attribute results in a virtual call of same name. 1597 // Each instruction attribute results in a virtual call of same name.
1585 // The ins_cost is not handled here. 1598 // The ins_cost is not handled here.
1586 Attribute *attr = instr->_attribs; 1599 Attribute *attr = instr->_attribs;
1587 bool avoid_back_to_back = false; 1600 bool avoid_back_to_back = false;
1588 while (attr != NULL) { 1601 while (attr != NULL) {
1589 if (strcmp(attr->_ident,"ins_cost") && 1602 if (strcmp (attr->_ident,"ins_cost") &&
1590 strcmp(attr->_ident,"ins_short_branch")) { 1603 strncmp(attr->_ident,"ins_field_", 10) != 0 &&
1604 strcmp (attr->_ident,"ins_short_branch")) {
1591 fprintf(fp," int %s() const { return %s; }\n", 1605 fprintf(fp," int %s() const { return %s; }\n",
1592 attr->_ident, attr->_val); 1606 attr->_ident, attr->_val);
1593 } 1607 }
1594 // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag 1608 // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag
1595 if (!strcmp(attr->_ident,"ins_avoid_back_to_back") && attr->int_val(*this) != 0) 1609 if (!strcmp(attr->_ident,"ins_avoid_back_to_back") && attr->int_val(*this) != 0)