372 373 return tp->add_offset(offset); 374 } 375 376 377 //-----------------------------operand_index--------------------------------- 378 int MachNode::operand_index( uint operand ) const { 379 if( operand < 1 ) return -1; 380 assert(operand < num_opnds(), "oob"); 381 if( _opnds[operand]->num_edges() == 0 ) return -1; 382 383 uint skipped = oper_input_base(); // Sum of leaves skipped so far 384 for (uint opcnt = 1; opcnt < operand; opcnt++) { 385 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand 386 skipped += num_edges; 387 } 388 return skipped; 389 } 390 391 392 //------------------------------negate----------------------------------------- 393 // Negate conditional branches. Error for non-branch Nodes 394 void MachNode::negate() { 395 ShouldNotCallThis(); 396 } 397 398 //------------------------------peephole--------------------------------------- 399 // Apply peephole rule(s) to this instruction 400 MachNode *MachNode::peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C ) { 401 return NULL; 402 } 403 404 //------------------------------add_case_label--------------------------------- 405 // Adds the label for the case 406 void MachNode::add_case_label( int index_num, Label* blockLabel) { 407 ShouldNotCallThis(); 408 } 409 410 //------------------------------label_set-------------------------------------- 411 // Set the Label for a LabelOper, if an operand for this instruction 412 void MachNode::label_set( Label* label, uint block_num ) { 413 ShouldNotCallThis(); 414 } 415 416 //------------------------------method_set------------------------------------- 417 // Set the absolute address of a method 418 void MachNode::method_set( intptr_t addr ) { 419 ShouldNotCallThis(); 420 } 421 422 //------------------------------rematerialize---------------------------------- 423 bool MachNode::rematerialize() const { 424 // Temps are always rematerializable 425 if (is_MachTemp()) return true; 426 427 uint r = rule(); // Match rule 428 if( r < Matcher::_begin_rematerialize || 429 r >= Matcher::_end_rematerialize ) 430 return false; 431 432 // For 2-address instructions, the input live range is also the output 433 // live range. Remateralizing does not make progress on the that live range. 434 if( two_adr() ) return false; 435 500 _constant.set_offset(offset); 501 } 502 return offset; 503 } 504 505 506 //============================================================================= 507 #ifndef PRODUCT 508 void MachNullCheckNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { 509 int reg = ra_->get_reg_first(in(1)->in(_vidx)); 510 tty->print("%s %s", Name(), Matcher::regName[reg]); 511 } 512 #endif 513 514 void MachNullCheckNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { 515 // only emits entries in the null-pointer exception handler table 516 } 517 void MachNullCheckNode::label_set(Label* label, uint block_num) { 518 // Nothing to emit 519 } 520 521 const RegMask &MachNullCheckNode::in_RegMask( uint idx ) const { 522 if( idx == 0 ) return RegMask::Empty; 523 else return in(1)->as_Mach()->out_RegMask(); 524 } 525 526 //============================================================================= 527 const Type *MachProjNode::bottom_type() const { 528 if( _ideal_reg == fat_proj ) return Type::BOTTOM; 529 // Try the normal mechanism first 530 const Type *t = in(0)->bottom_type(); 531 if( t->base() == Type::Tuple ) { 532 const TypeTuple *tt = t->is_tuple(); 533 if (_con < tt->cnt()) 534 return tt->field_at(_con); 535 } 536 // Else use generic type from ideal register set 537 assert((uint)_ideal_reg < (uint)_last_machine_leaf && Type::mreg2type[_ideal_reg], "in bounds"); 538 return Type::mreg2type[_ideal_reg]; 539 } | 372 373 return tp->add_offset(offset); 374 } 375 376 377 //-----------------------------operand_index--------------------------------- 378 int MachNode::operand_index( uint operand ) const { 379 if( operand < 1 ) return -1; 380 assert(operand < num_opnds(), "oob"); 381 if( _opnds[operand]->num_edges() == 0 ) return -1; 382 383 uint skipped = oper_input_base(); // Sum of leaves skipped so far 384 for (uint opcnt = 1; opcnt < operand; opcnt++) { 385 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand 386 skipped += num_edges; 387 } 388 return skipped; 389 } 390 391 392 //------------------------------peephole--------------------------------------- 393 // Apply peephole rule(s) to this instruction 394 MachNode *MachNode::peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C ) { 395 return NULL; 396 } 397 398 //------------------------------add_case_label--------------------------------- 399 // Adds the label for the case 400 void MachNode::add_case_label( int index_num, Label* blockLabel) { 401 ShouldNotCallThis(); 402 } 403 404 //------------------------------method_set------------------------------------- 405 // Set the absolute address of a method 406 void MachNode::method_set( intptr_t addr ) { 407 ShouldNotCallThis(); 408 } 409 410 //------------------------------rematerialize---------------------------------- 411 bool MachNode::rematerialize() const { 412 // Temps are always rematerializable 413 if (is_MachTemp()) return true; 414 415 uint r = rule(); // Match rule 416 if( r < Matcher::_begin_rematerialize || 417 r >= Matcher::_end_rematerialize ) 418 return false; 419 420 // For 2-address instructions, the input live range is also the output 421 // live range. Remateralizing does not make progress on the that live range. 422 if( two_adr() ) return false; 423 488 _constant.set_offset(offset); 489 } 490 return offset; 491 } 492 493 494 //============================================================================= 495 #ifndef PRODUCT 496 void MachNullCheckNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { 497 int reg = ra_->get_reg_first(in(1)->in(_vidx)); 498 tty->print("%s %s", Name(), Matcher::regName[reg]); 499 } 500 #endif 501 502 void MachNullCheckNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { 503 // only emits entries in the null-pointer exception handler table 504 } 505 void MachNullCheckNode::label_set(Label* label, uint block_num) { 506 // Nothing to emit 507 } 508 void MachNullCheckNode::save_label( Label** label, uint* block_num ) { 509 // Nothing to emit 510 } 511 512 const RegMask &MachNullCheckNode::in_RegMask( uint idx ) const { 513 if( idx == 0 ) return RegMask::Empty; 514 else return in(1)->as_Mach()->out_RegMask(); 515 } 516 517 //============================================================================= 518 const Type *MachProjNode::bottom_type() const { 519 if( _ideal_reg == fat_proj ) return Type::BOTTOM; 520 // Try the normal mechanism first 521 const Type *t = in(0)->bottom_type(); 522 if( t->base() == Type::Tuple ) { 523 const TypeTuple *tt = t->is_tuple(); 524 if (_con < tt->cnt()) 525 return tt->field_at(_con); 526 } 527 // Else use generic type from ideal register set 528 assert((uint)_ideal_reg < (uint)_last_machine_leaf && Type::mreg2type[_ideal_reg], "in bounds"); 529 return Type::mreg2type[_ideal_reg]; 530 } |