Mercurial > hg > graal-jvmci-8
comparison src/share/vm/adlc/output_c.cpp @ 1541:b5fdf39b9749
6953576: bottom_type for matched AddPNodes doesn't always agree with ideal
Reviewed-by: kvn
author | never |
---|---|
date | Tue, 18 May 2010 23:58:32 -0700 |
parents | cff162798819 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1540:99791ad65936 | 1541:b5fdf39b9749 |
---|---|
1380 for( int unmatched_edge = 1; unmatched_edge < op_base; ++unmatched_edge ) { | 1380 for( int unmatched_edge = 1; unmatched_edge < op_base; ++unmatched_edge ) { |
1381 fprintf(fp, " root->add_req(inst%d->in(%d)); // unmatched ideal edge\n", | 1381 fprintf(fp, " root->add_req(inst%d->in(%d)); // unmatched ideal edge\n", |
1382 inst_num, unmatched_edge); | 1382 inst_num, unmatched_edge); |
1383 } | 1383 } |
1384 // If new instruction captures bottom type | 1384 // If new instruction captures bottom type |
1385 if( root_form->captures_bottom_type() ) { | 1385 if( root_form->captures_bottom_type(globals) ) { |
1386 // Get bottom type from instruction whose result we are replacing | 1386 // Get bottom type from instruction whose result we are replacing |
1387 fprintf(fp, " root->_bottom_type = inst%d->bottom_type();\n", inst_num); | 1387 fprintf(fp, " root->_bottom_type = inst%d->bottom_type();\n", inst_num); |
1388 } | 1388 } |
1389 // Define result register and result operand | 1389 // Define result register and result operand |
1390 fprintf(fp, " ra_->add_reference(root, inst%d);\n", inst_num); | 1390 fprintf(fp, " ra_->add_reference(root, inst%d);\n", inst_num); |
2961 | 2961 |
2962 // Output code to convert to the cisc version, if applicable | 2962 // Output code to convert to the cisc version, if applicable |
2963 used |= instr->define_cisc_version(*this, fp); | 2963 used |= instr->define_cisc_version(*this, fp); |
2964 | 2964 |
2965 // Output code to convert to the short branch version, if applicable | 2965 // Output code to convert to the short branch version, if applicable |
2966 used |= instr->define_short_branch_methods(fp); | 2966 used |= instr->define_short_branch_methods(*this, fp); |
2967 } | 2967 } |
2968 | 2968 |
2969 // Construct the method called by cisc_version() to copy inputs and operands. | 2969 // Construct the method called by cisc_version() to copy inputs and operands. |
2970 define_fill_new_machnode(used, fp); | 2970 define_fill_new_machnode(used, fp); |
2971 | 2971 |
3706 fprintf(fp_cpp, " );\n"); | 3706 fprintf(fp_cpp, " );\n"); |
3707 // ##### | 3707 // ##### |
3708 } | 3708 } |
3709 | 3709 |
3710 // Fill in the bottom_type where requested | 3710 // Fill in the bottom_type where requested |
3711 if ( inst->captures_bottom_type() ) { | 3711 if ( inst->captures_bottom_type(_globalNames) ) { |
3712 fprintf(fp_cpp, "%s node->_bottom_type = _leaf->bottom_type();\n", indent); | 3712 fprintf(fp_cpp, "%s node->_bottom_type = _leaf->bottom_type();\n", indent); |
3713 } | 3713 } |
3714 if( inst->is_ideal_if() ) { | 3714 if( inst->is_ideal_if() ) { |
3715 fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent); | 3715 fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent); |
3716 fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent); | 3716 fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent); |
3760 fprintf(fp_cpp, "// Build CISC version of this instruction\n"); | 3760 fprintf(fp_cpp, "// Build CISC version of this instruction\n"); |
3761 fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident); | 3761 fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident); |
3762 // Create the MachNode object | 3762 // Create the MachNode object |
3763 fprintf(fp_cpp, " %sNode *node = new (C) %sNode();\n", name, name); | 3763 fprintf(fp_cpp, " %sNode *node = new (C) %sNode();\n", name, name); |
3764 // Fill in the bottom_type where requested | 3764 // Fill in the bottom_type where requested |
3765 if ( this->captures_bottom_type() ) { | 3765 if ( this->captures_bottom_type(AD.globalNames()) ) { |
3766 fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n"); | 3766 fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n"); |
3767 } | 3767 } |
3768 | 3768 |
3769 uint cur_num_opnds = num_opnds(); | 3769 uint cur_num_opnds = num_opnds(); |
3770 if (cur_num_opnds > 1 && cur_num_opnds != num_unique_opnds()) { | 3770 if (cur_num_opnds > 1 && cur_num_opnds != num_unique_opnds()) { |
3796 } | 3796 } |
3797 } | 3797 } |
3798 | 3798 |
3799 //---------------------------define_short_branch_methods----------------------- | 3799 //---------------------------define_short_branch_methods----------------------- |
3800 // Build definitions for short branch methods | 3800 // Build definitions for short branch methods |
3801 bool InstructForm::define_short_branch_methods(FILE *fp_cpp) { | 3801 bool InstructForm::define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp) { |
3802 if (has_short_branch_form()) { | 3802 if (has_short_branch_form()) { |
3803 InstructForm *short_branch = short_branch_form(); | 3803 InstructForm *short_branch = short_branch_form(); |
3804 const char *name = short_branch->_ident; | 3804 const char *name = short_branch->_ident; |
3805 | 3805 |
3806 // Construct short_branch_version() method. | 3806 // Construct short_branch_version() method. |
3811 if( is_ideal_if() ) { | 3811 if( is_ideal_if() ) { |
3812 fprintf(fp_cpp, " node->_prob = _prob;\n"); | 3812 fprintf(fp_cpp, " node->_prob = _prob;\n"); |
3813 fprintf(fp_cpp, " node->_fcnt = _fcnt;\n"); | 3813 fprintf(fp_cpp, " node->_fcnt = _fcnt;\n"); |
3814 } | 3814 } |
3815 // Fill in the bottom_type where requested | 3815 // Fill in the bottom_type where requested |
3816 if ( this->captures_bottom_type() ) { | 3816 if ( this->captures_bottom_type(AD.globalNames()) ) { |
3817 fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n"); | 3817 fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n"); |
3818 } | 3818 } |
3819 | 3819 |
3820 fprintf(fp_cpp, "\n"); | 3820 fprintf(fp_cpp, "\n"); |
3821 // Short branch version must use same node index for access | 3821 // Short branch version must use same node index for access |