src/share/vm/adlc/output_c.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
8034812 Cdiff src/share/vm/adlc/output_c.cpp
src/share/vm/adlc/output_c.cpp
Print this page
*** 998,1008 ****
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 (C) %sNode();\n", i, nop);
}
fprintf(fp_cpp, "};\n\n");
fprintf(fp_cpp, "#ifndef PRODUCT\n");
fprintf(fp_cpp, "void Bundle::dump(outputStream *st) const {\n");
fprintf(fp_cpp, " static const char * bundle_flags[] = {\n");
--- 998,1008 ----
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");
fprintf(fp_cpp, "#ifndef PRODUCT\n");
fprintf(fp_cpp, "void Bundle::dump(outputStream *st) const {\n");
fprintf(fp_cpp, " static const char * bundle_flags[] = {\n");
*** 1326,1336 ****
// Get the root of the new sub-tree
const char *root_inst = NULL;
preplace->next_instruction(root_inst);
InstructForm *root_form = globals[root_inst]->is_instruction();
assert( root_form != NULL, "Replacement instruction was not previously defined");
! fprintf(fp, " %sNode *root = new (C) %sNode();\n", root_inst, root_inst);
int inst_num;
const char *op_name;
int opnds_index = 0; // define result operand
// Then install the use-operands for the new sub-tree
--- 1326,1336 ----
// Get the root of the new sub-tree
const char *root_inst = NULL;
preplace->next_instruction(root_inst);
InstructForm *root_form = globals[root_inst]->is_instruction();
assert( root_form != NULL, "Replacement instruction was not previously defined");
! fprintf(fp, " %sNode *root = new %sNode();\n", root_inst, root_inst);
int inst_num;
const char *op_name;
int opnds_index = 0; // define result operand
// Then install the use-operands for the new sub-tree
*** 1495,1509 ****
frm = node->_localNames[new_id];
assert(frm, "Invalid entry in new operands list of expand rule");
new_oper = frm->is_operand();
char *tmp = (char *)node->_exprule->_newopconst[new_id];
if (tmp == NULL) {
! fprintf(fp," MachOper *op%d = new (C) %sOper();\n",
cnt, new_oper->_ident);
}
else {
! fprintf(fp," MachOper *op%d = new (C) %sOper(%s);\n",
cnt, new_oper->_ident, tmp);
}
}
}
cnt = 0;
--- 1495,1509 ----
frm = node->_localNames[new_id];
assert(frm, "Invalid entry in new operands list of expand rule");
new_oper = frm->is_operand();
char *tmp = (char *)node->_exprule->_newopconst[new_id];
if (tmp == NULL) {
! fprintf(fp," MachOper *op%d = new %sOper();\n",
cnt, new_oper->_ident);
}
else {
! fprintf(fp," MachOper *op%d = new %sOper(%s);\n",
cnt, new_oper->_ident, tmp);
}
}
}
cnt = 0;
*** 1564,1574 ****
globalAD->syntax_err(node->_linenum, "In %s: expand rules using instructs with TEMPs aren't supported: %s",
node->_ident, new_id);
}
// Build the node for the instruction
! fprintf(fp,"\n %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id);
// Add control edge for this node
fprintf(fp," n%d->add_req(_in[0]);\n", cnt);
// Build the operand for the value this node defines.
Form *form = (Form*)_globalNames[new_id];
assert( form, "'new_id' must be a defined form name");
--- 1564,1574 ----
globalAD->syntax_err(node->_linenum, "In %s: expand rules using instructs with TEMPs aren't supported: %s",
node->_ident, new_id);
}
// Build the node for the instruction
! fprintf(fp,"\n %sNode *n%d = new %sNode();\n", new_id, cnt, new_id);
// Add control edge for this node
fprintf(fp," n%d->add_req(_in[0]);\n", cnt);
// Build the operand for the value this node defines.
Form *form = (Form*)_globalNames[new_id];
assert( form, "'new_id' must be a defined form name");
*** 1727,1737 ****
// 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 (C) 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().
//
--- 1727,1737 ----
// 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().
//
*** 1758,1768 ****
syntax_err(node->_linenum, "In %s only bound registers can be killed: %s %s\n",
node->_ident, comp->_type, comp->_name);
}
fprintf(fp," kill = ");
! fprintf(fp,"new (C) MachProjNode( %s, %d, (%s), Op_%s );\n",
machNode, proj_no++, regmask, ideal_type);
fprintf(fp," proj_list.push(kill);\n");
}
}
}
--- 1758,1768 ----
syntax_err(node->_linenum, "In %s only bound registers can be killed: %s %s\n",
node->_ident, comp->_type, comp->_name);
}
fprintf(fp," kill = ");
! fprintf(fp,"new MachProjNode( %s, %d, (%s), Op_%s );\n",
machNode, proj_no++, regmask, ideal_type);
fprintf(fp," proj_list.push(kill);\n");
}
}
}
*** 2838,2857 ****
}
// generate code to create a clone for a class derived from MachOper
//
// (0) MachOper *MachOperXOper::clone(Compile* C) const {
! // (1) return new (C) 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 (C) %sOper(", oper._ident);
// generate parameters for constants
int i = 0;
fprintf(fp,"_c%d", i);
for( i = 1; i < num_consts; ++i) {
fprintf(fp,", _c%d", i);
--- 2838,2857 ----
}
// 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);
// generate parameters for constants
int i = 0;
fprintf(fp,"_c%d", i);
for( i = 1; i < num_consts; ++i) {
fprintf(fp,", _c%d", i);
*** 2859,2869 ****
// finish line (1)
fprintf(fp,");\n");
}
else {
assert( num_consts == 0, "Currently support zero or one constant per operand clone function");
! fprintf(fp," return new (C) %sOper();\n", oper._ident);
}
// finish method
fprintf(fp,"}\n");
}
--- 2859,2869 ----
// finish line (1)
fprintf(fp,");\n");
}
else {
assert( num_consts == 0, "Currently support zero or one constant per operand clone function");
! fprintf(fp," return new %sOper();\n", oper._ident);
}
// finish method
fprintf(fp,"}\n");
}
*** 3104,3114 ****
// 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 (C) %sOper(_label, _block_num);\n", oper->_ident);
fprintf(fp,"}\n");
fprintf(fp,"uint %sOper::opcode() const { return %s; }\n",
oper->_ident, machOperEnum(oper->_ident));
// // Currently all XXXOper::Hash() methods are identical (990820)
--- 3104,3114 ----
// 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));
// // Currently all XXXOper::Hash() methods are identical (990820)
*** 3123,3133 ****
// 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 (C) %sOper(_method);\n", oper->_ident);
fprintf(fp,"}\n");
fprintf(fp,"uint %sOper::opcode() const { return %s; }\n",
oper->_ident, machOperEnum(oper->_ident));
// // Currently all XXXOper::Hash() methods are identical (990820)
--- 3123,3133 ----
// 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));
// // Currently all XXXOper::Hash() methods are identical (990820)
*** 3813,3823 ****
const char *opEnumName = AD.machOperEnum(opName);
uint num_consts = op.num_consts(globalNames);
// Generate the case statement for this opcode
fprintf(fp, " case %s:", opEnumName);
! fprintf(fp, "\n return new (C) %sOper(", opName);
// Access parameters for constructor from the stat object
//
// Build access to condition code value
if ( (num_consts > 0) ) {
uint i = 0;
--- 3813,3823 ----
const char *opEnumName = AD.machOperEnum(opName);
uint num_consts = op.num_consts(globalNames);
// Generate the case statement for this opcode
fprintf(fp, " case %s:", opEnumName);
! fprintf(fp, "\n return new %sOper(", opName);
// Access parameters for constructor from the stat object
//
// Build access to condition code value
if ( (num_consts > 0) ) {
uint i = 0;
*** 3892,3902 ****
void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *indent) {
const char *opType = NULL;
const char *opClass = inst->_ident;
// Create the MachNode object
! fprintf(fp_cpp, "%s %sNode *node = new (C) %sNode();\n",indent, opClass,opClass);
if ( (inst->num_post_match_opnds() != 0) ) {
// Instruction that contains operands which are not in match rule.
//
// Check if the first post-match component may be an interesting def
--- 3892,3902 ----
void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *indent) {
const char *opType = NULL;
const char *opClass = inst->_ident;
// Create the MachNode object
! fprintf(fp_cpp, "%s %sNode *node = new %sNode();\n",indent, opClass,opClass);
if ( (inst->num_post_match_opnds() != 0) ) {
// Instruction that contains operands which are not in match rule.
//
// Check if the first post-match component may be an interesting def
*** 3934,3944 ****
inst->oper_input_base(_globalNames));
// #####
// Check for multiple constants and then fill them in.
// Just like MachOperGenerator
const char *opName = inst->_matrule->_rChild->_opType;
! fprintf(fp_cpp, "new (C) %sOper(", opName);
// Grab operand form
OperandForm *op = (_globalNames[opName])->is_operand();
// Look up the number of constants
uint num_consts = op->num_consts(_globalNames);
if ( (num_consts > 0) ) {
--- 3934,3944 ----
inst->oper_input_base(_globalNames));
// #####
// Check for multiple constants and then fill them in.
// Just like MachOperGenerator
const char *opName = inst->_matrule->_rChild->_opType;
! fprintf(fp_cpp, "new %sOper(", opName);
// Grab operand form
OperandForm *op = (_globalNames[opName])->is_operand();
// Look up the number of constants
uint num_consts = op->num_consts(_globalNames);
if ( (num_consts > 0) ) {
*** 4008,4018 ****
// 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 (C) %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");
}
--- 4008,4018 ----
// 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");
}
*** 4024,4034 ****
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 (C) %sOper(offset));\n", cisc_oper_name);
fprintf(fp_cpp, "\n");
// Return result and exit scope
fprintf(fp_cpp, " return node;\n");
fprintf(fp_cpp, "}\n");
--- 4024,4034 ----
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");
// Return result and exit scope
fprintf(fp_cpp, " return node;\n");
fprintf(fp_cpp, "}\n");
*** 4055,4065 ****
// 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 (C) %sNode();\n", name, name);
if( is_ideal_if() ) {
fprintf(fp_cpp, " node->_prob = _prob;\n");
fprintf(fp_cpp, " node->_fcnt = _fcnt;\n");
}
// Fill in the bottom_type where requested
--- 4055,4065 ----
// 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");
}
// Fill in the bottom_type where requested
src/share/vm/adlc/output_c.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File