519
520 // Check if a simple chain rule
521 bool InstructForm::is_simple_chain_rule(FormDict &globals) const {
522 if( _matrule && _matrule->sets_result()
523 && _matrule->_rChild->_lChild == NULL
524 && globals[_matrule->_rChild->_opType]
525 && globals[_matrule->_rChild->_opType]->is_opclass() ) {
526 return true;
527 }
528 return false;
529 }
530
531 // check for structural rematerialization
532 bool InstructForm::rematerialize(FormDict &globals, RegisterForm *registers ) {
533 bool rematerialize = false;
534
535 Form::DataType data_type = is_chain_of_constant(globals);
536 if( data_type != Form::none )
537 rematerialize = true;
538
539 // Ugly: until a better fix is implemented, disable rematerialization for
540 // negD nodes because they are proved to be problematic.
541 if (is_ideal_negD()) {
542 return false;
543 }
544
545 // Constants
546 if( _components.count() == 1 && _components[0]->is(Component::USE_DEF) )
547 rematerialize = true;
548
549 // Pseudo-constants (values easily available to the runtime)
550 if (is_empty_encoding() && is_tls_instruction())
551 rematerialize = true;
552
553 // 1-input, 1-output, such as copies or increments.
554 if( _components.count() == 2 &&
555 _components[0]->is(Component::DEF) &&
556 _components[1]->isa(Component::USE) )
557 rematerialize = true;
558
559 // Check for an ideal 'Load?' and eliminate rematerialize option
560 if ( is_ideal_load() != Form::none || // Ideal load? Do not rematerialize
561 is_ideal_copy() != Form::none || // Ideal copy? Do not rematerialize
562 is_expensive() != Form::none) { // Expensive? Do not rematerialize
563 rematerialize = false;
564 }
|
519
520 // Check if a simple chain rule
521 bool InstructForm::is_simple_chain_rule(FormDict &globals) const {
522 if( _matrule && _matrule->sets_result()
523 && _matrule->_rChild->_lChild == NULL
524 && globals[_matrule->_rChild->_opType]
525 && globals[_matrule->_rChild->_opType]->is_opclass() ) {
526 return true;
527 }
528 return false;
529 }
530
531 // check for structural rematerialization
532 bool InstructForm::rematerialize(FormDict &globals, RegisterForm *registers ) {
533 bool rematerialize = false;
534
535 Form::DataType data_type = is_chain_of_constant(globals);
536 if( data_type != Form::none )
537 rematerialize = true;
538
539 // Constants
540 if( _components.count() == 1 && _components[0]->is(Component::USE_DEF) )
541 rematerialize = true;
542
543 // Pseudo-constants (values easily available to the runtime)
544 if (is_empty_encoding() && is_tls_instruction())
545 rematerialize = true;
546
547 // 1-input, 1-output, such as copies or increments.
548 if( _components.count() == 2 &&
549 _components[0]->is(Component::DEF) &&
550 _components[1]->isa(Component::USE) )
551 rematerialize = true;
552
553 // Check for an ideal 'Load?' and eliminate rematerialize option
554 if ( is_ideal_load() != Form::none || // Ideal load? Do not rematerialize
555 is_ideal_copy() != Form::none || // Ideal copy? Do not rematerialize
556 is_expensive() != Form::none) { // Expensive? Do not rematerialize
557 rematerialize = false;
558 }
|