< prev index next >

src/share/vm/adlc/archDesc.cpp

Print this page




 133 
 134 void MatchList::output(FILE *fp) {
 135   fprintf(fp, "\nMatchList output is Unimplemented();\n");
 136 }
 137 
 138 
 139 //---------------------------ArchDesc Constructor and Destructor-------------
 140 
 141 ArchDesc::ArchDesc()
 142   : _globalNames(cmpstr,hashstr, Form::arena),
 143     _globalDefs(cmpstr,hashstr, Form::arena),
 144     _preproc_table(cmpstr,hashstr, Form::arena),
 145     _idealIndex(cmpstr,hashstr, Form::arena),
 146     _internalOps(cmpstr,hashstr, Form::arena),
 147     _internalMatch(cmpstr,hashstr, Form::arena),
 148     _chainRules(cmpstr,hashstr, Form::arena),
 149     _cisc_spill_operand(NULL),
 150     _needs_clone_jvms(false) {
 151 
 152       // Initialize the opcode to MatchList table with NULLs
 153       for( int i=0; i<_last_opcode; ++i ) {
 154         _mlistab[i] = NULL;
 155       }
 156 
 157       // Set-up the global tables
 158       initKeywords(_globalNames);    // Initialize the Name Table with keywords
 159 
 160       // Prime user-defined types with predefined types: Set, RegI, RegF, ...
 161       initBaseOpTypes();
 162 
 163       // Initialize flags & counters
 164       _TotalLines        = 0;
 165       _no_output         = 0;
 166       _quiet_mode        = 0;
 167       _disable_warnings  = 0;
 168       _dfa_debug         = 0;
 169       _dfa_small         = 0;
 170       _adl_debug         = 0;
 171       _adlocation_debug  = 0;
 172       _internalOpCounter = 0;
 173       _cisc_spill_debug  = false;
 174       _short_branch_debug = false;
 175 
 176       // Initialize match rule flags
 177       for (int i = 0; i < _last_opcode; i++) {
 178         _has_match_rule[i] = false;
 179       }
 180 
 181       // Error/Warning Counts
 182       _syntax_errs       = 0;
 183       _semantic_errs     = 0;
 184       _warnings          = 0;
 185       _internal_errs     = 0;
 186 
 187       // Initialize I/O Files
 188       _ADL_file._name = NULL; _ADL_file._fp = NULL;
 189       // Machine dependent output files
 190       _DFA_file._name    = NULL;  _DFA_file._fp = NULL;
 191       _HPP_file._name    = NULL;  _HPP_file._fp = NULL;
 192       _CPP_file._name    = NULL;  _CPP_file._fp = NULL;
 193       _bug_file._name    = "bugs.out";      _bug_file._fp = NULL;
 194 
 195       // Initialize Register & Pipeline Form Pointers
 196       _register = NULL;
 197       _encode = NULL;


 456     } while(rule->_next != NULL);
 457   }
 458 
 459 }
 460 
 461 //------------------------------buildMatchList---------------------------------
 462 // operands and instructions provide the result
 463 void ArchDesc::buildMatchList(MatchRule *mrule, const char *resultStr,
 464                               const char *rootOp, Predicate *pred,
 465                               const char *cost) {
 466   const char *leftstr, *rightstr;
 467   MatchNode  *mnode;
 468 
 469   leftstr = rightstr = NULL;
 470   // Check for chain rule, and do not generate a match list for it
 471   if ( mrule->is_chain_rule(_globalNames) ) {
 472     return;
 473   }
 474 
 475   // Identify index position among ideal operands
 476   intptr_t    index     = _last_opcode;
 477   const char  *indexStr  = getMatchListIndex(*mrule);
 478   index  = (intptr_t)_idealIndex[indexStr];
 479   if (index == 0) {
 480     fprintf(stderr, "Ideal node missing: %s\n", indexStr);
 481     assert(index != 0, "Failed lookup of ideal node\n");
 482   }
 483 
 484   // Check that this will be placed appropriately in the DFA
 485   if (index >= _last_opcode) {
 486     fprintf(stderr, "Invalid match rule %s <-- ( %s )\n",
 487             resultStr ? resultStr : " ",
 488             rootOp    ? rootOp    : " ");
 489     assert(index < _last_opcode, "Matching item not in ideal graph\n");

 490     return;
 491   }
 492 
 493 
 494   // Walk the MatchRule, generating MatchList entries for each level
 495   // of the rule (each nesting of parentheses)
 496   // Check for "Set"
 497   if (!strcmp(mrule->_opType, "Set")) {
 498     mnode = mrule->_rChild;
 499     buildMList(mnode, rootOp, resultStr, pred, cost);
 500     return;
 501   }
 502   // Build MatchLists for children
 503   // Check each child for an internal operand name, and use that name
 504   // for the parent's matchlist entry if it exists
 505   mnode = mrule->_lChild;
 506   if (mnode) {
 507     buildMList(mnode, NULL, NULL, NULL, NULL);
 508     leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
 509   }


 526 
 527 // Recursive call for construction of match lists
 528 void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
 529                           const char *resultOp, Predicate *pred,
 530                           const char *cost) {
 531   const char *leftstr, *rightstr;
 532   const char *resultop;
 533   const char *opcode;
 534   MatchNode  *mnode;
 535   Form       *form;
 536 
 537   leftstr = rightstr = NULL;
 538   // Do not process leaves of the Match Tree if they are not ideal
 539   if ((node) && (node->_lChild == NULL) && (node->_rChild == NULL) &&
 540       ((form = (Form *)_globalNames[node->_opType]) != NULL) &&
 541       (!form->ideal_only())) {
 542     return;
 543   }
 544 
 545   // Identify index position among ideal operands
 546   intptr_t    index     = _last_opcode;
 547   const char *indexStr  = node ? node->_opType : (char *) " ";
 548   index            = (intptr_t)_idealIndex[indexStr];
 549   if (index == 0) {
 550     fprintf(stderr, "error: operand \"%s\" not found\n", indexStr);
 551     assert(0, "fatal error");
 552   }
 553 
 554   // Build MatchLists for children
 555   // Check each child for an internal operand name, and use that name
 556   // for the parent's matchlist entry if it exists
 557   mnode = node->_lChild;
 558   if (mnode) {
 559     buildMList(mnode, NULL, NULL, NULL, NULL);
 560     leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
 561   }
 562   mnode = node->_rChild;
 563   if (mnode) {
 564     buildMList(mnode, NULL, NULL, NULL, NULL);
 565     rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
 566   }


 952   }
 953 
 954   return NULL;
 955 }
 956 
 957 
 958 
 959 OperandForm *ArchDesc::constructOperand(const char *ident,
 960                                         bool  ideal_only) {
 961   OperandForm *opForm = new OperandForm(ident, ideal_only);
 962   _globalNames.Insert(ident, opForm);
 963   addForm(opForm);
 964 
 965   return opForm;
 966 }
 967 
 968 
 969 // Import predefined base types: Set = 1, RegI, RegP, ...
 970 void ArchDesc::initBaseOpTypes() {
 971   // Create OperandForm and assign type for each opcode.
 972   for (int i = 1; i < _last_machine_leaf; ++i) {
 973     char *ident = (char *)NodeClassNames[i];
 974     constructOperand(ident, true);
 975   }
 976   // Create InstructForm and assign type for each ideal instruction.
 977   for (int j = _last_machine_leaf+1; j < _last_opcode; ++j) {

 978     char *ident = (char *)NodeClassNames[j];
 979     if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
 980         !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
 981         !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
 982         !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
 983         !strcmp(ident, "Bool")) {
 984       constructOperand(ident, true);
 985     } else {
 986       InstructForm *insForm = new InstructForm(ident, true);
 987       // insForm->_opcode = nextUserOpType(ident);
 988       _globalNames.Insert(ident, insForm);
 989       addForm(insForm);
 990     }
 991   }
 992 
 993   { OperandForm *opForm;
 994   // Create operand type "Universe" for return instructions.
 995   const char *ident = "Universe";
 996   opForm = constructOperand(ident, false);
 997 


1031     _globalNames.Insert(ident, eForm);
1032     ident = "KILL";
1033     eForm = new Effect(ident);
1034     _globalNames.Insert(ident, eForm);
1035     ident = "USE_KILL";
1036     eForm = new Effect(ident);
1037     _globalNames.Insert(ident, eForm);
1038     ident = "TEMP";
1039     eForm = new Effect(ident);
1040     _globalNames.Insert(ident, eForm);
1041     ident = "TEMP_DEF";
1042     eForm = new Effect(ident);
1043     _globalNames.Insert(ident, eForm);
1044     ident = "CALL";
1045     eForm = new Effect(ident);
1046     _globalNames.Insert(ident, eForm);
1047   }
1048 
1049   //
1050   // Build mapping from ideal names to ideal indices
1051   int idealIndex = 0;
1052   for (idealIndex = 1; idealIndex < _last_machine_leaf; ++idealIndex) {


1053     const char *idealName = NodeClassNames[idealIndex];
1054     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
1055   }
1056   for (idealIndex = _last_machine_leaf+1;
1057        idealIndex < _last_opcode; ++idealIndex) {
1058     const char *idealName = NodeClassNames[idealIndex];
1059     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
1060   }
1061 
1062 }
1063 
1064 
1065 //---------------------------addSUNcopyright-------------------------------
1066 // output SUN copyright info
1067 void ArchDesc::addSunCopyright(char* legal, int size, FILE *fp) {
1068   size_t count = fwrite(legal, 1, size, fp);
1069   assert(count == (size_t) size, "copyright info truncated");
1070   fprintf(fp,"\n");
1071   fprintf(fp,"// Machine Generated File.  Do Not Edit!\n");
1072   fprintf(fp,"\n");
1073 }
1074 
1075 
1076 //---------------------------addIncludeGuardStart--------------------------
1077 // output the start of an include guard.


