src/share/vm/adlc/output_c.cpp

changeset 4161
d336b3173277
parent 4159
8e47bac5643a
child 4906
705ef39fcaa9
     1.1 --- a/src/share/vm/adlc/output_c.cpp	Tue Oct 09 12:40:05 2012 -0700
     1.2 +++ b/src/share/vm/adlc/output_c.cpp	Tue Oct 09 16:09:31 2012 -0700
     1.3 @@ -518,6 +518,14 @@
     1.4  
     1.5      int cycles = piperesource->_cycles;
     1.6      uint stage          = pipeline->_stages.index(piperesource->_stage);
     1.7 +    if (NameList::Not_in_list == stage) {
     1.8 +      fprintf(stderr,
     1.9 +              "pipeline_res_mask_initializer: "
    1.10 +              "semantic error: "
    1.11 +              "pipeline stage undeclared: %s\n",
    1.12 +              piperesource->_stage);
    1.13 +      exit(1);
    1.14 +    }
    1.15      uint upper_limit    = stage+cycles-1;
    1.16      uint lower_limit    = stage-1;
    1.17      uint upper_idx      = upper_limit >> 5;
    1.18 @@ -1000,7 +1008,7 @@
    1.19    }
    1.20    fprintf(fp_cpp, "};\n\n");
    1.21    fprintf(fp_cpp, "#ifndef PRODUCT\n");
    1.22 -  fprintf(fp_cpp, "void Bundle::dump() const {\n");
    1.23 +  fprintf(fp_cpp, "void Bundle::dump(outputStream *st) const {\n");
    1.24    fprintf(fp_cpp, "  static const char * bundle_flags[] = {\n");
    1.25    fprintf(fp_cpp, "    \"\",\n");
    1.26    fprintf(fp_cpp, "    \"use nop delay\",\n");
    1.27 @@ -1019,22 +1027,22 @@
    1.28    // See if the same string is in the table
    1.29    fprintf(fp_cpp, "  bool needs_comma = false;\n\n");
    1.30    fprintf(fp_cpp, "  if (_flags) {\n");
    1.31 -  fprintf(fp_cpp, "    tty->print(\"%%s\", bundle_flags[_flags]);\n");
    1.32 +  fprintf(fp_cpp, "    st->print(\"%%s\", bundle_flags[_flags]);\n");
    1.33    fprintf(fp_cpp, "    needs_comma = true;\n");
    1.34    fprintf(fp_cpp, "  };\n");
    1.35    fprintf(fp_cpp, "  if (instr_count()) {\n");
    1.36 -  fprintf(fp_cpp, "    tty->print(\"%%s%%d instr%%s\", needs_comma ? \", \" : \"\", instr_count(), instr_count() != 1 ? \"s\" : \"\");\n");
    1.37 +  fprintf(fp_cpp, "    st->print(\"%%s%%d instr%%s\", needs_comma ? \", \" : \"\", instr_count(), instr_count() != 1 ? \"s\" : \"\");\n");
    1.38    fprintf(fp_cpp, "    needs_comma = true;\n");
    1.39    fprintf(fp_cpp, "  };\n");
    1.40    fprintf(fp_cpp, "  uint r = resources_used();\n");
    1.41    fprintf(fp_cpp, "  if (r) {\n");
    1.42 -  fprintf(fp_cpp, "    tty->print(\"%%sresource%%s:\", needs_comma ? \", \" : \"\", (r & (r-1)) != 0 ? \"s\" : \"\");\n");
    1.43 +  fprintf(fp_cpp, "    st->print(\"%%sresource%%s:\", needs_comma ? \", \" : \"\", (r & (r-1)) != 0 ? \"s\" : \"\");\n");
    1.44    fprintf(fp_cpp, "    for (uint i = 0; i < %d; i++)\n", _pipeline->_rescount);
    1.45    fprintf(fp_cpp, "      if ((r & (1 << i)) != 0)\n");
    1.46 -  fprintf(fp_cpp, "        tty->print(\" %%s\", resource_names[i]);\n");
    1.47 +  fprintf(fp_cpp, "        st->print(\" %%s\", resource_names[i]);\n");
    1.48    fprintf(fp_cpp, "    needs_comma = true;\n");
    1.49    fprintf(fp_cpp, "  };\n");
    1.50 -  fprintf(fp_cpp, "  tty->print(\"\\n\");\n");
    1.51 +  fprintf(fp_cpp, "  st->print(\"\\n\");\n");
    1.52    fprintf(fp_cpp, "}\n");
    1.53    fprintf(fp_cpp, "#endif\n");
    1.54  }
    1.55 @@ -1048,39 +1056,6 @@
    1.56            node, regMask);
    1.57  }
    1.58  
    1.59 -// Scan the peepmatch and output a test for each instruction
    1.60 -static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) {
    1.61 -  int         parent        = -1;
    1.62 -  int         inst_position = 0;
    1.63 -  const char* inst_name     = NULL;
    1.64 -  int         input         = 0;
    1.65 -  fprintf(fp, "      // Check instruction sub-tree\n");
    1.66 -  pmatch->reset();
    1.67 -  for( pmatch->next_instruction( parent, inst_position, inst_name, input );
    1.68 -       inst_name != NULL;
    1.69 -       pmatch->next_instruction( parent, inst_position, inst_name, input ) ) {
    1.70 -    // If this is not a placeholder
    1.71 -    if( ! pmatch->is_placeholder() ) {
    1.72 -      // Define temporaries 'inst#', based on parent and parent's input index
    1.73 -      if( parent != -1 ) {                // root was initialized
    1.74 -        fprintf(fp, "  inst%d = inst%d->in(%d);\n",
    1.75 -                inst_position, parent, input);
    1.76 -      }
    1.77 -
    1.78 -      // When not the root
    1.79 -      // Test we have the correct instruction by comparing the rule
    1.80 -      if( parent != -1 ) {
    1.81 -        fprintf(fp, "  matches = matches &&  ( inst%d->rule() == %s_rule );",
    1.82 -                inst_position, inst_name);
    1.83 -      }
    1.84 -    } else {
    1.85 -      // Check that user did not try to constrain a placeholder
    1.86 -      assert( ! pconstraint->constrains_instruction(inst_position),
    1.87 -              "fatal(): Can not constrain a placeholder instruction");
    1.88 -    }
    1.89 -  }
    1.90 -}
    1.91 -
    1.92  static void print_block_index(FILE *fp, int inst_position) {
    1.93    assert( inst_position >= 0, "Instruction number less than zero");
    1.94    fprintf(fp, "block_index");
    1.95 @@ -1242,7 +1217,7 @@
    1.96          if( left_op_index != 0 ) {
    1.97            assert( (left_index <= 9999) && (left_op_index <= 9999), "exceed string size");
    1.98            // Must have index into operands
    1.99 -          sprintf(left_reg_index,",inst%d_idx%d", left_index, left_op_index);
   1.100 +          sprintf(left_reg_index,",inst%d_idx%d", (int)left_index, left_op_index);
   1.101          } else {
   1.102            strcpy(left_reg_index, "");
   1.103          }
   1.104 @@ -1255,7 +1230,7 @@
   1.105            if( right_op_index != 0 ) {
   1.106              assert( (right_index <= 9999) && (right_op_index <= 9999), "exceed string size");
   1.107              // Must have index into operands
   1.108 -            sprintf(right_reg_index,",inst%d_idx%d", right_index, right_op_index);
   1.109 +            sprintf(right_reg_index,",inst%d_idx%d", (int)right_index, right_op_index);
   1.110            } else {
   1.111              strcpy(right_reg_index, "");
   1.112            }
   1.113 @@ -1645,7 +1620,7 @@
   1.114            new_pos = new_inst->operand_position(parameter,Component::USE);
   1.115            exp_pos += node->num_opnds();
   1.116            // If there is no use of the created operand, just skip it
   1.117 -          if (new_pos != -1) {
   1.118 +          if (new_pos != NameList::Not_in_list) {
   1.119              //Copy the operand from the original made above
   1.120              fprintf(fp,"  n%d->set_opnd_array(%d, op%d->clone(C)); // %s\n",
   1.121                      cnt, new_pos, exp_pos-node->num_opnds(), opid);
   1.122 @@ -1789,7 +1764,8 @@
   1.123        // Build mapping from num_edges to local variables
   1.124        fprintf(fp,"  unsigned num0 = 0;\n");
   1.125        for( i = 1; i < cur_num_opnds; i++ ) {
   1.126 -        fprintf(fp,"  unsigned num%d = opnd_array(%d)->num_edges();\n",i,i);
   1.127 +        fprintf(fp,"  unsigned num%d = opnd_array(%d)->num_edges();",i,i);
   1.128 +        fprintf(fp, " \t// %s\n", node->opnd_ident(i));
   1.129        }
   1.130        // Build a mapping from operand index to input edges
   1.131        fprintf(fp,"  unsigned idx0 = oper_input_base();\n");
   1.132 @@ -1934,6 +1910,7 @@
   1.133    }
   1.134  
   1.135    // Track necessary state when identifying a replacement variable
   1.136 +  // @arg rep_var: The formal parameter of the encoding.
   1.137    void update_state(const char *rep_var) {
   1.138      // A replacement variable or one of its subfields
   1.139      // Obtain replacement variable from list
   1.140 @@ -1955,7 +1932,7 @@
   1.141          }
   1.142        }
   1.143        else {
   1.144 -        // Lookup its position in parameter list
   1.145 +        // Lookup its position in (formal) parameter list of encoding
   1.146          int   param_no  = _encoding.rep_var_index(rep_var);
   1.147          if ( param_no == -1 ) {
   1.148            _AD.syntax_err( _encoding._linenum,
   1.149 @@ -1964,6 +1941,7 @@
   1.150          }
   1.151  
   1.152          // Lookup the corresponding ins_encode parameter
   1.153 +        // This is the argument (actual parameter) to the encoding.
   1.154          const char *inst_rep_var = _ins_encode.rep_var_name(_inst, param_no);
   1.155          if (inst_rep_var == NULL) {
   1.156            _AD.syntax_err( _ins_encode._linenum,
   1.157 @@ -2329,6 +2307,7 @@
   1.158            // Add parameter for index position, if not result operand
   1.159            if( _operand_idx != 0 ) fprintf(_fp,",idx%d", _operand_idx);
   1.160            fprintf(_fp,")");
   1.161 +          fprintf(_fp, "/* %s */", _operand_name);
   1.162          }
   1.163        } else {
   1.164          assert( _reg_status == LITERAL_OUTPUT, "should have output register literal in emit_rep_var");
   1.165 @@ -2368,7 +2347,7 @@
   1.166          }
   1.167        } else {
   1.168          assert( _constant_status == LITERAL_OUTPUT, "should have output constant literal in emit_rep_var");
   1.169 -        // Cosntant literal has already been sent to output file, nothing more needed
   1.170 +        // Constant literal has already been sent to output file, nothing more needed
   1.171        }
   1.172      }
   1.173      else if ( strcmp(rep_var,"$disp") == 0 ) {
   1.174 @@ -2387,6 +2366,8 @@
   1.175      }
   1.176      else {
   1.177        printf("emit_field: %s\n",rep_var);
   1.178 +      globalAD->syntax_err(_inst._linenum, "Unknown replacement variable %s in format statement of %s.",
   1.179 +                           rep_var, _inst._ident);
   1.180        assert( false, "UnImplemented()");
   1.181      }
   1.182    }
   1.183 @@ -2484,14 +2465,14 @@
   1.184  
   1.185    //(1)
   1.186    // Output instruction's emit prototype
   1.187 -  fprintf(fp,"uint  %sNode::size(PhaseRegAlloc *ra_) const {\n",
   1.188 +  fprintf(fp,"uint %sNode::size(PhaseRegAlloc *ra_) const {\n",
   1.189            inst._ident);
   1.190  
   1.191 -  fprintf(fp, " assert(VerifyOops || MachNode::size(ra_) <= %s, \"bad fixed size\");\n", inst._size);
   1.192 +  fprintf(fp, "  assert(VerifyOops || MachNode::size(ra_) <= %s, \"bad fixed size\");\n", inst._size);
   1.193  
   1.194    //(2)
   1.195    // Print the size
   1.196 -  fprintf(fp, " return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
   1.197 +  fprintf(fp, "  return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
   1.198  
   1.199    // (3) and (4)
   1.200    fprintf(fp,"}\n");
   1.201 @@ -2579,7 +2560,7 @@
   1.202    }
   1.203  
   1.204    // (3) and (4)
   1.205 -  fprintf(fp, "}\n");
   1.206 +  fprintf(fp, "}\n\n");
   1.207  }
   1.208  
   1.209  // defineEvalConstant ---------------------------------------------------------
   1.210 @@ -2727,12 +2708,12 @@
   1.211  // (2)  }
   1.212  //
   1.213  static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) {
   1.214 -  fprintf(fp,"MachOper  *%sOper::clone(Compile* C) const {\n", oper._ident);
   1.215 +  fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper._ident);
   1.216    // Check for constants that need to be copied over
   1.217    const int  num_consts    = oper.num_consts(globalNames);
   1.218    const bool is_ideal_bool = oper.is_ideal_bool();
   1.219    if( (num_consts > 0) ) {
   1.220 -    fprintf(fp,"  return  new (C) %sOper(", oper._ident);
   1.221 +    fprintf(fp,"  return new (C) %sOper(", oper._ident);
   1.222      // generate parameters for constants
   1.223      int i = 0;
   1.224      fprintf(fp,"_c%d", i);
   1.225 @@ -2744,21 +2725,12 @@
   1.226    }
   1.227    else {
   1.228      assert( num_consts == 0, "Currently support zero or one constant per operand clone function");
   1.229 -    fprintf(fp,"  return  new (C) %sOper();\n", oper._ident);
   1.230 +    fprintf(fp,"  return new (C) %sOper();\n", oper._ident);
   1.231    }
   1.232    // finish method
   1.233    fprintf(fp,"}\n");
   1.234  }
   1.235  
   1.236 -static void define_hash(FILE *fp, char *operand) {
   1.237 -  fprintf(fp,"uint %sOper::hash() const { return 5; }\n", operand);
   1.238 -}
   1.239 -
   1.240 -static void define_cmp(FILE *fp, char *operand) {
   1.241 -  fprintf(fp,"uint %sOper::cmp( const MachOper &oper ) const { return opcode() == oper.opcode(); }\n", operand);
   1.242 -}
   1.243 -
   1.244 -
   1.245  // Helper functions for bug 4796752, abstracted with minimal modification
   1.246  // from define_oper_interface()
   1.247  OperandForm *rep_var_to_operand(const char *encoding, OperandForm &oper, FormDict &globals) {
   1.248 @@ -2852,14 +2824,14 @@
   1.249    } else if ( (strcmp(name,"disp") == 0) ) {
   1.250      fprintf(fp,"(PhaseRegAlloc *ra_, const Node *node, int idx) const { \n");
   1.251    } else {
   1.252 -    fprintf(fp,"() const { ");
   1.253 +    fprintf(fp,"() const { \n");
   1.254    }
   1.255  
   1.256    // Check for hexadecimal value OR replacement variable
   1.257    if( *encoding == '$' ) {
   1.258      // Replacement variable
   1.259      const char *rep_var = encoding + 1;
   1.260 -    fprintf(fp,"// Replacement variable: %s\n", encoding+1);
   1.261 +    fprintf(fp,"    // Replacement variable: %s\n", encoding+1);
   1.262      // Lookup replacement variable, rep_var, in operand's component list
   1.263      const Component *comp = oper._components.search(rep_var);
   1.264      assert( comp != NULL, "Replacement variable not found in components");
   1.265 @@ -2880,10 +2852,10 @@
   1.266      } else if ( op->ideal_to_sReg_type(op->_ident) != Form::none ) {
   1.267        // StackSlot for an sReg comes either from input node or from self, when idx==0
   1.268        fprintf(fp,"    if( idx != 0 ) {\n");
   1.269 -      fprintf(fp,"      // Access register number for input operand\n");
   1.270 +      fprintf(fp,"      // Access stack offset (register number) for input operand\n");
   1.271        fprintf(fp,"      return ra_->reg2offset(ra_->get_reg_first(node->in(idx)));/* sReg */\n");
   1.272        fprintf(fp,"    }\n");
   1.273 -      fprintf(fp,"    // Access register number from myself\n");
   1.274 +      fprintf(fp,"    // Access stack offset (register number) from myself\n");
   1.275        fprintf(fp,"    return ra_->reg2offset(ra_->get_reg_first(node));/* sReg */\n");
   1.276      } else if (op->_matrule && op->_matrule->is_base_constant(globals)) {
   1.277        // Constant
   1.278 @@ -2900,7 +2872,7 @@
   1.279    }
   1.280    else if( *encoding == '0' && *(encoding+1) == 'x' ) {
   1.281      // Hex value
   1.282 -    fprintf(fp,"return %s;", encoding);
   1.283 +    fprintf(fp,"    return %s;\n", encoding);
   1.284    } else {
   1.285      assert( false, "Do not support octal or decimal encode constants");
   1.286    }
   1.287 @@ -3133,8 +3105,8 @@
   1.288      // Output the definition for number of relocation entries
   1.289      uint reloc_size = instr->reloc(_globalNames);
   1.290      if ( reloc_size != 0 ) {
   1.291 -      fprintf(fp,"int  %sNode::reloc()   const {\n", instr->_ident);
   1.292 -      fprintf(fp,  "  return  %d;\n", reloc_size );
   1.293 +      fprintf(fp,"int %sNode::reloc() const {\n", instr->_ident);
   1.294 +      fprintf(fp,"  return %d;\n", reloc_size);
   1.295        fprintf(fp,"}\n");
   1.296        fprintf(fp,"\n");
   1.297      }
   1.298 @@ -3241,7 +3213,7 @@
   1.299  class OutputReduceOp : public OutputMap {
   1.300  public:
   1.301    OutputReduceOp(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
   1.302 -    : OutputMap(hpp, cpp, globals, AD) {};
   1.303 +    : OutputMap(hpp, cpp, globals, AD, "reduceOp") {};
   1.304  
   1.305    void declaration() { fprintf(_hpp, "extern const int   reduceOp[];\n"); }
   1.306    void definition()  { fprintf(_cpp, "const        int   reduceOp[] = {\n"); }
   1.307 @@ -3276,7 +3248,7 @@
   1.308  class OutputLeftOp : public OutputMap {
   1.309  public:
   1.310    OutputLeftOp(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
   1.311 -    : OutputMap(hpp, cpp, globals, AD) {};
   1.312 +    : OutputMap(hpp, cpp, globals, AD, "leftOp") {};
   1.313  
   1.314    void declaration() { fprintf(_hpp, "extern const int   leftOp[];\n"); }
   1.315    void definition()  { fprintf(_cpp, "const        int   leftOp[] = {\n"); }
   1.316 @@ -3306,7 +3278,7 @@
   1.317  class OutputRightOp : public OutputMap {
   1.318  public:
   1.319    OutputRightOp(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
   1.320 -    : OutputMap(hpp, cpp, globals, AD) {};
   1.321 +    : OutputMap(hpp, cpp, globals, AD, "rightOp") {};
   1.322  
   1.323    void declaration() { fprintf(_hpp, "extern const int   rightOp[];\n"); }
   1.324    void definition()  { fprintf(_cpp, "const        int   rightOp[] = {\n"); }
   1.325 @@ -3336,11 +3308,11 @@
   1.326  class OutputRuleName : public OutputMap {
   1.327  public:
   1.328    OutputRuleName(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
   1.329 -    : OutputMap(hpp, cpp, globals, AD) {};
   1.330 +    : OutputMap(hpp, cpp, globals, AD, "ruleName") {};
   1.331  
   1.332    void declaration() { fprintf(_hpp, "extern const char *ruleName[];\n"); }
   1.333    void definition()  { fprintf(_cpp, "const char        *ruleName[] = {\n"); }
   1.334 -  void closing()     { fprintf(_cpp, "  \"no trailing comma\"\n");
   1.335 +  void closing()     { fprintf(_cpp, "  \"invalid rule name\" // no trailing comma\n");
   1.336                         OutputMap::closing();
   1.337    }
   1.338    void map(OpClassForm &opc)  { fprintf(_cpp, "  \"%s\"", _AD.machOperEnum(opc._ident) ); }
   1.339 @@ -3354,7 +3326,7 @@
   1.340  class OutputSwallowed : public OutputMap {
   1.341  public:
   1.342    OutputSwallowed(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
   1.343 -    : OutputMap(hpp, cpp, globals, AD) {};
   1.344 +    : OutputMap(hpp, cpp, globals, AD, "swallowed") {};
   1.345  
   1.346    void declaration() { fprintf(_hpp, "extern const bool  swallowed[];\n"); }
   1.347    void definition()  { fprintf(_cpp, "const        bool  swallowed[] = {\n"); }
   1.348 @@ -3375,7 +3347,7 @@
   1.349  class OutputInstChainRule : public OutputMap {
   1.350  public:
   1.351    OutputInstChainRule(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
   1.352 -    : OutputMap(hpp, cpp, globals, AD) {};
   1.353 +    : OutputMap(hpp, cpp, globals, AD, "instruction_chain_rule") {};
   1.354  
   1.355    void declaration() { fprintf(_hpp, "extern const bool  instruction_chain_rule[];\n"); }
   1.356    void definition()  { fprintf(_cpp, "const        bool  instruction_chain_rule[] = {\n"); }
   1.357 @@ -3416,7 +3388,7 @@
   1.358      if ( op->ideal_only() )  continue;
   1.359  
   1.360      // Generate the entry for this opcode
   1.361 -    map.map(*op);    fprintf(fp_cpp, ", // %d\n", idx);
   1.362 +    fprintf(fp_cpp, "  /* %4d */", idx); map.map(*op); fprintf(fp_cpp, ",\n");
   1.363      ++idx;
   1.364    };
   1.365    fprintf(fp_cpp, "  // last operand\n");
   1.366 @@ -3425,7 +3397,7 @@
   1.367    map.record_position(OutputMap::BEGIN_OPCLASSES, idx );
   1.368    _opclass.reset();
   1.369    for(; (opc = (OpClassForm*)_opclass.iter()) != NULL; ) {
   1.370 -    map.map(*opc);    fprintf(fp_cpp, ", // %d\n", idx);
   1.371 +    fprintf(fp_cpp, "  /* %4d */", idx); map.map(*opc); fprintf(fp_cpp, ",\n");
   1.372      ++idx;
   1.373    };
   1.374    fprintf(fp_cpp, "  // last operand class\n");
   1.375 @@ -3435,7 +3407,7 @@
   1.376    _internalOpNames.reset();
   1.377    char *name = NULL;
   1.378    for(; (name = (char *)_internalOpNames.iter()) != NULL; ) {
   1.379 -    map.map(name);    fprintf(fp_cpp, ", // %d\n", idx);
   1.380 +    fprintf(fp_cpp, "  /* %4d */", idx); map.map(name); fprintf(fp_cpp, ",\n");
   1.381      ++idx;
   1.382    };
   1.383    fprintf(fp_cpp, "  // last internally defined operand\n");
   1.384 @@ -3453,7 +3425,7 @@
   1.385          if ( ! inst->is_simple_chain_rule(_globalNames) ) continue;
   1.386          if ( inst->rematerialize(_globalNames, get_registers()) ) continue;
   1.387  
   1.388 -        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
   1.389 +        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
   1.390          ++idx;
   1.391        };
   1.392        map.record_position(OutputMap::BEGIN_REMATERIALIZE, idx );
   1.393 @@ -3464,7 +3436,7 @@
   1.394          if ( ! inst->is_simple_chain_rule(_globalNames) ) continue;
   1.395          if ( ! inst->rematerialize(_globalNames, get_registers()) ) continue;
   1.396  
   1.397 -        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
   1.398 +        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
   1.399          ++idx;
   1.400        };
   1.401        map.record_position(OutputMap::END_INST_CHAIN_RULES, idx );
   1.402 @@ -3478,7 +3450,7 @@
   1.403          if ( inst->is_simple_chain_rule(_globalNames) ) continue;
   1.404          if ( ! inst->rematerialize(_globalNames, get_registers()) ) continue;
   1.405  
   1.406 -        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
   1.407 +        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
   1.408          ++idx;
   1.409        };
   1.410        map.record_position(OutputMap::END_REMATERIALIZE, idx );
   1.411 @@ -3489,7 +3461,7 @@
   1.412          if ( inst->is_simple_chain_rule(_globalNames) ) continue;
   1.413          if ( inst->rematerialize(_globalNames, get_registers()) ) continue;
   1.414  
   1.415 -        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
   1.416 +        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
   1.417          ++idx;
   1.418        };
   1.419      }
   1.420 @@ -3571,7 +3543,7 @@
   1.421      next              = _register->iter_RegDefs();
   1.422      char policy       = reg_save_policy(rdef->_callconv);
   1.423      const char *comma = (next != NULL) ? "," : " // no trailing comma";
   1.424 -    fprintf(fp_cpp, "  '%c'%s\n", policy, comma);
   1.425 +    fprintf(fp_cpp, "  '%c'%s // %s\n", policy, comma, rdef->_regname);
   1.426    }
   1.427    fprintf(fp_cpp, "};\n\n");
   1.428  
   1.429 @@ -3583,7 +3555,7 @@
   1.430      next        = _register->iter_RegDefs();
   1.431      char policy = reg_save_policy(rdef->_c_conv);
   1.432      const char *comma = (next != NULL) ? "," : " // no trailing comma";
   1.433 -    fprintf(fp_cpp, "  '%c'%s\n", policy, comma);
   1.434 +    fprintf(fp_cpp, "  '%c'%s // %s\n", policy, comma, rdef->_regname);
   1.435    }
   1.436    fprintf(fp_cpp, "};\n\n");
   1.437  
   1.438 @@ -3794,7 +3766,7 @@
   1.439        // For each operand not in the match rule, call MachOperGenerator
   1.440        // with the enum for the opcode that needs to be built.
   1.441        ComponentList clist = inst->_components;
   1.442 -      int         index  = clist.operand_position(comp->_name, comp->_usedef);
   1.443 +      int         index  = clist.operand_position(comp->_name, comp->_usedef, inst);
   1.444        const char *opcode = machOperEnum(comp->_type);
   1.445        fprintf(fp_cpp, "%s node->set_opnd_array(%d, ", indent, index);
   1.446        fprintf(fp_cpp, "MachOperGenerator(%s, C));\n", opcode);
   1.447 @@ -3989,7 +3961,7 @@
   1.448      fprintf(fp_cpp, "  case %s_rule:", opClass);
   1.449  
   1.450      // Start local scope
   1.451 -    fprintf(fp_cpp, "  {\n");
   1.452 +    fprintf(fp_cpp, " {\n");
   1.453      // Generate code to construct the new MachNode
   1.454      buildMachNode(fp_cpp, inst, "     ");
   1.455      // Return result and exit scope
   1.456 @@ -4139,6 +4111,9 @@
   1.457  // Get info for the CISC_oracle and MachNode::cisc_version()
   1.458  void ArchDesc::identify_cisc_spill_instructions() {
   1.459  
   1.460 +  if (_frame == NULL)
   1.461 +    return;
   1.462 +
   1.463    // Find the user-defined operand for cisc-spilling
   1.464    if( _frame->_cisc_spilling_operand_name != NULL ) {
   1.465      const Form *form = _globalNames[_frame->_cisc_spilling_operand_name];

mercurial