src/share/vm/adlc/output_c.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/adlc/output_c.cpp	Mon Aug  4 14:31:47 2014
--- new/src/share/vm/adlc/output_c.cpp	Mon Aug  4 14:31:46 2014

*** 1,7 **** --- 1,7 ---- /* ! * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 995,1005 **** --- 995,1005 ---- fprintf(fp_cpp, "// Descriptions for emitting different functional unit nops\n"); const char *nop; int nopcnt = 0; for ( _pipeline->_noplist.reset(); (nop = _pipeline->_noplist.iter()) != NULL; nopcnt++ ); - fprintf(fp_cpp, "void Bundle::initialize_nops(MachNode * nop_list[%d], Compile *C) {\n", nopcnt); int i = 0; for ( _pipeline->_noplist.reset(); (nop = _pipeline->_noplist.iter()) != NULL; i++ ) { fprintf(fp_cpp, " nop_list[%d] = (MachNode *) new %sNode();\n", i, nop); } fprintf(fp_cpp, "};\n\n");
*** 1367,1377 **** --- 1367,1377 ---- } // Define result register and result operand fprintf(fp, " ra_->add_reference(root, inst%d);\n", inst_num); fprintf(fp, " ra_->set_oop (root, ra_->is_oop(inst%d));\n", inst_num); fprintf(fp, " ra_->set_pair(root->_idx, ra_->get_reg_second(inst%d), ra_->get_reg_first(inst%d));\n", inst_num, inst_num); - fprintf(fp, " root->_opnds[0] = inst%d->_opnds[0]->clone(C); // result\n", inst_num); fprintf(fp, " // ----- Done with initial setup -----\n"); } else { if( (op_form == NULL) || (op_form->is_base_constant(globals) == Form::none) ) { // Do not have ideal edges for constants after matching fprintf(fp, " for( unsigned x%d = inst%d_idx%d; x%d < inst%d_idx%d; x%d++ )\n",
*** 1380,1390 **** --- 1380,1390 ---- fprintf(fp, " root->add_req( inst%d->in(x%d) );\n", inst_num, inst_op_num ); } else { fprintf(fp, " // no ideal edge for constants after matching\n"); } - fprintf(fp, " root->_opnds[%d] = inst%d->_opnds[%d]->clone(C);\n", opnds_index, inst_num, inst_op_num ); } ++opnds_index; } }else {
*** 1400,1410 **** --- 1400,1410 ---- // Define the Peephole method for an instruction node void ArchDesc::definePeephole(FILE *fp, InstructForm *node) { // Generate Peephole function header - fprintf(fp, "MachNode *%sNode::peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C ) {\n", node->_ident); fprintf(fp, " bool matches = true;\n"); // Identify the maximum instruction position, // generate temporaries that hold current instruction //
*** 1591,1601 **** --- 1591,1601 ---- new_inst->captures_bottom_type(_globalNames)) { fprintf(fp, " ((MachTypeNode*)n%d)->_bottom_type = bottom_type();\n", cnt); } const char *resultOper = new_inst->reduce_result(); - fprintf(fp," n%d->set_opnd_array(0, state->MachOperGenerator( %s, C ));\n", cnt, machOperEnum(resultOper)); // get the formal operand NameList NameList *formal_lst = &new_inst->_parameters; formal_lst->reset();
*** 1632,1642 **** --- 1632,1642 ---- new_pos = new_inst->operand_position(parameter,Component::USE); exp_pos += node->num_opnds(); // If there is no use of the created operand, just skip it if (new_pos != NameList::Not_in_list) { //Copy the operand from the original made above - fprintf(fp," n%d->set_opnd_array(%d, op%d->clone(C)); // %s\n", cnt, new_pos, exp_pos-node->num_opnds(), opid); // Check for who defines this operand & add edge if needed fprintf(fp," if(tmp%d != NULL)\n", exp_pos); fprintf(fp," n%d->add_req(tmp%d);\n", cnt, exp_pos); }
*** 1660,1670 **** --- 1660,1670 ---- prev_pos = exp_pos; new_pos = new_inst->operand_position(parameter,Component::USE); if (new_pos != -1) { // Copy the operand from the ExpandNode to the new node - fprintf(fp," n%d->set_opnd_array(%d, opnd_array(%d)->clone(C)); // %s\n", cnt, new_pos, exp_pos, opid); // For each operand add appropriate input edges by looking at tmp's fprintf(fp," if(tmp%d == this) {\n", exp_pos); // Grab corresponding edges from ExpandNode and insert them here fprintf(fp," for(unsigned i = 0; i < num%d; i++) {\n", exp_pos);
*** 1727,1744 **** --- 1727,1744 ---- // Define the variable "def" to hold new MachProjNodes fprintf(fp, " MachTempNode *def;\n"); declared_def = true; } if (op && op->_interface && op->_interface->is_RegInterface()) { - fprintf(fp," def = new MachTempNode(state->MachOperGenerator( %s, C ));\n", machOperEnum(op->_ident)); fprintf(fp," add_req(def);\n"); // The operand for TEMP is already constructed during // this mach node construction, see buildMachNode(). // // int idx = node->operand_position_format(comp->_name); - // fprintf(fp," set_opnd_array(%d, state->MachOperGenerator( %s, C ));\n", // idx, machOperEnum(op->_ident)); } else { assert(false, "can't have temps which aren't registers"); } } else if (comp->isa(Component::KILL)) {
*** 1800,1810 **** --- 1800,1810 ---- for( ; i < cur_num_opnds; i++ ) { comp = node->_components.iter(); uint j = node->unique_opnds_idx(i); // unique_opnds_idx(i) is unique if unique_opnds_idx(j) is not unique. if( j != node->unique_opnds_idx(j) ) { - fprintf(fp," set_opnd_array(%d, opnd_array(%d)->clone(C)); // %s\n", new_num_opnds, i, comp->_name); // delete not unique edges here fprintf(fp," for(unsigned i = 0; i < num%d; i++) {\n", i); fprintf(fp," set_req(i + idx%d, _in[i + idx%d]);\n", new_num_opnds, i); fprintf(fp," }\n");
*** 2837,2852 **** --- 2837,2852 ---- } } // generate code to create a clone for a class derived from MachOper // - // (0) MachOper *MachOperXOper::clone(Compile* C) const { // (1) return new MachXOper( _ccode, _c0, _c1, ..., _cn); // (2) } // static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) { - fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper._ident); // Check for constants that need to be copied over const int num_consts = oper.num_consts(globalNames); const bool is_ideal_bool = oper.is_ideal_bool(); if( (num_consts > 0) ) { fprintf(fp," return new %sOper(", oper._ident);
*** 3041,3051 **** --- 3041,3051 ---- // // Construct the method to copy _idx, inputs and operands to new node. static void define_fill_new_machnode(bool used, FILE *fp_cpp) { fprintf(fp_cpp, "\n"); fprintf(fp_cpp, "// Copy _idx, inputs and operands to new node\n"); ! fprintf(fp_cpp, "void MachNode::fill_new_machnode( MachNode* node, Compile* C) const {\n"); if( !used ) { fprintf(fp_cpp, " // This architecture does not have cisc or short branch instructions\n"); fprintf(fp_cpp, " ShouldNotCallThis();\n"); fprintf(fp_cpp, "}\n"); } else {
*** 3062,3072 **** --- 3062,3072 ---- fprintf(fp_cpp, " int nopnds = num_opnds();\n"); fprintf(fp_cpp, " assert( node->num_opnds() == (uint)nopnds, \"Must have same number of operands\");\n"); fprintf(fp_cpp, " MachOper **to = node->_opnds;\n"); fprintf(fp_cpp, " for( int i = 0; i < nopnds; i++ ) {\n"); fprintf(fp_cpp, " if( i != cisc_operand() ) \n"); - fprintf(fp_cpp, " to[i] = _opnds[i]->clone(C);\n"); fprintf(fp_cpp, " }\n"); fprintf(fp_cpp, "}\n"); } fprintf(fp_cpp, "\n"); }
*** 3103,3113 **** --- 3103,3113 ---- // !!!!! // The declaration of labelOper is in machine-independent file: machnode if ( strcmp(oper->_ident,"label") == 0 ) { defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper); - fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident); fprintf(fp," return new %sOper(_label, _block_num);\n", oper->_ident); fprintf(fp,"}\n"); fprintf(fp,"uint %sOper::opcode() const { return %s; }\n", oper->_ident, machOperEnum(oper->_ident));
*** 3122,3132 **** --- 3122,3132 ---- // The declaration of methodOper is in machine-independent file: machnode if ( strcmp(oper->_ident,"method") == 0 ) { defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper); - fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident); fprintf(fp," return new %sOper(_method);\n", oper->_ident); fprintf(fp,"}\n"); fprintf(fp,"uint %sOper::opcode() const { return %s; }\n", oper->_ident, machOperEnum(oper->_ident));
*** 3843,3853 **** --- 3843,3853 ---- fprintf(fp_cpp, "// A switch statement on the dense-packed user-defined type system\n" "// that invokes 'new' on the corresponding class constructor.\n"); fprintf(fp_cpp, "\n"); fprintf(fp_cpp, "MachOper *State::MachOperGenerator"); - fprintf(fp_cpp, "(int opcode, Compile* C)"); fprintf(fp_cpp, "{\n"); fprintf(fp_cpp, "\n"); fprintf(fp_cpp, " switch(opcode) {\n"); // Place all user-defined operands into the mapping
*** 3919,3929 **** --- 3919,3929 ---- // with the enum for the opcode that needs to be built. ComponentList clist = inst->_components; int index = clist.operand_position(comp->_name, comp->_usedef, inst); const char *opcode = machOperEnum(comp->_type); fprintf(fp_cpp, "%s node->set_opnd_array(%d, ", indent, index); - fprintf(fp_cpp, "MachOperGenerator(%s, C));\n", opcode); } } else if ( inst->is_chain_of_constant(_globalNames, opType) ) { // An instruction that chains from a constant! // In this case, we need to subsume the constant into the node
*** 3976,3986 **** --- 3976,3986 ---- void InstructForm::declare_cisc_version(ArchDesc &AD, FILE *fp_hpp) { if( AD.can_cisc_spill() ) { InstructForm *inst_cisc = cisc_spill_alternate(); if (inst_cisc != NULL) { fprintf(fp_hpp, " virtual int cisc_operand() const { return %d; }\n", cisc_spill_operand()); - fprintf(fp_hpp, " virtual MachNode *cisc_version(int offset, Compile* C);\n"); fprintf(fp_hpp, " virtual void use_cisc_RegMask();\n"); fprintf(fp_hpp, " virtual const RegMask *cisc_RegMask() const { return _cisc_RegMask; }\n"); } } }
*** 4006,4016 **** --- 4006,4016 ---- fprintf(fp_cpp, "}\n"); // // Construct CISC version of this instruction fprintf(fp_cpp, "\n"); fprintf(fp_cpp, "// Build CISC version of this instruction\n"); - fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident); // Create the MachNode object fprintf(fp_cpp, " %sNode *node = new %sNode();\n", name, name); // Fill in the bottom_type where requested if ( this->captures_bottom_type(AD.globalNames()) ) { fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n");
*** 4021,4031 **** --- 4021,4031 ---- fprintf(fp_cpp," node->_num_opnds = %d;\n", num_unique_opnds()); } fprintf(fp_cpp, "\n"); fprintf(fp_cpp, " // Copy _idx, inputs and operands to new node\n"); - fprintf(fp_cpp, " fill_new_machnode(node, C);\n"); // Construct operand to access [stack_pointer + offset] fprintf(fp_cpp, " // Construct operand to access [stack_pointer + offset]\n"); fprintf(fp_cpp, " node->set_opnd_array(cisc_operand(), new %sOper(offset));\n", cisc_oper_name); fprintf(fp_cpp, "\n");
*** 4040,4050 **** --- 4040,4050 ---- //---------------------------declare_short_branch_methods---------------------- // Build prototypes for short branch methods void InstructForm::declare_short_branch_methods(FILE *fp_hpp) { if (has_short_branch_form()) { - fprintf(fp_hpp, " virtual MachNode *short_branch_version(Compile* C);\n"); } } //---------------------------define_short_branch_methods----------------------- // Build definitions for short branch methods
*** 4053,4063 **** --- 4053,4063 ---- InstructForm *short_branch = short_branch_form(); const char *name = short_branch->_ident; // Construct short_branch_version() method. fprintf(fp_cpp, "// Build short branch version of this instruction\n"); - fprintf(fp_cpp, "MachNode *%sNode::short_branch_version(Compile* C) {\n", this->_ident); // Create the MachNode object fprintf(fp_cpp, " %sNode *node = new %sNode();\n", name, name); if( is_ideal_if() ) { fprintf(fp_cpp, " node->_prob = _prob;\n"); fprintf(fp_cpp, " node->_fcnt = _fcnt;\n");
*** 4069,4079 **** --- 4069,4079 ---- fprintf(fp_cpp, "\n"); // Short branch version must use same node index for access // through allocator's tables fprintf(fp_cpp, " // Copy _idx, inputs and operands to new node\n"); - fprintf(fp_cpp, " fill_new_machnode(node, C);\n"); // Return result and exit scope fprintf(fp_cpp, " return node;\n"); fprintf(fp_cpp, "}\n"); fprintf(fp_cpp,"\n");
*** 4095,4105 **** --- 4095,4105 ---- fprintf(fp_cpp, "// A switch statement on the dense-packed user-defined type system\n" "// that invokes 'new' on the corresponding class constructor.\n"); fprintf(fp_cpp, "\n"); fprintf(fp_cpp, "MachNode *State::MachNodeGenerator"); - fprintf(fp_cpp, "(int opcode, Compile* C)"); fprintf(fp_cpp, "{\n"); fprintf(fp_cpp, " switch(opcode) {\n"); // Provide constructor for all user-defined instructions _instructions.reset();

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