1138 }
1139 
1140 // Convert operand name into enum name
1141 const char *ArchDesc::getMachOperEnum(const char *opName) {
1142   return (opName ? toUpper(opName) : opName);
1143 }
1144 
1145 //---------------------------buildMustCloneMap-----------------------------
1146 // Flag cases when machine needs cloned values or instructions
1147 void ArchDesc::buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp) {
1148   // Build external declarations for mappings
1149   fprintf(fp_hpp, "// Mapping from machine-independent opcode to boolean\n");
1150   fprintf(fp_hpp, "// Flag cases where machine needs cloned values or instructions\n");
1151   fprintf(fp_hpp, "extern const char must_clone[];\n");
1152   fprintf(fp_hpp, "\n");
1153 
1154   // Build mapping from ideal names to ideal indices
1155   fprintf(fp_cpp, "\n");
1156   fprintf(fp_cpp, "// Mapping from machine-independent opcode to boolean\n");
1157   fprintf(fp_cpp, "const        char must_clone[] = {\n");
1158   for (int idealIndex = 0; idealIndex < _last_opcode; ++idealIndex) {

1159     int         must_clone = 0;
1160     const char *idealName = NodeClassNames[idealIndex];
1161     // Previously selected constants for cloning
1162     // !!!!!
1163     // These are the current machine-dependent clones
1164     if ( strcmp(idealName,"CmpI") == 0
1165          || strcmp(idealName,"CmpU") == 0
1166          || strcmp(idealName,"CmpP") == 0
1167          || strcmp(idealName,"CmpN") == 0
1168          || strcmp(idealName,"CmpL") == 0
1169          || strcmp(idealName,"CmpD") == 0
1170          || strcmp(idealName,"CmpF") == 0
1171          || strcmp(idealName,"FastLock") == 0
1172          || strcmp(idealName,"FastUnlock") == 0
1173          || strcmp(idealName,"OverflowAddI") == 0
1174          || strcmp(idealName,"OverflowAddL") == 0
1175          || strcmp(idealName,"OverflowSubI") == 0
1176          || strcmp(idealName,"OverflowSubL") == 0
1177          || strcmp(idealName,"OverflowMulI") == 0
1178          || strcmp(idealName,"OverflowMulL") == 0
1179          || strcmp(idealName,"Bool") == 0
1180          || strcmp(idealName,"Binary") == 0 ) {
1181       // Removed ConI from the must_clone list.  CPUs that cannot use
1182       // large constants as immediates manifest the constant as an
1183       // instruction.  The must_clone flag prevents the constant from
1184       // floating up out of loops.
1185       must_clone = 1;
1186     }
1187     fprintf(fp_cpp, "  %d%s // %s: %d\n", must_clone,
1188       (idealIndex != (_last_opcode - 1)) ? "," : " // no trailing comma",
1189       idealName, idealIndex);
1190   }
1191   // Finish defining table
1192   fprintf(fp_cpp, "};\n");
1193 }


 133 
 134 void MatchList::output(FILE *fp) {
 135   fprintf(fp, "\nMatchList output is Unimplemented();\n");
 136 }
 137 
 138 
 139 //---------------------------ArchDesc Constructor and Destructor-------------
 140 
 141 ArchDesc::ArchDesc()
 142   : _globalNames(cmpstr,hashstr, Form::arena),
 143     _globalDefs(cmpstr,hashstr, Form::arena),
 144     _preproc_table(cmpstr,hashstr, Form::arena),
 145     _idealIndex(cmpstr,hashstr, Form::arena),
 146     _internalOps(cmpstr,hashstr, Form::arena),
 147     _internalMatch(cmpstr,hashstr, Form::arena),
 148     _chainRules(cmpstr,hashstr, Form::arena),
 149     _cisc_spill_operand(NULL),
 150     _needs_clone_jvms(false) {
 151 
 152       // Initialize the opcode to MatchList table with NULLs
 153       for(uint i = 0; i < static_cast<uint>(Opcodes::_last_opcode); ++i ) {
 154         _mlistab[i] = NULL;
 155       }
 156 
 157       // Set-up the global tables
 158       initKeywords(_globalNames);    // Initialize the Name Table with keywords
 159 
 160       // Prime user-defined types with predefined types: Set, RegI, RegF, ...
 161       initBaseOpTypes();
 162 
 163       // Initialize flags & counters
 164       _TotalLines        = 0;
 165       _no_output         = 0;
 166       _quiet_mode        = 0;
 167       _disable_warnings  = 0;
 168       _dfa_debug         = 0;
 169       _dfa_small         = 0;
 170       _adl_debug         = 0;
 171       _adlocation_debug  = 0;
 172       _internalOpCounter = 0;
 173       _cisc_spill_debug  = false;
 174       _short_branch_debug = false;
 175 
 176       // Initialize match rule flags
 177       for (uint i = 0; i < static_cast<uint>(Opcodes::_last_opcode); i++) {
 178         _has_match_rule[i] = false;
 179       }
 180 
 181       // Error/Warning Counts
 182       _syntax_errs       = 0;
 183       _semantic_errs     = 0;
 184       _warnings          = 0;
 185       _internal_errs     = 0;
 186 
 187       // Initialize I/O Files
 188       _ADL_file._name = NULL; _ADL_file._fp = NULL;
 189       // Machine dependent output files
 190       _DFA_file._name    = NULL;  _DFA_file._fp = NULL;
 191       _HPP_file._name    = NULL;  _HPP_file._fp = NULL;
 192       _CPP_file._name    = NULL;  _CPP_file._fp = NULL;
 193       _bug_file._name    = "bugs.out";      _bug_file._fp = NULL;
 194 
 195       // Initialize Register & Pipeline Form Pointers
 196       _register = NULL;
 197       _encode = NULL;


 456     } while(rule->_next != NULL);
 457   }
 458 
 459 }
 460 
 461 //------------------------------buildMatchList---------------------------------
 462 // operands and instructions provide the result
 463 void ArchDesc::buildMatchList(MatchRule *mrule, const char *resultStr,
 464                               const char *rootOp, Predicate *pred,
 465                               const char *cost) {
 466   const char *leftstr, *rightstr;
 467   MatchNode  *mnode;
 468 
 469   leftstr = rightstr = NULL;
 470   // Check for chain rule, and do not generate a match list for it
 471   if ( mrule->is_chain_rule(_globalNames) ) {
 472     return;
 473   }
 474 
 475   // Identify index position among ideal operands
 476   intptr_t    index     = static_cast<intptr_t>(Opcodes::_last_opcode);
 477   const char  *indexStr  = getMatchListIndex(*mrule);
 478   index  = (intptr_t)_idealIndex[indexStr];
 479   if (index == 0) {
 480     fprintf(stderr, "Ideal node missing: %s\n", indexStr);
 481     assert(index != 0, "Failed lookup of ideal node\n");
 482   }
 483 
 484   // Check that this will be placed appropriately in the DFA
 485   if (index >= static_cast<intptr_t>(Opcodes::_last_opcode)) {
 486     fprintf(stderr, "Invalid match rule %s <-- ( %s )\n",
 487             resultStr ? resultStr : " ",
 488             rootOp    ? rootOp    : " ");
 489     assert(index < static_cast<intptr_t>(Opcodes::_last_opcode),
 490                                         "Matching item not in ideal graph\n");
 491     return;
 492   }
 493 
 494 
 495   // Walk the MatchRule, generating MatchList entries for each level
 496   // of the rule (each nesting of parentheses)
 497   // Check for "Set"
 498   if (!strcmp(mrule->_opType, "Set")) {
 499     mnode = mrule->_rChild;
 500     buildMList(mnode, rootOp, resultStr, pred, cost);
 501     return;
 502   }
 503   // Build MatchLists for children
 504   // Check each child for an internal operand name, and use that name
 505   // for the parent's matchlist entry if it exists
 506   mnode = mrule->_lChild;
 507   if (mnode) {
 508     buildMList(mnode, NULL, NULL, NULL, NULL);
 509     leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
 510   }


 527 
 528 // Recursive call for construction of match lists
 529 void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
 530                           const char *resultOp, Predicate *pred,
 531                           const char *cost) {
 532   const char *leftstr, *rightstr;
 533   const char *resultop;
 534   const char *opcode;
 535   MatchNode  *mnode;
 536   Form       *form;
 537 
 538   leftstr = rightstr = NULL;
 539   // Do not process leaves of the Match Tree if they are not ideal
 540   if ((node) && (node->_lChild == NULL) && (node->_rChild == NULL) &&
 541       ((form = (Form *)_globalNames[node->_opType]) != NULL) &&
 542       (!form->ideal_only())) {
 543     return;
 544   }
 545 
 546   // Identify index position among ideal operands
 547   intptr_t    index     = static_cast<intptr_t>(Opcodes::_last_opcode);
 548   const char *indexStr  = node ? node->_opType : (char *) " ";
 549   index            = (intptr_t)_idealIndex[indexStr];
 550   if (index == 0) {
 551     fprintf(stderr, "error: operand \"%s\" not found\n", indexStr);
 552     assert(0, "fatal error");
 553   }
 554 
 555   // Build MatchLists for children
 556   // Check each child for an internal operand name, and use that name
 557   // for the parent's matchlist entry if it exists
 558   mnode = node->_lChild;
 559   if (mnode) {
 560     buildMList(mnode, NULL, NULL, NULL, NULL);
 561     leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
 562   }
 563   mnode = node->_rChild;
 564   if (mnode) {
 565     buildMList(mnode, NULL, NULL, NULL, NULL);
 566     rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
 567   }


 953   }
 954 
 955   return NULL;
 956 }
 957 
 958 
 959 
 960 OperandForm *ArchDesc::constructOperand(const char *ident,
 961                                         bool  ideal_only) {
 962   OperandForm *opForm = new OperandForm(ident, ideal_only);
 963   _globalNames.Insert(ident, opForm);
 964   addForm(opForm);
 965 
 966   return opForm;
 967 }
 968 
 969 
 970 // Import predefined base types: Set = 1, RegI, RegP, ...
 971 void ArchDesc::initBaseOpTypes() {
 972   // Create OperandForm and assign type for each opcode.
 973   for (uint i = 1; i < static_cast<uint>(Opcodes::_last_machine_leaf); ++i) {
 974     char *ident = (char *)NodeClassNames[i];
 975     constructOperand(ident, true);
 976   }
 977   // Create InstructForm and assign type for each ideal instruction.
 978   for (uint j = static_cast<uint>(Opcodes::_last_machine_leaf) + 1;
 979                            j < static_cast<uint>(Opcodes::_last_opcode); ++j) {
 980     char *ident = (char *)NodeClassNames[j];
 981     if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
 982         !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
 983         !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
 984         !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
 985         !strcmp(ident, "Bool")) {
 986       constructOperand(ident, true);
 987     } else {
 988       InstructForm *insForm = new InstructForm(ident, true);
 989       // insForm->_opcode = nextUserOpType(ident);
 990       _globalNames.Insert(ident, insForm);
 991       addForm(insForm);
 992     }
 993   }
 994 
 995   { OperandForm *opForm;
 996   // Create operand type "Universe" for return instructions.
 997   const char *ident = "Universe";
 998   opForm = constructOperand(ident, false);
 999 


1033     _globalNames.Insert(ident, eForm);
1034     ident = "KILL";
1035     eForm = new Effect(ident);
1036     _globalNames.Insert(ident, eForm);
1037     ident = "USE_KILL";
1038     eForm = new Effect(ident);
1039     _globalNames.Insert(ident, eForm);
1040     ident = "TEMP";
1041     eForm = new Effect(ident);
1042     _globalNames.Insert(ident, eForm);
1043     ident = "TEMP_DEF";
1044     eForm = new Effect(ident);
1045     _globalNames.Insert(ident, eForm);
1046     ident = "CALL";
1047     eForm = new Effect(ident);
1048     _globalNames.Insert(ident, eForm);
1049   }
1050 
1051   //
1052   // Build mapping from ideal names to ideal indices
1053   uint idealIndex = 0;
1054   for (idealIndex = 1;
1055        idealIndex < static_cast<uint>(Opcodes::_last_machine_leaf);
1056        ++idealIndex) {
1057     const char *idealName = NodeClassNames[idealIndex];
1058     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
1059   }
1060   for (idealIndex = static_cast<uint>(Opcodes::_last_machine_leaf) + 1;
1061        idealIndex < static_cast<uint>(Opcodes::_last_opcode); ++idealIndex) {
1062     const char *idealName = NodeClassNames[idealIndex];
1063     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
1064   }
1065 
1066 }
1067 
1068 
1069 //---------------------------addSUNcopyright-------------------------------
1070 // output SUN copyright info
1071 void ArchDesc::addSunCopyright(char* legal, int size, FILE *fp) {
1072   size_t count = fwrite(legal, 1, size, fp);
1073   assert(count == (size_t) size, "copyright info truncated");
1074   fprintf(fp,"\n");
1075   fprintf(fp,"// Machine Generated File.  Do Not Edit!\n");
1076   fprintf(fp,"\n");
1077 }
1078 
1079 
1080 //---------------------------addIncludeGuardStart--------------------------
1081 // output the start of an include guard.


