hotspot/src/share/vm/adlc/output_c.cpp
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
  1544       fprintf(fp,"  unsigned num%d = opnd_array(%d)->num_edges();\n",i,i);
  1544       fprintf(fp,"  unsigned num%d = opnd_array(%d)->num_edges();\n",i,i);
  1545     }
  1545     }
  1546 
  1546 
  1547     // Build a mapping from operand index to input edges
  1547     // Build a mapping from operand index to input edges
  1548     fprintf(fp,"  unsigned idx0 = oper_input_base();\n");
  1548     fprintf(fp,"  unsigned idx0 = oper_input_base();\n");
       
  1549 
       
  1550     // The order in which inputs are added to a node is very
       
  1551     // strange.  Store nodes get a memory input before Expand is
       
  1552     // called and all other nodes get it afterwards so
       
  1553     // oper_input_base is wrong during expansion.  This code adjusts
       
  1554     // is so that expansion will work correctly.
       
  1555     bool missing_memory_edge = node->_matrule->needs_ideal_memory_edge(_globalNames) &&
       
  1556                                node->is_ideal_store() == Form::none;
       
  1557     if (missing_memory_edge) {
       
  1558       fprintf(fp,"  idx0--; // Adjust base because memory edge hasn't been inserted yet\n");
       
  1559     }
       
  1560 
  1549     for( i = 0; i < node->num_opnds(); i++ ) {
  1561     for( i = 0; i < node->num_opnds(); i++ ) {
  1550       fprintf(fp,"  unsigned idx%d = idx%d + num%d;\n",
  1562       fprintf(fp,"  unsigned idx%d = idx%d + num%d;\n",
  1551               i+1,i,i);
  1563               i+1,i,i);
  1552     }
  1564     }
  1553 
  1565 
  1598       int memory_operand = new_inst->memory_operand(_globalNames);
  1610       int memory_operand = new_inst->memory_operand(_globalNames);
  1599       if( memory_operand != InstructForm::NO_MEMORY_OPERAND ) {
  1611       if( memory_operand != InstructForm::NO_MEMORY_OPERAND ) {
  1600         int node_mem_op = node->memory_operand(_globalNames);
  1612         int node_mem_op = node->memory_operand(_globalNames);
  1601         assert( node_mem_op != InstructForm::NO_MEMORY_OPERAND,
  1613         assert( node_mem_op != InstructForm::NO_MEMORY_OPERAND,
  1602                 "expand rule member needs memory but top-level inst doesn't have any" );
  1614                 "expand rule member needs memory but top-level inst doesn't have any" );
  1603         // Copy memory edge
  1615         if (!missing_memory_edge) {
  1604         fprintf(fp,"  n%d->add_req(_in[1]);\t// Add memory edge\n", cnt);
  1616           // Copy memory edge
       
  1617           fprintf(fp,"  n%d->add_req(_in[1]);\t// Add memory edge\n", cnt);
       
  1618         }
  1605       }
  1619       }
  1606 
  1620 
  1607       // Iterate over the new instruction's operands
  1621       // Iterate over the new instruction's operands
  1608       for( expand_instr->reset(); (opid = expand_instr->iter()) != NULL; ) {
  1622       for( expand_instr->reset(); (opid = expand_instr->iter()) != NULL; ) {
  1609         // Use 'parameter' at current position in list of new instruction's formals
  1623         // Use 'parameter' at current position in list of new instruction's formals
  2361   //(1)
  2375   //(1)
  2362   // Output instruction's emit prototype
  2376   // Output instruction's emit prototype
  2363   fprintf(fp,"uint  %sNode::size(PhaseRegAlloc *ra_) const {\n",
  2377   fprintf(fp,"uint  %sNode::size(PhaseRegAlloc *ra_) const {\n",
  2364           inst._ident);
  2378           inst._ident);
  2365 
  2379 
       
  2380   fprintf(fp, " assert(VerifyOops || MachNode::size(ra_) <= %s, \"bad fixed size\");\n", inst._size);
       
  2381 
  2366   //(2)
  2382   //(2)
  2367   // Print the size
  2383   // Print the size
  2368   fprintf(fp, " return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
  2384   fprintf(fp, " return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
  2369 
  2385 
  2370   // (3) and (4)
  2386   // (3) and (4)
  3424        && mnode->base_operand(position, globals, result, name, optype) ) {
  3440        && mnode->base_operand(position, globals, result, name, optype) ) {
  3425     if (         strcmp(optype,"ConI") == 0 ) {
  3441     if (         strcmp(optype,"ConI") == 0 ) {
  3426       fprintf(fp, "_leaf->get_int()");
  3442       fprintf(fp, "_leaf->get_int()");
  3427     } else if ( (strcmp(optype,"ConP") == 0) ) {
  3443     } else if ( (strcmp(optype,"ConP") == 0) ) {
  3428       fprintf(fp, "_leaf->bottom_type()->is_ptr()");
  3444       fprintf(fp, "_leaf->bottom_type()->is_ptr()");
       
  3445     } else if ( (strcmp(optype,"ConN") == 0) ) {
       
  3446       fprintf(fp, "_leaf->bottom_type()->is_narrowoop()");
  3429     } else if ( (strcmp(optype,"ConF") == 0) ) {
  3447     } else if ( (strcmp(optype,"ConF") == 0) ) {
  3430       fprintf(fp, "_leaf->getf()");
  3448       fprintf(fp, "_leaf->getf()");
  3431     } else if ( (strcmp(optype,"ConD") == 0) ) {
  3449     } else if ( (strcmp(optype,"ConD") == 0) ) {
  3432       fprintf(fp, "_leaf->getd()");
  3450       fprintf(fp, "_leaf->getd()");
  3433     } else if ( (strcmp(optype,"ConL") == 0) ) {
  3451     } else if ( (strcmp(optype,"ConL") == 0) ) {