src/share/vm/adlc/output_c.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6814842 Sdiff src/share/vm/adlc

src/share/vm/adlc/output_c.cpp

Print this page
rev 767 : [mq]: 6814842


1728         comp = node->_components.iter();
1729         int j = node->unique_opnds_idx(i);
1730         // unique_opnds_idx(i) is unique if unique_opnds_idx(j) is not unique.
1731         if( j != node->unique_opnds_idx(j) ) {
1732           fprintf(fp,"  set_opnd_array(%d, opnd_array(%d)->clone(C)); // %s\n",
1733                   new_num_opnds, i, comp->_name);
1734           // delete not unique edges here
1735           fprintf(fp,"  for(unsigned i = 0; i < num%d; i++) {\n", i);
1736           fprintf(fp,"    set_req(i + idx%d, _in[i + idx%d]);\n", new_num_opnds, i);
1737           fprintf(fp,"  }\n");
1738           fprintf(fp,"  num%d = num%d;\n", new_num_opnds, i);
1739           fprintf(fp,"  idx%d = idx%d + num%d;\n", new_num_opnds+1, new_num_opnds, new_num_opnds);
1740           new_num_opnds++;
1741         }
1742       }
1743       // delete the rest of edges
1744       fprintf(fp,"  for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds);
1745       fprintf(fp,"    del_req(i);\n");
1746       fprintf(fp,"  }\n");
1747       fprintf(fp,"  _num_opnds = %d;\n", new_num_opnds);

1748     }
1749   }
1750 
1751 
1752   // Generate projections for instruction's additional DEFs and KILLs
1753   if( ! node->expands() && (node->needs_projections() || node->has_temps())) {
1754     // Get string representing the MachNode that projections point at
1755     const char *machNode = "this";
1756     // Generate the projections
1757     fprintf(fp,"  // Add projection edges for additional defs or kills\n");
1758 
1759     // Examine each component to see if it is a DEF or KILL
1760     node->_components.reset();
1761     // Skip the first component, if already handled as (SET dst (...))
1762     Component *comp = NULL;
1763     // For kills, the choice of projection numbers is arbitrary
1764     int proj_no = 1;
1765     bool declared_def  = false;
1766     bool declared_kill = false;
1767 


3744     assert( cisc_oper_name != NULL, "insanity check");
3745     //
3746     // Set the correct reg_mask_or_stack for the cisc operand
3747     fprintf(fp_cpp, "\n");
3748     fprintf(fp_cpp, "void %sNode::use_cisc_RegMask() {\n", this->_ident);
3749     // Lookup the correct reg_mask_or_stack
3750     const char *reg_mask_name = cisc_reg_mask_name();
3751     fprintf(fp_cpp, "  _cisc_RegMask = &STACK_OR_%s;\n", reg_mask_name);
3752     fprintf(fp_cpp, "}\n");
3753     //
3754     // Construct CISC version of this instruction
3755     fprintf(fp_cpp, "\n");
3756     fprintf(fp_cpp, "// Build CISC version of this instruction\n");
3757     fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident);
3758     // Create the MachNode object
3759     fprintf(fp_cpp, "  %sNode *node = new (C) %sNode();\n", name, name);
3760     // Fill in the bottom_type where requested
3761     if ( this->captures_bottom_type() ) {
3762       fprintf(fp_cpp, "  node->_bottom_type = bottom_type();\n");
3763     }






