src/share/vm/adlc/formssel.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/adlc

src/share/vm/adlc/formssel.cpp

Print this page




1305                          rep_var, _ident);
1306     return;
1307   }
1308   OpClassForm *opc   = form->is_opclass();
1309   assert( opc, "replacement variable was not found in local names");
1310   // Lookup the index position of the replacement variable
1311   int idx  = operand_position_format(rep_var);
1312   if ( idx == -1 ) {
1313     globalAD->syntax_err(_linenum, "Could not find replacement variable %s in format statement of %s.\n",
1314                          rep_var, _ident);
1315     assert(strcmp(opc->_ident, "label") == 0, "Unimplemented");
1316     return;
1317   }
1318 
1319   if (is_noninput_operand(idx)) {
1320     // This component isn't in the input array.  Print out the static
1321     // name of the register.
1322     OperandForm* oper = form->is_operand();
1323     if (oper != NULL && oper->is_bound_register()) {
1324       const RegDef* first = oper->get_RegClass()->find_first_elem();
1325       fprintf(fp, "    st->print(\"%s\");\n", first->_regname);
1326     } else {
1327       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
1328     }
1329   } else {
1330     // Output the format call for this operand
1331     fprintf(fp,"opnd_array(%d)->",idx);
1332     if (idx == 0)
1333       fprintf(fp,"int_format(ra, this, st); // %s\n", rep_var);
1334     else
1335       fprintf(fp,"ext_format(ra, this,idx%d, st); // %s\n", idx, rep_var );
1336   }
1337 }
1338 
1339 // Seach through operands to determine parameters unique positions.
1340 void InstructForm::set_unique_opnds() {
1341   uint* uniq_idx = NULL;
1342   uint  nopnds = num_opnds();
1343   uint  num_uniq = nopnds;
1344   uint i;
1345   _uniq_idx_length = 0;


2513   } else if (ideal_to_sReg_type(_ident) != Form::none) {
2514     // Special format for Stack Slot Register
2515     fprintf(fp,"  { char reg_str[128];\n");
2516     fprintf(fp,"    ra->dump_register(node->in(idx");
2517     if ( index != 0 ) fprintf(fp,                  "+%d",index);
2518     fprintf(fp,                                       "),reg_str);\n");
2519     fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
2520     fprintf(fp,"  }\n");
2521   } else {
2522     fprintf(fp,"  st->print(\"No format defined for %s\n\");\n", _ident);
2523     assert( false,"Internal error:\n  output_external_operand() attempting to output other than a Register or Constant");
2524   }
2525 }
2526 
2527 void OperandForm::format_constant(FILE *fp, uint const_index, uint const_type) {
2528   switch(const_type) {
2529   case Form::idealI: fprintf(fp,"  st->print(\"#%%d\", _c%d);\n", const_index); break;
2530   case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
2531   case Form::idealNKlass:
2532   case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
2533   case Form::idealL: fprintf(fp,"  st->print(\"#%%lld\", _c%d);\n", const_index); break;
2534   case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
2535   case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
2536   default:
2537     assert( false, "ShouldNotReachHere()");
2538   }
2539 }
2540 
2541 // Return the operand form corresponding to the given index, else NULL.
2542 OperandForm *OperandForm::constant_operand(FormDict &globals,
2543                                            uint      index) {
2544   // !!!!!
2545   // Check behavior on complex operands
2546   uint n_consts = num_consts(globals);
2547   if( n_consts > 0 ) {
2548     uint i = 0;
2549     const char *type;
2550     Component  *comp;
2551     _components.reset();
2552     if ((comp = _components.iter()) == NULL) {
2553       assert(n_consts == 1, "Bad component list detected.\n");




1305                          rep_var, _ident);
1306     return;
1307   }
1308   OpClassForm *opc   = form->is_opclass();
1309   assert( opc, "replacement variable was not found in local names");
1310   // Lookup the index position of the replacement variable
1311   int idx  = operand_position_format(rep_var);
1312   if ( idx == -1 ) {
1313     globalAD->syntax_err(_linenum, "Could not find replacement variable %s in format statement of %s.\n",
1314                          rep_var, _ident);
1315     assert(strcmp(opc->_ident, "label") == 0, "Unimplemented");
1316     return;
1317   }
1318 
1319   if (is_noninput_operand(idx)) {
1320     // This component isn't in the input array.  Print out the static
1321     // name of the register.
1322     OperandForm* oper = form->is_operand();
1323     if (oper != NULL && oper->is_bound_register()) {
1324       const RegDef* first = oper->get_RegClass()->find_first_elem();
1325       fprintf(fp, "    st->print_raw(\"%s\");\n", first->_regname);
1326     } else {
1327       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
1328     }
1329   } else {
1330     // Output the format call for this operand
1331     fprintf(fp,"opnd_array(%d)->",idx);
1332     if (idx == 0)
1333       fprintf(fp,"int_format(ra, this, st); // %s\n", rep_var);
1334     else
1335       fprintf(fp,"ext_format(ra, this,idx%d, st); // %s\n", idx, rep_var );
1336   }
1337 }
1338 
1339 // Seach through operands to determine parameters unique positions.
1340 void InstructForm::set_unique_opnds() {
1341   uint* uniq_idx = NULL;
1342   uint  nopnds = num_opnds();
1343   uint  num_uniq = nopnds;
1344   uint i;
1345   _uniq_idx_length = 0;


2513   } else if (ideal_to_sReg_type(_ident) != Form::none) {
2514     // Special format for Stack Slot Register
2515     fprintf(fp,"  { char reg_str[128];\n");
2516     fprintf(fp,"    ra->dump_register(node->in(idx");
2517     if ( index != 0 ) fprintf(fp,                  "+%d",index);
2518     fprintf(fp,                                       "),reg_str);\n");
2519     fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
2520     fprintf(fp,"  }\n");
2521   } else {
2522     fprintf(fp,"  st->print(\"No format defined for %s\n\");\n", _ident);
2523     assert( false,"Internal error:\n  output_external_operand() attempting to output other than a Register or Constant");
2524   }
2525 }
2526 
2527 void OperandForm::format_constant(FILE *fp, uint const_index, uint const_type) {
2528   switch(const_type) {
2529   case Form::idealI: fprintf(fp,"  st->print(\"#%%d\", _c%d);\n", const_index); break;
2530   case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
2531   case Form::idealNKlass:
2532   case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
2533   case Form::idealL: fprintf(fp,"  st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break;
2534   case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
2535   case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
2536   default:
2537     assert( false, "ShouldNotReachHere()");
2538   }
2539 }
2540 
2541 // Return the operand form corresponding to the given index, else NULL.
2542 OperandForm *OperandForm::constant_operand(FormDict &globals,
2543                                            uint      index) {
2544   // !!!!!
2545   // Check behavior on complex operands
2546   uint n_consts = num_consts(globals);
2547   if( n_consts > 0 ) {
2548     uint i = 0;
2549     const char *type;
2550     Component  *comp;
2551     _components.reset();
2552     if ((comp = _components.iter()) == NULL) {
2553       assert(n_consts == 1, "Bad component list detected.\n");


src/share/vm/adlc/formssel.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File