From 7ac269079a8270b2b9af2e8f33d89c9a7b8608b4 Mon Sep 17 00:00:00 2001 From: goetz Date: Thu, 19 Sep 2013 17:31:42 +0200 Subject: [PATCH] 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 --- src/share/vm/adlc/output_h.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/share/vm/adlc/output_h.cpp b/src/share/vm/adlc/output_h.cpp index 3fdaf39e8..8490109bf 100644 --- a/src/share/vm/adlc/output_h.cpp +++ b/src/share/vm/adlc/output_h.cpp @@ -1539,7 +1539,20 @@ void ArchDesc::declareClasses(FILE *fp) { 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 @@ void ArchDesc::declareClasses(FILE *fp) { 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); } -- GitLab