src/share/vm/adlc/output_h.cpp

Print this page
rev 5191 : 8024922: PPC64 (part 116): Extend adlc to generate fields into nodes.
Summary: Similar to secifying 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.

*** 1537,1547 **** fprintf(fp,"private:\n"); fprintf(fp," MachOper *_opnd_array[%d];\n", instr->num_opnds() ); if ( instr->is_ideal_jump() ) { fprintf(fp, " GrowableArray<Label*> _index2label;\n"); } ! fprintf(fp,"public:\n"); fprintf(fp," MachOper *opnd_array(uint operand_index) const {\n"); fprintf(fp," assert(operand_index < _num_opnds, \"invalid _opnd_array index\");\n"); fprintf(fp," return _opnd_array[operand_index];\n"); fprintf(fp," }\n"); fprintf(fp," void set_opnd_array(uint operand_index, MachOper *operand) {\n"); --- 1537,1560 ---- fprintf(fp,"private:\n"); fprintf(fp," MachOper *_opnd_array[%d];\n", instr->num_opnds() ); if ( instr->is_ideal_jump() ) { fprintf(fp, " GrowableArray<Label*> _index2label;\n"); } ! ! fprintf(fp, "public:\n"); ! ! Attribute *att = instr->_attribs; ! // Fields of the node specified in the ad file. ! while (att != NULL) { ! if (strncmp(att->_ident, "ins_field_", 10) == 0) { ! const char *field_name = att->_ident+10; ! const char *field_type = att->_val; ! fprintf(fp, " %s _%s;\n", field_type, field_name); ! } ! att = (Attribute *)att->_next; ! } ! fprintf(fp," MachOper *opnd_array(uint operand_index) const {\n"); fprintf(fp," assert(operand_index < _num_opnds, \"invalid _opnd_array index\");\n"); fprintf(fp," return _opnd_array[operand_index];\n"); fprintf(fp," }\n"); fprintf(fp," void set_opnd_array(uint operand_index, MachOper *operand) {\n");
*** 1584,1595 **** // Each instruction attribute results in a virtual call of same name. // The ins_cost is not handled here. Attribute *attr = instr->_attribs; bool avoid_back_to_back = false; while (attr != NULL) { ! if (strcmp(attr->_ident,"ins_cost") && ! strcmp(attr->_ident,"ins_short_branch")) { fprintf(fp," int %s() const { return %s; }\n", attr->_ident, attr->_val); } // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag if (!strcmp(attr->_ident,"ins_avoid_back_to_back") && attr->int_val(*this) != 0) --- 1597,1609 ---- // Each instruction attribute results in a virtual call of same name. // The ins_cost is not handled here. Attribute *attr = instr->_attribs; bool avoid_back_to_back = false; while (attr != NULL) { ! if (strcmp (attr->_ident,"ins_cost") && ! strncmp(attr->_ident,"ins_field_", 10) != 0 && ! strcmp (attr->_ident,"ins_short_branch")) { fprintf(fp," int %s() const { return %s; }\n", attr->_ident, attr->_val); } // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag if (!strcmp(attr->_ident,"ins_avoid_back_to_back") && attr->int_val(*this) != 0)