# HG changeset patch # User goetz # Date 1379604702 -7200 # Node ID 8f09b12a0e30ef9fcae6140980850aecfdfd8162 # Parent cfd05ec7408902867698efaf58befe97dcac6461 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. diff --git a/src/share/vm/adlc/output_h.cpp b/src/share/vm/adlc/output_h.cpp --- a/src/share/vm/adlc/output_h.cpp +++ b/src/share/vm/adlc/output_h.cpp @@ -1539,7 +1539,20 @@ if ( instr->is_ideal_jump() ) { fprintf(fp, " GrowableArray _index2label;\n"); } - fprintf(fp,"public:\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"); @@ -1586,8 +1599,9 @@ 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")) { + 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); }