3764     fprintf(fp_cpp, "\n");
3765     fprintf(fp_cpp, "  // Copy _idx, inputs and operands to new node\n");
3766     fprintf(fp_cpp, "  fill_new_machnode(node, C);\n");
3767     // Construct operand to access [stack_pointer + offset]
3768     fprintf(fp_cpp, "  // Construct operand to access [stack_pointer + offset]\n");
3769     fprintf(fp_cpp, "  node->set_opnd_array(cisc_operand(), new (C) %sOper(offset));\n", cisc_oper_name);
3770     fprintf(fp_cpp, "\n");
3771 
3772     // Return result and exit scope
3773     fprintf(fp_cpp, "  return node;\n");
3774     fprintf(fp_cpp, "}\n");
3775     fprintf(fp_cpp, "\n");
3776     return true;
3777   }
3778   return false;
3779 }
3780 
3781 //---------------------------declare_short_branch_methods----------------------
3782 // Build prototypes for short branch methods
3783 void InstructForm::declare_short_branch_methods(FILE *fp_hpp) {




1728         comp = node->_components.iter();
1729         int j = node->unique_opnds_idx(i);
1730         // unique_opnds_idx(i) is unique if unique_opnds_idx(j) is not unique.
1731         if( j != node->unique_opnds_idx(j) ) {
1732           fprintf(fp,"  set_opnd_array(%d, opnd_array(%d)->clone(C)); // %s\n",
1733                   new_num_opnds, i, comp->_name);
1734           // delete not unique edges here
1735           fprintf(fp,"  for(unsigned i = 0; i < num%d; i++) {\n", i);
1736           fprintf(fp,"    set_req(i + idx%d, _in[i + idx%d]);\n", new_num_opnds, i);
1737           fprintf(fp,"  }\n");
1738           fprintf(fp,"  num%d = num%d;\n", new_num_opnds, i);
1739           fprintf(fp,"  idx%d = idx%d + num%d;\n", new_num_opnds+1, new_num_opnds, new_num_opnds);
1740           new_num_opnds++;
1741         }
1742       }
1743       // delete the rest of edges
1744       fprintf(fp,"  for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds);
1745       fprintf(fp,"    del_req(i);\n");
1746       fprintf(fp,"  }\n");
1747       fprintf(fp,"  _num_opnds = %d;\n", new_num_opnds);
1748       assert(new_num_opnds == node->num_unique_opnds(), "what?");
1749     }
1750   }
1751 
1752 
1753   // Generate projections for instruction's additional DEFs and KILLs
1754   if( ! node->expands() && (node->needs_projections() || node->has_temps())) {
1755     // Get string representing the MachNode that projections point at
1756     const char *machNode = "this";
1757     // Generate the projections
1758     fprintf(fp,"  // Add projection edges for additional defs or kills\n");
1759 
1760     // Examine each component to see if it is a DEF or KILL
1761     node->_components.reset();
1762     // Skip the first component, if already handled as (SET dst (...))
1763     Component *comp = NULL;
1764     // For kills, the choice of projection numbers is arbitrary
1765     int proj_no = 1;
1766     bool declared_def  = false;
1767     bool declared_kill = false;
1768 


3745     assert( cisc_oper_name != NULL, "insanity check");
3746     //
3747     // Set the correct reg_mask_or_stack for the cisc operand
3748     fprintf(fp_cpp, "\n");
3749     fprintf(fp_cpp, "void %sNode::use_cisc_RegMask() {\n", this->_ident);
3750     // Lookup the correct reg_mask_or_stack
3751     const char *reg_mask_name = cisc_reg_mask_name();
3752     fprintf(fp_cpp, "  _cisc_RegMask = &STACK_OR_%s;\n", reg_mask_name);
3753     fprintf(fp_cpp, "}\n");
3754     //
3755     // Construct CISC version of this instruction
3756     fprintf(fp_cpp, "\n");
3757     fprintf(fp_cpp, "// Build CISC version of this instruction\n");
3758     fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident);
3759     // Create the MachNode object
3760     fprintf(fp_cpp, "  %sNode *node = new (C) %sNode();\n", name, name);
3761     // Fill in the bottom_type where requested
3762     if ( this->captures_bottom_type() ) {
3763       fprintf(fp_cpp, "  node->_bottom_type = bottom_type();\n");
3764     }
3765 
3766     uint cur_num_opnds = num_opnds();
3767     if (cur_num_opnds > 1 && cur_num_opnds != num_unique_opnds()) {
3768       fprintf(fp_cpp,"  node->_num_opnds = %d;\n", num_unique_opnds());
3769     }
3770 
3771     fprintf(fp_cpp, "\n");
3772     fprintf(fp_cpp, "  // Copy _idx, inputs and operands to new node\n");
3773     fprintf(fp_cpp, "  fill_new_machnode(node, C);\n");
3774     // Construct operand to access [stack_pointer + offset]
3775     fprintf(fp_cpp, "  // Construct operand to access [stack_pointer + offset]\n");
3776     fprintf(fp_cpp, "  node->set_opnd_array(cisc_operand(), new (C) %sOper(offset));\n", cisc_oper_name);
3777     fprintf(fp_cpp, "\n");
3778 
3779     // Return result and exit scope
3780     fprintf(fp_cpp, "  return node;\n");
3781     fprintf(fp_cpp, "}\n");
3782     fprintf(fp_cpp, "\n");
3783     return true;
3784   }
3785   return false;
3786 }
3787 
3788 //---------------------------declare_short_branch_methods----------------------
3789 // Build prototypes for short branch methods
3790 void InstructForm::declare_short_branch_methods(FILE *fp_hpp) {


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