1825 fprintf(fp," }\n");
1826 fprintf(fp," num%d = num%d;\n", new_num_opnds, i);
1827 fprintf(fp," idx%d = idx%d + num%d;\n", new_num_opnds+1, new_num_opnds, new_num_opnds);
1828 new_num_opnds++;
1829 }
1830 }
1831 // delete the rest of edges
1832 fprintf(fp," for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds);
1833 fprintf(fp," del_req(i);\n");
1834 fprintf(fp," }\n");
1835 fprintf(fp," _num_opnds = %d;\n", new_num_opnds);
1836 assert(new_num_opnds == node->num_unique_opnds(), "what?");
1837 }
1838 }
1839
1840 // If the node is a MachConstantNode, insert the MachConstantBaseNode edge.
1841 // NOTE: this edge must be the last input (see MachConstantNode::mach_constant_base_node_input).
1842 // There are nodes that don't use $constantablebase, but still require that it
1843 // is an input to the node. Example: divF_reg_immN, Repl32B_imm on x86_64.
1844 if (node->is_mach_constant() || node->needs_constant_base()) {
1845 fprintf(fp," add_req(C->mach_constant_base_node());\n");
1846 }
1847
1848 fprintf(fp,"\n");
1849 if( node->expands() ) {
1850 fprintf(fp," return result;\n");
1851 } else {
1852 fprintf(fp," return this;\n");
1853 }
1854 fprintf(fp,"}\n");
1855 fprintf(fp,"\n");
1856 }
1857
1858
1859 //------------------------------Emit Routines----------------------------------
1860 // Special classes and routines for defining node emit routines which output
1861 // target specific instruction object encodings.
1862 // Define the ___Node::emit() routine
1863 //
1864 // (1) void ___Node::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
1865 // (2) // ... encoding defined by user
1866 // (3)
1867 // (4) }
1868 //
1869
1870 class DefineEmitState {
1871 private:
1872 enum reloc_format { RELOC_NONE = -1,
1873 RELOC_IMMEDIATE = 0,
1874 RELOC_DISP = 1,
1875 RELOC_CALL_DISP = 2 };
3625 map.record_position(OutputMap::END_INSTRUCTIONS, idx );
3626 }
3627 // Finish defining table
3628 map.closing();
3629 };
3630
3631
3632 // Helper function for buildReduceMaps
3633 char reg_save_policy(const char *calling_convention) {
3634 char callconv;
3635
3636 if (!strcmp(calling_convention, "NS")) callconv = 'N';
3637 else if (!strcmp(calling_convention, "SOE")) callconv = 'E';
3638 else if (!strcmp(calling_convention, "SOC")) callconv = 'C';
3639 else if (!strcmp(calling_convention, "AS")) callconv = 'A';
3640 else callconv = 'Z';
3641
3642 return callconv;
3643 }
3644
3645 //---------------------------generate_assertion_checks-------------------
3646 void ArchDesc::generate_adlc_verification(FILE *fp_cpp) {
3647 fprintf(fp_cpp, "\n");
3648
3649 fprintf(fp_cpp, "#ifndef PRODUCT\n");
3650 fprintf(fp_cpp, "void Compile::adlc_verification() {\n");
3651 globalDefs().print_asserts(fp_cpp);
3652 fprintf(fp_cpp, "}\n");
3653 fprintf(fp_cpp, "#endif\n");
3654 fprintf(fp_cpp, "\n");
3655 }
3656
3657 //---------------------------addSourceBlocks-----------------------------
3658 void ArchDesc::addSourceBlocks(FILE *fp_cpp) {
3659 if (_source.count() > 0)
3660 _source.output(fp_cpp);
3661
3662 generate_adlc_verification(fp_cpp);
3663 }
3664 //---------------------------addHeaderBlocks-----------------------------
|
1825 fprintf(fp," }\n");
1826 fprintf(fp," num%d = num%d;\n", new_num_opnds, i);
1827 fprintf(fp," idx%d = idx%d + num%d;\n", new_num_opnds+1, new_num_opnds, new_num_opnds);
1828 new_num_opnds++;
1829 }
1830 }
1831 // delete the rest of edges
1832 fprintf(fp," for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds);
1833 fprintf(fp," del_req(i);\n");
1834 fprintf(fp," }\n");
1835 fprintf(fp," _num_opnds = %d;\n", new_num_opnds);
1836 assert(new_num_opnds == node->num_unique_opnds(), "what?");
1837 }
1838 }
1839
1840 // If the node is a MachConstantNode, insert the MachConstantBaseNode edge.
1841 // NOTE: this edge must be the last input (see MachConstantNode::mach_constant_base_node_input).
1842 // There are nodes that don't use $constantablebase, but still require that it
1843 // is an input to the node. Example: divF_reg_immN, Repl32B_imm on x86_64.
1844 if (node->is_mach_constant() || node->needs_constant_base()) {
1845 if (node->is_ideal_call() != Form::invalid_type &&
1846 node->is_ideal_call() != Form::JAVA_LEAF) {
1847 fprintf(fp, " // MachConstantBaseNode added in matcher.\n");
1848 _needs_clone_jvms = true;
1849 } else {
1850 fprintf(fp, " add_req(C->mach_constant_base_node());\n");
1851 }
1852 }
1853
1854 fprintf(fp, "\n");
1855 if (node->expands()) {
1856 fprintf(fp, " return result;\n");
1857 } else {
1858 fprintf(fp, " return this;\n");
1859 }
1860 fprintf(fp, "}\n");
1861 fprintf(fp, "\n");
1862 }
1863
1864
1865 //------------------------------Emit Routines----------------------------------
1866 // Special classes and routines for defining node emit routines which output
1867 // target specific instruction object encodings.
1868 // Define the ___Node::emit() routine
1869 //
1870 // (1) void ___Node::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
1871 // (2) // ... encoding defined by user
1872 // (3)
1873 // (4) }
1874 //
1875
1876 class DefineEmitState {
1877 private:
1878 enum reloc_format { RELOC_NONE = -1,
1879 RELOC_IMMEDIATE = 0,
1880 RELOC_DISP = 1,
1881 RELOC_CALL_DISP = 2 };
3631 map.record_position(OutputMap::END_INSTRUCTIONS, idx );
3632 }
3633 // Finish defining table
3634 map.closing();
3635 };
3636
3637
3638 // Helper function for buildReduceMaps
3639 char reg_save_policy(const char *calling_convention) {
3640 char callconv;
3641
3642 if (!strcmp(calling_convention, "NS")) callconv = 'N';
3643 else if (!strcmp(calling_convention, "SOE")) callconv = 'E';
3644 else if (!strcmp(calling_convention, "SOC")) callconv = 'C';
3645 else if (!strcmp(calling_convention, "AS")) callconv = 'A';
3646 else callconv = 'Z';
3647
3648 return callconv;
3649 }
3650
3651 void ArchDesc::generate_needs_clone_jvms(FILE *fp_cpp) {
3652 fprintf(fp_cpp, "bool Compile::needs_clone_jvms() { return %s; }\n\n",
3653 _needs_clone_jvms ? "true" : "false");
3654 }
3655
3656 //---------------------------generate_assertion_checks-------------------
3657 void ArchDesc::generate_adlc_verification(FILE *fp_cpp) {
3658 fprintf(fp_cpp, "\n");
3659
3660 fprintf(fp_cpp, "#ifndef PRODUCT\n");
3661 fprintf(fp_cpp, "void Compile::adlc_verification() {\n");
3662 globalDefs().print_asserts(fp_cpp);
3663 fprintf(fp_cpp, "}\n");
3664 fprintf(fp_cpp, "#endif\n");
3665 fprintf(fp_cpp, "\n");
3666 }
3667
3668 //---------------------------addSourceBlocks-----------------------------
3669 void ArchDesc::addSourceBlocks(FILE *fp_cpp) {
3670 if (_source.count() > 0)
3671 _source.output(fp_cpp);
3672
3673 generate_adlc_verification(fp_cpp);
3674 }
3675 //---------------------------addHeaderBlocks-----------------------------
|