1142 }
1143 
1144 // Convert operand name into enum name
1145 const char *ArchDesc::getMachOperEnum(const char *opName) {
1146   return (opName ? toUpper(opName) : opName);
1147 }
1148 
1149 //---------------------------buildMustCloneMap-----------------------------
1150 // Flag cases when machine needs cloned values or instructions
1151 void ArchDesc::buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp) {
1152   // Build external declarations for mappings
1153   fprintf(fp_hpp, "// Mapping from machine-independent opcode to boolean\n");
1154   fprintf(fp_hpp, "// Flag cases where machine needs cloned values or instructions\n");
1155   fprintf(fp_hpp, "extern const char must_clone[];\n");
1156   fprintf(fp_hpp, "\n");
1157 
1158   // Build mapping from ideal names to ideal indices
1159   fprintf(fp_cpp, "\n");
1160   fprintf(fp_cpp, "// Mapping from machine-independent opcode to boolean\n");
1161   fprintf(fp_cpp, "const        char must_clone[] = {\n");
1162   for (uint idealIndex = 0;
1163          idealIndex < static_cast<uint>(Opcodes::_last_opcode); ++idealIndex) {
1164     int         must_clone = 0;
1165     const char *idealName = NodeClassNames[idealIndex];
1166     // Previously selected constants for cloning
1167     // !!!!!
1168     // These are the current machine-dependent clones
1169     if ( strcmp(idealName,"CmpI") == 0
1170          || strcmp(idealName,"CmpU") == 0
1171          || strcmp(idealName,"CmpP") == 0
1172          || strcmp(idealName,"CmpN") == 0
1173          || strcmp(idealName,"CmpL") == 0
1174          || strcmp(idealName,"CmpD") == 0
1175          || strcmp(idealName,"CmpF") == 0
1176          || strcmp(idealName,"FastLock") == 0
1177          || strcmp(idealName,"FastUnlock") == 0
1178          || strcmp(idealName,"OverflowAddI") == 0
1179          || strcmp(idealName,"OverflowAddL") == 0
1180          || strcmp(idealName,"OverflowSubI") == 0
1181          || strcmp(idealName,"OverflowSubL") == 0
1182          || strcmp(idealName,"OverflowMulI") == 0
1183          || strcmp(idealName,"OverflowMulL") == 0
1184          || strcmp(idealName,"Bool") == 0
1185          || strcmp(idealName,"Binary") == 0 ) {
1186       // Removed ConI from the must_clone list.  CPUs that cannot use
1187       // large constants as immediates manifest the constant as an
1188       // instruction.  The must_clone flag prevents the constant from
1189       // floating up out of loops.
1190       must_clone = 1;
1191     }
1192     fprintf(fp_cpp, "  %d%s // %s: %d\n", must_clone,
1193       (idealIndex != (static_cast<uint>(Opcodes::_last_opcode) - 1)) ? "," : " // no trailing comma",
1194       idealName, idealIndex);
1195   }
1196   // Finish defining table
1197   fprintf(fp_cpp, "};\n");
1198 }
< prev index next >