3129 InstructForm *instr;
3130 MachNodeForm *machnode;
3131 for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
3132 // Ensure this is a machine-world instruction
3133 if ( instr->ideal_only() ) continue;
3134
3135 defineOut_RegMask(_CPP_MISC_file._fp, instr->_ident, reg_mask(*instr));
3136 }
3137
3138 bool used = false;
3139 // Output the definitions for expand rules & peephole rules
3140 _instructions.reset();
3141 for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
3142 // Ensure this is a machine-world instruction
3143 if ( instr->ideal_only() ) continue;
3144 // If there are multiple defs/kills, or an explicit expand rule, build rule
3145 if( instr->expands() || instr->needs_projections() ||
3146 instr->has_temps() ||
3147 instr->is_mach_constant() ||
3148 instr->needs_constant_base() ||
3149 instr->_matrule != NULL &&
3150 instr->num_opnds() != instr->num_unique_opnds() )
3151 defineExpand(_CPP_EXPAND_file._fp, instr);
3152 // If there is an explicit peephole rule, build it
3153 if ( instr->peepholes() )
3154 definePeephole(_CPP_PEEPHOLE_file._fp, instr);
3155
3156 // Output code to convert to the cisc version, if applicable
3157 used |= instr->define_cisc_version(*this, fp);
3158
3159 // Output code to convert to the short branch version, if applicable
3160 used |= instr->define_short_branch_methods(*this, fp);
3161 }
3162
3163 // Construct the method called by cisc_version() to copy inputs and operands.
3164 define_fill_new_machnode(used, fp);
3165
3166 // Output the definitions for labels
3167 _instructions.reset();
3168 while( (instr = (InstructForm*)_instructions.iter()) != NULL ) {
3169 // Ensure this is a machine-world instruction
3170 if ( instr->ideal_only() ) continue;
3861 void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *indent) {
3862 const char *opType = NULL;
3863 const char *opClass = inst->_ident;
3864
3865 // Create the MachNode object
3866 fprintf(fp_cpp, "%s %sNode *node = new %sNode();\n",indent, opClass,opClass);
3867
3868 if ( (inst->num_post_match_opnds() != 0) ) {
3869 // Instruction that contains operands which are not in match rule.
3870 //
3871 // Check if the first post-match component may be an interesting def
3872 bool dont_care = false;
3873 ComponentList &comp_list = inst->_components;
3874 Component *comp = NULL;
3875 comp_list.reset();
3876 if ( comp_list.match_iter() != NULL ) dont_care = true;
3877
3878 // Insert operands that are not in match-rule.
3879 // Only insert a DEF if the do_care flag is set
3880 comp_list.reset();
3881 while ( comp = comp_list.post_match_iter() ) {
3882 // Check if we don't care about DEFs or KILLs that are not USEs
3883 if ( dont_care && (! comp->isa(Component::USE)) ) {
3884 continue;
3885 }
3886 dont_care = true;
3887 // For each operand not in the match rule, call MachOperGenerator
3888 // with the enum for the opcode that needs to be built.
3889 ComponentList clist = inst->_components;
3890 int index = clist.operand_position(comp->_name, comp->_usedef, inst);
3891 const char *opcode = machOperEnum(comp->_type);
3892 fprintf(fp_cpp, "%s node->set_opnd_array(%d, ", indent, index);
3893 fprintf(fp_cpp, "MachOperGenerator(%s));\n", opcode);
3894 }
3895 }
3896 else if ( inst->is_chain_of_constant(_globalNames, opType) ) {
3897 // An instruction that chains from a constant!
3898 // In this case, we need to subsume the constant into the node
3899 // at operand position, oper_input_base().
3900 //
3901 // Fill in the constant
|
3129 InstructForm *instr;
3130 MachNodeForm *machnode;
3131 for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
3132 // Ensure this is a machine-world instruction
3133 if ( instr->ideal_only() ) continue;
3134
3135 defineOut_RegMask(_CPP_MISC_file._fp, instr->_ident, reg_mask(*instr));
3136 }
3137
3138 bool used = false;
3139 // Output the definitions for expand rules & peephole rules
3140 _instructions.reset();
3141 for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
3142 // Ensure this is a machine-world instruction
3143 if ( instr->ideal_only() ) continue;
3144 // If there are multiple defs/kills, or an explicit expand rule, build rule
3145 if( instr->expands() || instr->needs_projections() ||
3146 instr->has_temps() ||
3147 instr->is_mach_constant() ||
3148 instr->needs_constant_base() ||
3149 (instr->_matrule != NULL &&
3150 instr->num_opnds() != instr->num_unique_opnds()) )
3151 defineExpand(_CPP_EXPAND_file._fp, instr);
3152 // If there is an explicit peephole rule, build it
3153 if ( instr->peepholes() )
3154 definePeephole(_CPP_PEEPHOLE_file._fp, instr);
3155
3156 // Output code to convert to the cisc version, if applicable
3157 used |= instr->define_cisc_version(*this, fp);
3158
3159 // Output code to convert to the short branch version, if applicable
3160 used |= instr->define_short_branch_methods(*this, fp);
3161 }
3162
3163 // Construct the method called by cisc_version() to copy inputs and operands.
3164 define_fill_new_machnode(used, fp);
3165
3166 // Output the definitions for labels
3167 _instructions.reset();
3168 while( (instr = (InstructForm*)_instructions.iter()) != NULL ) {
3169 // Ensure this is a machine-world instruction
3170 if ( instr->ideal_only() ) continue;
3861 void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *indent) {
3862 const char *opType = NULL;
3863 const char *opClass = inst->_ident;
3864
3865 // Create the MachNode object
3866 fprintf(fp_cpp, "%s %sNode *node = new %sNode();\n",indent, opClass,opClass);
3867
3868 if ( (inst->num_post_match_opnds() != 0) ) {
3869 // Instruction that contains operands which are not in match rule.
3870 //
3871 // Check if the first post-match component may be an interesting def
3872 bool dont_care = false;
3873 ComponentList &comp_list = inst->_components;
3874 Component *comp = NULL;
3875 comp_list.reset();
3876 if ( comp_list.match_iter() != NULL ) dont_care = true;
3877
3878 // Insert operands that are not in match-rule.
3879 // Only insert a DEF if the do_care flag is set
3880 comp_list.reset();
3881 while ( (comp = comp_list.post_match_iter()) ) {
3882 // Check if we don't care about DEFs or KILLs that are not USEs
3883 if ( dont_care && (! comp->isa(Component::USE)) ) {
3884 continue;
3885 }
3886 dont_care = true;
3887 // For each operand not in the match rule, call MachOperGenerator
3888 // with the enum for the opcode that needs to be built.
3889 ComponentList clist = inst->_components;
3890 int index = clist.operand_position(comp->_name, comp->_usedef, inst);
3891 const char *opcode = machOperEnum(comp->_type);
3892 fprintf(fp_cpp, "%s node->set_opnd_array(%d, ", indent, index);
3893 fprintf(fp_cpp, "MachOperGenerator(%s));\n", opcode);
3894 }
3895 }
3896 else if ( inst->is_chain_of_constant(_globalNames, opType) ) {
3897 // An instruction that chains from a constant!
3898 // In this case, we need to subsume the constant into the node
3899 // at operand position, oper_input_base().
3900 //
3901 // Fill in the constant
|