201 } |
201 } |
202 else if (!strcmp(type, "ConP")) { |
202 else if (!strcmp(type, "ConP")) { |
203 if (i > 0) fprintf(fp,", "); |
203 if (i > 0) fprintf(fp,", "); |
204 fprintf(fp," const TypePtr *_c%d;\n", i); |
204 fprintf(fp," const TypePtr *_c%d;\n", i); |
205 } |
205 } |
|
206 else if (!strcmp(type, "ConN")) { |
|
207 if (i > 0) fprintf(fp,", "); |
|
208 fprintf(fp," const TypeNarrowOop *_c%d;\n", i); |
|
209 } |
206 else if (!strcmp(type, "ConL")) { |
210 else if (!strcmp(type, "ConL")) { |
207 if (i > 0) fprintf(fp,", "); |
211 if (i > 0) fprintf(fp,", "); |
208 fprintf(fp," jlong _c%d;\n", i); |
212 fprintf(fp," jlong _c%d;\n", i); |
209 } |
213 } |
210 else if (!strcmp(type, "ConF")) { |
214 else if (!strcmp(type, "ConF")) { |
230 if (!strcmp(comp->base_type(globals), "ConI")) { |
234 if (!strcmp(comp->base_type(globals), "ConI")) { |
231 fprintf(fp," jint _c%d;\n", i); |
235 fprintf(fp," jint _c%d;\n", i); |
232 i++; |
236 i++; |
233 } |
237 } |
234 else if (!strcmp(comp->base_type(globals), "ConP")) { |
238 else if (!strcmp(comp->base_type(globals), "ConP")) { |
|
239 fprintf(fp," const TypePtr *_c%d;\n", i); |
|
240 i++; |
|
241 } |
|
242 else if (!strcmp(comp->base_type(globals), "ConN")) { |
235 fprintf(fp," const TypePtr *_c%d;\n", i); |
243 fprintf(fp," const TypePtr *_c%d;\n", i); |
236 i++; |
244 i++; |
237 } |
245 } |
238 else if (!strcmp(comp->base_type(globals), "ConL")) { |
246 else if (!strcmp(comp->base_type(globals), "ConL")) { |
239 fprintf(fp," jlong _c%d;\n", i); |
247 fprintf(fp," jlong _c%d;\n", i); |
278 switch( constant_type ) { |
286 switch( constant_type ) { |
279 case Form::idealI : { |
287 case Form::idealI : { |
280 fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i); |
288 fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i); |
281 break; |
289 break; |
282 } |
290 } |
|
291 case Form::idealN : { fprintf(fp,"const TypeNarrowOop *c%d", i); break; } |
283 case Form::idealP : { fprintf(fp,"const TypePtr *c%d", i); break; } |
292 case Form::idealP : { fprintf(fp,"const TypePtr *c%d", i); break; } |
284 case Form::idealL : { fprintf(fp,"jlong c%d", i); break; } |
293 case Form::idealL : { fprintf(fp,"jlong c%d", i); break; } |
285 case Form::idealF : { fprintf(fp,"jfloat c%d", i); break; } |
294 case Form::idealF : { fprintf(fp,"jfloat c%d", i); break; } |
286 case Form::idealD : { fprintf(fp,"jdouble c%d", i); break; } |
295 case Form::idealD : { fprintf(fp,"jdouble c%d", i); break; } |
287 default: |
296 default: |
300 else if (!strcmp(comp->base_type(globals), "ConP")) { |
309 else if (!strcmp(comp->base_type(globals), "ConP")) { |
301 if (i > 0) fprintf(fp,", "); |
310 if (i > 0) fprintf(fp,", "); |
302 fprintf(fp,"const TypePtr *c%d", i); |
311 fprintf(fp,"const TypePtr *c%d", i); |
303 i++; |
312 i++; |
304 } |
313 } |
|
314 else if (!strcmp(comp->base_type(globals), "ConN")) { |
|
315 if (i > 0) fprintf(fp,", "); |
|
316 fprintf(fp,"const TypePtr *c%d", i); |
|
317 i++; |
|
318 } |
305 else if (!strcmp(comp->base_type(globals), "ConL")) { |
319 else if (!strcmp(comp->base_type(globals), "ConL")) { |
306 if (i > 0) fprintf(fp,", "); |
320 if (i > 0) fprintf(fp,", "); |
307 fprintf(fp,"jlong c%d", i); |
321 fprintf(fp,"jlong c%d", i); |
308 i++; |
322 i++; |
309 } |
323 } |
356 fprintf(fp," st->print(\"#%%d\", _c%d);\n", i); |
370 fprintf(fp," st->print(\"#%%d\", _c%d);\n", i); |
357 ++i; |
371 ++i; |
358 } |
372 } |
359 else if (!strcmp(ideal_type, "ConP")) { |
373 else if (!strcmp(ideal_type, "ConP")) { |
360 fprintf(fp," _c%d->dump_on(st);\n", i); |
374 fprintf(fp," _c%d->dump_on(st);\n", i); |
|
375 ++i; |
|
376 } |
|
377 else if (!strcmp(ideal_type, "ConN")) { |
|
378 fprintf(fp," _c%d->dump();\n", i); |
361 ++i; |
379 ++i; |
362 } |
380 } |
363 else if (!strcmp(ideal_type, "ConL")) { |
381 else if (!strcmp(ideal_type, "ConL")) { |
364 fprintf(fp," st->print(\"#\" INT64_FORMAT, _c%d);\n", i); |
382 fprintf(fp," st->print(\"#\" INT64_FORMAT, _c%d);\n", i); |
365 ++i; |
383 ++i; |
415 fprintf(fp,"st->print(\"%s\");\n", string); |
433 fprintf(fp,"st->print(\"%s\");\n", string); |
416 } else { |
434 } else { |
417 // Replacement variable |
435 // Replacement variable |
418 const char *rep_var = oper._format->_rep_vars.iter(); |
436 const char *rep_var = oper._format->_rep_vars.iter(); |
419 // Check that it is a local name, and an operand |
437 // Check that it is a local name, and an operand |
420 OperandForm *op = oper._localNames[rep_var]->is_operand(); |
438 const Form* form = oper._localNames[rep_var]; |
421 assert( op, "replacement variable was not found in local names"); |
439 if (form == NULL) { |
|
440 globalAD->syntax_err(oper._linenum, |
|
441 "\'%s\' not found in format for %s\n", rep_var, oper._ident); |
|
442 assert(form, "replacement variable was not found in local names"); |
|
443 } |
|
444 OperandForm *op = form->is_operand(); |
422 // Get index if register or constant |
445 // Get index if register or constant |
423 if ( op->_matrule && op->_matrule->is_base_register(globals) ) { |
446 if ( op->_matrule && op->_matrule->is_base_register(globals) ) { |
424 idx = oper.register_position( globals, rep_var); |
447 idx = oper.register_position( globals, rep_var); |
425 } |
448 } |
426 else if (op->_matrule && op->_matrule->is_base_constant(globals)) { |
449 else if (op->_matrule && op->_matrule->is_base_constant(globals)) { |
481 // Pass through to st->print |
504 // Pass through to st->print |
482 fprintf(fp,"st->print(\"%s\");\n", string); |
505 fprintf(fp,"st->print(\"%s\");\n", string); |
483 } else { |
506 } else { |
484 // Replacement variable |
507 // Replacement variable |
485 const char *rep_var = oper._format->_rep_vars.iter(); |
508 const char *rep_var = oper._format->_rep_vars.iter(); |
486 // Check that it is a local name, and an operand |
509 // Check that it is a local name, and an operand |
487 OperandForm *op = oper._localNames[rep_var]->is_operand(); |
510 const Form* form = oper._localNames[rep_var]; |
488 assert( op, "replacement variable was not found in local names"); |
511 if (form == NULL) { |
|
512 globalAD->syntax_err(oper._linenum, |
|
513 "\'%s\' not found in format for %s\n", rep_var, oper._ident); |
|
514 assert(form, "replacement variable was not found in local names"); |
|
515 } |
|
516 OperandForm *op = form->is_operand(); |
489 // Get index if register or constant |
517 // Get index if register or constant |
490 if ( op->_matrule && op->_matrule->is_base_register(globals) ) { |
518 if ( op->_matrule && op->_matrule->is_base_register(globals) ) { |
491 idx = oper.register_position( globals, rep_var); |
519 idx = oper.register_position( globals, rep_var); |
492 } |
520 } |
493 else if (op->_matrule && op->_matrule->is_base_constant(globals)) { |
521 else if (op->_matrule && op->_matrule->is_base_constant(globals)) { |
1161 fprintf(fp," virtual const Type *type() const {"); |
1189 fprintf(fp," virtual const Type *type() const {"); |
1162 const char *type = getIdealType(optype); |
1190 const char *type = getIdealType(optype); |
1163 if( type != NULL ) { |
1191 if( type != NULL ) { |
1164 Form::DataType data_type = oper->is_base_constant(_globalNames); |
1192 Form::DataType data_type = oper->is_base_constant(_globalNames); |
1165 // Check if we are an ideal pointer type |
1193 // Check if we are an ideal pointer type |
1166 if( data_type == Form::idealP ) { |
1194 if( data_type == Form::idealP || data_type == Form::idealN ) { |
1167 // Return the ideal type we already have: <TypePtr *> |
1195 // Return the ideal type we already have: <TypePtr *> |
1168 fprintf(fp," return _c0;"); |
1196 fprintf(fp," return _c0;"); |
1169 } else { |
1197 } else { |
1170 // Return the appropriate bottom type |
1198 // Return the appropriate bottom type |
1171 fprintf(fp," return %s;", getIdealType(optype)); |
1199 fprintf(fp," return %s;", getIdealType(optype)); |
1289 // Generate query to determine if this pointer is an oop |
1317 // Generate query to determine if this pointer is an oop |
1290 fprintf(fp," virtual bool constant_is_oop() const {"); |
1318 fprintf(fp," virtual bool constant_is_oop() const {"); |
1291 fprintf(fp, " return _c0->isa_oop_ptr();"); |
1319 fprintf(fp, " return _c0->isa_oop_ptr();"); |
1292 fprintf(fp, " }\n"); |
1320 fprintf(fp, " }\n"); |
1293 } |
1321 } |
|
1322 else if (!strcmp(oper->ideal_type(_globalNames), "ConN")) { |
|
1323 // Access the locally stored constant |
|
1324 fprintf(fp," virtual intptr_t constant() const {"); |
|
1325 fprintf(fp, " return _c0->make_oopptr()->get_con();"); |
|
1326 fprintf(fp, " }\n"); |
|
1327 // Generate query to determine if this pointer is an oop |
|
1328 fprintf(fp," virtual bool constant_is_oop() const {"); |
|
1329 fprintf(fp, " return _c0->make_oopptr()->isa_oop_ptr();"); |
|
1330 fprintf(fp, " }\n"); |
|
1331 } |
1294 else if (!strcmp(oper->ideal_type(_globalNames), "ConL")) { |
1332 else if (!strcmp(oper->ideal_type(_globalNames), "ConL")) { |
1295 fprintf(fp," virtual intptr_t constant() const {"); |
1333 fprintf(fp," virtual intptr_t constant() const {"); |
1296 // We don't support addressing modes with > 4Gig offsets. |
1334 // We don't support addressing modes with > 4Gig offsets. |
1297 // Truncate to int. |
1335 // Truncate to int. |
1298 fprintf(fp, " return (intptr_t)_c0;"); |
1336 fprintf(fp, " return (intptr_t)_c0;"); |
1746 switch( data_type ) { |
1784 switch( data_type ) { |
1747 case Form::idealI: |
1785 case Form::idealI: |
1748 fprintf(fp," return TypeInt::make(opnd_array(1)->constant());\n"); |
1786 fprintf(fp," return TypeInt::make(opnd_array(1)->constant());\n"); |
1749 break; |
1787 break; |
1750 case Form::idealP: |
1788 case Form::idealP: |
|
1789 case Form::idealN: |
1751 fprintf(fp," return opnd_array(1)->type();\n",result); |
1790 fprintf(fp," return opnd_array(1)->type();\n",result); |
1752 break; |
1791 break; |
1753 case Form::idealD: |
1792 case Form::idealD: |
1754 fprintf(fp," return TypeD::make(opnd_array(1)->constantD());\n"); |
1793 fprintf(fp," return TypeD::make(opnd_array(1)->constantD());\n"); |
1755 break; |
1794 break; |