1565 node->_ident, new_id); 1566 } 1567 1568 // Build the node for the instruction 1569 fprintf(fp,"\n %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id); 1570 // Add control edge for this node 1571 fprintf(fp," n%d->add_req(_in[0]);\n", cnt); 1572 // Build the operand for the value this node defines. 1573 Form *form = (Form*)_globalNames[new_id]; 1574 assert( form, "'new_id' must be a defined form name"); 1575 // Grab the InstructForm for the new instruction 1576 new_inst = form->is_instruction(); 1577 assert( new_inst, "'new_id' must be an instruction name"); 1578 if( node->is_ideal_if() && new_inst->is_ideal_if() ) { 1579 fprintf(fp, " ((MachIfNode*)n%d)->_prob = _prob;\n",cnt); 1580 fprintf(fp, " ((MachIfNode*)n%d)->_fcnt = _fcnt;\n",cnt); 1581 } 1582 1583 if( node->is_ideal_fastlock() && new_inst->is_ideal_fastlock() ) { 1584 fprintf(fp, " ((MachFastLockNode*)n%d)->_counters = _counters;\n",cnt); 1585 } 1586 1587 // Fill in the bottom_type where requested 1588 if (node->captures_bottom_type(_globalNames) && 1589 new_inst->captures_bottom_type(_globalNames)) { 1590 fprintf(fp, " ((MachTypeNode*)n%d)->_bottom_type = bottom_type();\n", cnt); 1591 } 1592 1593 const char *resultOper = new_inst->reduce_result(); 1594 fprintf(fp," n%d->set_opnd_array(0, state->MachOperGenerator( %s, C ));\n", 1595 cnt, machOperEnum(resultOper)); 1596 1597 // get the formal operand NameList 1598 NameList *formal_lst = &new_inst->_parameters; 1599 formal_lst->reset(); 1600 1601 // Handle any memory operand 1602 int memory_operand = new_inst->memory_operand(_globalNames); 1603 if( memory_operand != InstructForm::NO_MEMORY_OPERAND ) { 1604 int node_mem_op = node->memory_operand(_globalNames); 3946 fprintf(fp_cpp, ", "); 3947 path_to_constant(fp_cpp, _globalNames, op->_matrule, i); 3948 } 3949 } 3950 fprintf(fp_cpp, " );\n"); 3951 // ##### 3952 } 3953 3954 // Fill in the bottom_type where requested 3955 if (inst->captures_bottom_type(_globalNames)) { 3956 if (strncmp("MachCall", inst->mach_base_class(_globalNames), strlen("MachCall"))) { 3957 fprintf(fp_cpp, "%s node->_bottom_type = _leaf->bottom_type();\n", indent); 3958 } 3959 } 3960 if( inst->is_ideal_if() ) { 3961 fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent); 3962 fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent); 3963 } 3964 if( inst->is_ideal_fastlock() ) { 3965 fprintf(fp_cpp, "%s node->_counters = _leaf->as_FastLock()->counters();\n", indent); 3966 } 3967 3968 } 3969 3970 //---------------------------declare_cisc_version------------------------------ 3971 // Build CISC version of this instruction 3972 void InstructForm::declare_cisc_version(ArchDesc &AD, FILE *fp_hpp) { 3973 if( AD.can_cisc_spill() ) { 3974 InstructForm *inst_cisc = cisc_spill_alternate(); 3975 if (inst_cisc != NULL) { 3976 fprintf(fp_hpp, " virtual int cisc_operand() const { return %d; }\n", cisc_spill_operand()); 3977 fprintf(fp_hpp, " virtual MachNode *cisc_version(int offset, Compile* C);\n"); 3978 fprintf(fp_hpp, " virtual void use_cisc_RegMask();\n"); 3979 fprintf(fp_hpp, " virtual const RegMask *cisc_RegMask() const { return _cisc_RegMask; }\n"); 3980 } 3981 } 3982 } 3983 3984 //---------------------------define_cisc_version------------------------------- 3985 // Build CISC version of this instruction | 1565 node->_ident, new_id); 1566 } 1567 1568 // Build the node for the instruction 1569 fprintf(fp,"\n %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id); 1570 // Add control edge for this node 1571 fprintf(fp," n%d->add_req(_in[0]);\n", cnt); 1572 // Build the operand for the value this node defines. 1573 Form *form = (Form*)_globalNames[new_id]; 1574 assert( form, "'new_id' must be a defined form name"); 1575 // Grab the InstructForm for the new instruction 1576 new_inst = form->is_instruction(); 1577 assert( new_inst, "'new_id' must be an instruction name"); 1578 if( node->is_ideal_if() && new_inst->is_ideal_if() ) { 1579 fprintf(fp, " ((MachIfNode*)n%d)->_prob = _prob;\n",cnt); 1580 fprintf(fp, " ((MachIfNode*)n%d)->_fcnt = _fcnt;\n",cnt); 1581 } 1582 1583 if( node->is_ideal_fastlock() && new_inst->is_ideal_fastlock() ) { 1584 fprintf(fp, " ((MachFastLockNode*)n%d)->_counters = _counters;\n",cnt); 1585 fprintf(fp, " ((MachFastLockNode*)n%d)->_rtmcounters = _rtmcounters;\n",cnt); 1586 fprintf(fp, " ((MachFastLockNode*)n%d)->_stackrtmcounters = _stackrtmcounters;\n",cnt); 1587 } 1588 1589 // Fill in the bottom_type where requested 1590 if (node->captures_bottom_type(_globalNames) && 1591 new_inst->captures_bottom_type(_globalNames)) { 1592 fprintf(fp, " ((MachTypeNode*)n%d)->_bottom_type = bottom_type();\n", cnt); 1593 } 1594 1595 const char *resultOper = new_inst->reduce_result(); 1596 fprintf(fp," n%d->set_opnd_array(0, state->MachOperGenerator( %s, C ));\n", 1597 cnt, machOperEnum(resultOper)); 1598 1599 // get the formal operand NameList 1600 NameList *formal_lst = &new_inst->_parameters; 1601 formal_lst->reset(); 1602 1603 // Handle any memory operand 1604 int memory_operand = new_inst->memory_operand(_globalNames); 1605 if( memory_operand != InstructForm::NO_MEMORY_OPERAND ) { 1606 int node_mem_op = node->memory_operand(_globalNames); 3948 fprintf(fp_cpp, ", "); 3949 path_to_constant(fp_cpp, _globalNames, op->_matrule, i); 3950 } 3951 } 3952 fprintf(fp_cpp, " );\n"); 3953 // ##### 3954 } 3955 3956 // Fill in the bottom_type where requested 3957 if (inst->captures_bottom_type(_globalNames)) { 3958 if (strncmp("MachCall", inst->mach_base_class(_globalNames), strlen("MachCall"))) { 3959 fprintf(fp_cpp, "%s node->_bottom_type = _leaf->bottom_type();\n", indent); 3960 } 3961 } 3962 if( inst->is_ideal_if() ) { 3963 fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent); 3964 fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent); 3965 } 3966 if( inst->is_ideal_fastlock() ) { 3967 fprintf(fp_cpp, "%s node->_counters = _leaf->as_FastLock()->counters();\n", indent); 3968 fprintf(fp_cpp, "%s node->_rtmcounters = _leaf->as_FastLock()->rtmcounters();\n", indent); 3969 fprintf(fp_cpp, "%s node->_stackrtmcounters = _leaf->as_FastLock()->stackrtmcounters();\n", indent); 3970 } 3971 3972 } 3973 3974 //---------------------------declare_cisc_version------------------------------ 3975 // Build CISC version of this instruction 3976 void InstructForm::declare_cisc_version(ArchDesc &AD, FILE *fp_hpp) { 3977 if( AD.can_cisc_spill() ) { 3978 InstructForm *inst_cisc = cisc_spill_alternate(); 3979 if (inst_cisc != NULL) { 3980 fprintf(fp_hpp, " virtual int cisc_operand() const { return %d; }\n", cisc_spill_operand()); 3981 fprintf(fp_hpp, " virtual MachNode *cisc_version(int offset, Compile* C);\n"); 3982 fprintf(fp_hpp, " virtual void use_cisc_RegMask();\n"); 3983 fprintf(fp_hpp, " virtual const RegMask *cisc_RegMask() const { return _cisc_RegMask; }\n"); 3984 } 3985 } 3986 } 3987 3988 //---------------------------define_cisc_version------------------------------- 3989 // Build CISC version of this instruction |