IntrinsicEmitter.cpp (193323) | IntrinsicEmitter.cpp (195340) |
---|---|
1//===- IntrinsicEmitter.cpp - Generate intrinsic information --------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 8 unchanged lines hidden (view full) --- 17#include "llvm/ADT/StringExtras.h" 18#include <algorithm> 19using namespace llvm; 20 21//===----------------------------------------------------------------------===// 22// IntrinsicEmitter Implementation 23//===----------------------------------------------------------------------===// 24 | 1//===- IntrinsicEmitter.cpp - Generate intrinsic information --------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 8 unchanged lines hidden (view full) --- 17#include "llvm/ADT/StringExtras.h" 18#include <algorithm> 19using namespace llvm; 20 21//===----------------------------------------------------------------------===// 22// IntrinsicEmitter Implementation 23//===----------------------------------------------------------------------===// 24 |
25void IntrinsicEmitter::run(std::ostream &OS) { | 25void IntrinsicEmitter::run(raw_ostream &OS) { |
26 EmitSourceFileHeader("Intrinsic Function Source Fragment", OS); 27 28 std::vector<CodeGenIntrinsic> Ints = LoadIntrinsics(Records, TargetOnly); 29 30 if (TargetOnly && !Ints.empty()) 31 TargetPrefix = Ints[0].TargetPrefix; 32 33 // Emit the enum information. --- 23 unchanged lines hidden (view full) --- 57 // Emit a list of intrinsics with corresponding GCC builtins. 58 EmitGCCBuiltinList(Ints, OS); 59 60 // Emit code to translate GCC builtins into LLVM intrinsics. 61 EmitIntrinsicToGCCBuiltinMap(Ints, OS); 62} 63 64void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, | 26 EmitSourceFileHeader("Intrinsic Function Source Fragment", OS); 27 28 std::vector<CodeGenIntrinsic> Ints = LoadIntrinsics(Records, TargetOnly); 29 30 if (TargetOnly && !Ints.empty()) 31 TargetPrefix = Ints[0].TargetPrefix; 32 33 // Emit the enum information. --- 23 unchanged lines hidden (view full) --- 57 // Emit a list of intrinsics with corresponding GCC builtins. 58 EmitGCCBuiltinList(Ints, OS); 59 60 // Emit code to translate GCC builtins into LLVM intrinsics. 61 EmitIntrinsicToGCCBuiltinMap(Ints, OS); 62} 63 64void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, |
65 std::ostream &OS) { | 65 raw_ostream &OS) { |
66 OS << "// Enum values for Intrinsics.h\n"; 67 OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n"; 68 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 69 OS << " " << Ints[i].EnumName; 70 OS << ((i != e-1) ? ", " : " "); 71 OS << std::string(40-Ints[i].EnumName.size(), ' ') 72 << "// " << Ints[i].Name << "\n"; 73 } 74 OS << "#endif\n\n"; 75} 76 77void IntrinsicEmitter:: 78EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, | 66 OS << "// Enum values for Intrinsics.h\n"; 67 OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n"; 68 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 69 OS << " " << Ints[i].EnumName; 70 OS << ((i != e-1) ? ", " : " "); 71 OS << std::string(40-Ints[i].EnumName.size(), ' ') 72 << "// " << Ints[i].Name << "\n"; 73 } 74 OS << "#endif\n\n"; 75} 76 77void IntrinsicEmitter:: 78EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, |
79 std::ostream &OS) { | 79 raw_ostream &OS) { |
80 // Build a function name -> intrinsic name mapping. 81 std::map<std::string, unsigned> IntMapping; 82 for (unsigned i = 0, e = Ints.size(); i != e; ++i) 83 IntMapping[Ints[i].Name] = i; 84 85 OS << "// Function name -> enum value recognizer code.\n"; 86 OS << "#ifdef GET_FUNCTION_RECOGNIZER\n"; 87 OS << " switch (Name[5]) {\n"; --- 21 unchanged lines hidden (view full) --- 109 << Ints[I->second].EnumName << ";\n"; 110 } 111 OS << " }\n"; 112 OS << "#endif\n\n"; 113} 114 115void IntrinsicEmitter:: 116EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, | 80 // Build a function name -> intrinsic name mapping. 81 std::map<std::string, unsigned> IntMapping; 82 for (unsigned i = 0, e = Ints.size(); i != e; ++i) 83 IntMapping[Ints[i].Name] = i; 84 85 OS << "// Function name -> enum value recognizer code.\n"; 86 OS << "#ifdef GET_FUNCTION_RECOGNIZER\n"; 87 OS << " switch (Name[5]) {\n"; --- 21 unchanged lines hidden (view full) --- 109 << Ints[I->second].EnumName << ";\n"; 110 } 111 OS << " }\n"; 112 OS << "#endif\n\n"; 113} 114 115void IntrinsicEmitter:: 116EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, |
117 std::ostream &OS) { | 117 raw_ostream &OS) { |
118 OS << "// Intrinsic ID to name table\n"; 119 OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n"; 120 OS << " // Note that entry #0 is the invalid intrinsic!\n"; 121 for (unsigned i = 0, e = Ints.size(); i != e; ++i) 122 OS << " \"" << Ints[i].Name << "\",\n"; 123 OS << "#endif\n\n"; 124} 125 126void IntrinsicEmitter:: 127EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints, | 118 OS << "// Intrinsic ID to name table\n"; 119 OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n"; 120 OS << " // Note that entry #0 is the invalid intrinsic!\n"; 121 for (unsigned i = 0, e = Ints.size(); i != e; ++i) 122 OS << " \"" << Ints[i].Name << "\",\n"; 123 OS << "#endif\n\n"; 124} 125 126void IntrinsicEmitter:: 127EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints, |
128 std::ostream &OS) { | 128 raw_ostream &OS) { |
129 OS << "// Intrinsic ID to overload table\n"; 130 OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; 131 OS << " // Note that entry #0 is the invalid intrinsic!\n"; 132 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 133 OS << " "; 134 if (Ints[i].isOverloaded) 135 OS << "true"; 136 else 137 OS << "false"; 138 OS << ",\n"; 139 } 140 OS << "#endif\n\n"; 141} 142 | 129 OS << "// Intrinsic ID to overload table\n"; 130 OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; 131 OS << " // Note that entry #0 is the invalid intrinsic!\n"; 132 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 133 OS << " "; 134 if (Ints[i].isOverloaded) 135 OS << "true"; 136 else 137 OS << "false"; 138 OS << ",\n"; 139 } 140 OS << "#endif\n\n"; 141} 142 |
143static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) { | 143static void EmitTypeForValueType(raw_ostream &OS, MVT::SimpleValueType VT) { |
144 if (MVT(VT).isInteger()) { 145 unsigned BitWidth = MVT(VT).getSizeInBits(); 146 OS << "IntegerType::get(" << BitWidth << ")"; 147 } else if (VT == MVT::Other) { 148 // MVT::OtherVT is used to mean the empty struct type here. | 144 if (MVT(VT).isInteger()) { 145 unsigned BitWidth = MVT(VT).getSizeInBits(); 146 OS << "IntegerType::get(" << BitWidth << ")"; 147 } else if (VT == MVT::Other) { 148 // MVT::OtherVT is used to mean the empty struct type here. |
149 OS << "StructType::get(std::vector<const Type *>())"; | 149 OS << "StructType::get()"; |
150 } else if (VT == MVT::f32) { 151 OS << "Type::FloatTy"; 152 } else if (VT == MVT::f64) { 153 OS << "Type::DoubleTy"; 154 } else if (VT == MVT::f80) { 155 OS << "Type::X86_FP80Ty"; 156 } else if (VT == MVT::f128) { 157 OS << "Type::FP128Ty"; 158 } else if (VT == MVT::ppcf128) { 159 OS << "Type::PPC_FP128Ty"; 160 } else if (VT == MVT::isVoid) { 161 OS << "Type::VoidTy"; 162 } else { 163 assert(false && "Unsupported ValueType!"); 164 } 165} 166 | 150 } else if (VT == MVT::f32) { 151 OS << "Type::FloatTy"; 152 } else if (VT == MVT::f64) { 153 OS << "Type::DoubleTy"; 154 } else if (VT == MVT::f80) { 155 OS << "Type::X86_FP80Ty"; 156 } else if (VT == MVT::f128) { 157 OS << "Type::FP128Ty"; 158 } else if (VT == MVT::ppcf128) { 159 OS << "Type::PPC_FP128Ty"; 160 } else if (VT == MVT::isVoid) { 161 OS << "Type::VoidTy"; 162 } else { 163 assert(false && "Unsupported ValueType!"); 164 } 165} 166 |
167static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType, | 167static void EmitTypeGenerate(raw_ostream &OS, const Record *ArgType, |
168 unsigned &ArgNo); 169 | 168 unsigned &ArgNo); 169 |
170static void EmitTypeGenerate(std::ostream &OS, | 170static void EmitTypeGenerate(raw_ostream &OS, |
171 const std::vector<Record*> &ArgTypes, 172 unsigned &ArgNo) { 173 if (ArgTypes.size() == 1) { 174 EmitTypeGenerate(OS, ArgTypes.front(), ArgNo); 175 return; 176 } 177 178 OS << "StructType::get("; 179 180 for (std::vector<Record*>::const_iterator 181 I = ArgTypes.begin(), E = ArgTypes.end(); I != E; ++I) { 182 EmitTypeGenerate(OS, *I, ArgNo); 183 OS << ", "; 184 } 185 186 OS << " NULL)"; 187} 188 | 171 const std::vector<Record*> &ArgTypes, 172 unsigned &ArgNo) { 173 if (ArgTypes.size() == 1) { 174 EmitTypeGenerate(OS, ArgTypes.front(), ArgNo); 175 return; 176 } 177 178 OS << "StructType::get("; 179 180 for (std::vector<Record*>::const_iterator 181 I = ArgTypes.begin(), E = ArgTypes.end(); I != E; ++I) { 182 EmitTypeGenerate(OS, *I, ArgNo); 183 OS << ", "; 184 } 185 186 OS << " NULL)"; 187} 188 |
189static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType, | 189static void EmitTypeGenerate(raw_ostream &OS, const Record *ArgType, |
190 unsigned &ArgNo) { 191 MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT")); 192 193 if (ArgType->isSubClassOf("LLVMMatchType")) { 194 unsigned Number = ArgType->getValueAsInt("Number"); 195 assert(Number < ArgNo && "Invalid matching number!"); 196 if (ArgType->isSubClassOf("LLVMExtendedElementVectorType")) 197 OS << "VectorType::getExtendedElementVectorType" --- 72 unchanged lines hidden (view full) --- 270 } 271 272 return i != RHSSize; 273 } 274 }; 275} 276 277void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints, | 190 unsigned &ArgNo) { 191 MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT")); 192 193 if (ArgType->isSubClassOf("LLVMMatchType")) { 194 unsigned Number = ArgType->getValueAsInt("Number"); 195 assert(Number < ArgNo && "Invalid matching number!"); 196 if (ArgType->isSubClassOf("LLVMExtendedElementVectorType")) 197 OS << "VectorType::getExtendedElementVectorType" --- 72 unchanged lines hidden (view full) --- 270 } 271 272 return i != RHSSize; 273 } 274 }; 275} 276 277void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints, |
278 std::ostream &OS) { | 278 raw_ostream &OS) { |
279 OS << "// Verifier::visitIntrinsicFunctionCall code.\n"; 280 OS << "#ifdef GET_INTRINSIC_VERIFIER\n"; 281 OS << " switch (ID) {\n"; 282 OS << " default: assert(0 && \"Invalid intrinsic!\");\n"; 283 284 // This checking can emit a lot of very common code. To reduce the amount of 285 // code that we emit, batch up cases that have identical types. This avoids 286 // problems where GCC can run out of memory compiling Verifier.cpp. --- 66 unchanged lines hidden (view full) --- 353 OS << ");\n"; 354 OS << " break;\n"; 355 } 356 OS << " }\n"; 357 OS << "#endif\n\n"; 358} 359 360void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints, | 279 OS << "// Verifier::visitIntrinsicFunctionCall code.\n"; 280 OS << "#ifdef GET_INTRINSIC_VERIFIER\n"; 281 OS << " switch (ID) {\n"; 282 OS << " default: assert(0 && \"Invalid intrinsic!\");\n"; 283 284 // This checking can emit a lot of very common code. To reduce the amount of 285 // code that we emit, batch up cases that have identical types. This avoids 286 // problems where GCC can run out of memory compiling Verifier.cpp. --- 66 unchanged lines hidden (view full) --- 353 OS << ");\n"; 354 OS << " break;\n"; 355 } 356 OS << " }\n"; 357 OS << "#endif\n\n"; 358} 359 360void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints, |
361 std::ostream &OS) { | 361 raw_ostream &OS) { |
362 OS << "// Code for generating Intrinsic function declarations.\n"; 363 OS << "#ifdef GET_INTRINSIC_GENERATOR\n"; 364 OS << " switch (id) {\n"; 365 OS << " default: assert(0 && \"Invalid intrinsic!\");\n"; 366 367 // Similar to GET_INTRINSIC_VERIFIER, batch up cases that have identical 368 // types. 369 typedef std::map<RecPair, std::vector<unsigned>, RecordListComparator> MapTy; --- 40 unchanged lines hidden (view full) --- 410 } 411 412 OS << " }\n"; 413 OS << "#endif\n\n"; 414} 415 416/// EmitAttributes - This emits the Intrinsic::getAttributes method. 417void IntrinsicEmitter:: | 362 OS << "// Code for generating Intrinsic function declarations.\n"; 363 OS << "#ifdef GET_INTRINSIC_GENERATOR\n"; 364 OS << " switch (id) {\n"; 365 OS << " default: assert(0 && \"Invalid intrinsic!\");\n"; 366 367 // Similar to GET_INTRINSIC_VERIFIER, batch up cases that have identical 368 // types. 369 typedef std::map<RecPair, std::vector<unsigned>, RecordListComparator> MapTy; --- 40 unchanged lines hidden (view full) --- 410 } 411 412 OS << " }\n"; 413 OS << "#endif\n\n"; 414} 415 416/// EmitAttributes - This emits the Intrinsic::getAttributes method. 417void IntrinsicEmitter:: |
418EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) { | 418EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) { |
419 OS << "// Add parameter attributes that are not common to all intrinsics.\n"; 420 OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; 421 if (TargetOnly) 422 OS << "static AttrListPtr getAttributes(" << TargetPrefix 423 << "Intrinsic::ID id) {"; 424 else 425 OS << "AttrListPtr Intrinsic::getAttributes(ID id) {"; 426 OS << " // No intrinsic can throw exceptions.\n"; --- 72 unchanged lines hidden (view full) --- 499 OS << " AWI[NumAttrs] = AttributeWithIndex::get(~0, Attr);\n"; 500 OS << " return AttrListPtr::get(AWI, NumAttrs+1);\n"; 501 OS << "}\n"; 502 OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; 503} 504 505/// EmitModRefBehavior - Determine intrinsic alias analysis mod/ref behavior. 506void IntrinsicEmitter:: | 419 OS << "// Add parameter attributes that are not common to all intrinsics.\n"; 420 OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; 421 if (TargetOnly) 422 OS << "static AttrListPtr getAttributes(" << TargetPrefix 423 << "Intrinsic::ID id) {"; 424 else 425 OS << "AttrListPtr Intrinsic::getAttributes(ID id) {"; 426 OS << " // No intrinsic can throw exceptions.\n"; --- 72 unchanged lines hidden (view full) --- 499 OS << " AWI[NumAttrs] = AttributeWithIndex::get(~0, Attr);\n"; 500 OS << " return AttrListPtr::get(AWI, NumAttrs+1);\n"; 501 OS << "}\n"; 502 OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; 503} 504 505/// EmitModRefBehavior - Determine intrinsic alias analysis mod/ref behavior. 506void IntrinsicEmitter:: |
507EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){ | 507EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS){ |
508 OS << "// Determine intrinsic alias analysis mod/ref behavior.\n"; 509 OS << "#ifdef GET_INTRINSIC_MODREF_BEHAVIOR\n"; 510 OS << "switch (id) {\n"; 511 OS << "default:\n return UnknownModRefBehavior;\n"; 512 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 513 if (Ints[i].ModRef == CodeGenIntrinsic::WriteMem) 514 continue; 515 OS << "case " << TargetPrefix << "Intrinsic::" << Ints[i].EnumName --- 13 unchanged lines hidden (view full) --- 529 break; 530 } 531 } 532 OS << "}\n"; 533 OS << "#endif // GET_INTRINSIC_MODREF_BEHAVIOR\n\n"; 534} 535 536void IntrinsicEmitter:: | 508 OS << "// Determine intrinsic alias analysis mod/ref behavior.\n"; 509 OS << "#ifdef GET_INTRINSIC_MODREF_BEHAVIOR\n"; 510 OS << "switch (id) {\n"; 511 OS << "default:\n return UnknownModRefBehavior;\n"; 512 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 513 if (Ints[i].ModRef == CodeGenIntrinsic::WriteMem) 514 continue; 515 OS << "case " << TargetPrefix << "Intrinsic::" << Ints[i].EnumName --- 13 unchanged lines hidden (view full) --- 529 break; 530 } 531 } 532 OS << "}\n"; 533 OS << "#endif // GET_INTRINSIC_MODREF_BEHAVIOR\n\n"; 534} 535 536void IntrinsicEmitter:: |
537EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){ | 537EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS){ |
538 OS << "// Get the GCC builtin that corresponds to an LLVM intrinsic.\n"; 539 OS << "#ifdef GET_GCC_BUILTIN_NAME\n"; 540 OS << " switch (F->getIntrinsicID()) {\n"; 541 OS << " default: BuiltinName = \"\"; break;\n"; 542 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 543 if (!Ints[i].GCCBuiltinName.empty()) { 544 OS << " case Intrinsic::" << Ints[i].EnumName << ": BuiltinName = \"" 545 << Ints[i].GCCBuiltinName << "\"; break;\n"; --- 8 unchanged lines hidden (view full) --- 554/// it down into a simple tree. 555/// 556/// At this point, we know that all the builtins in the range have the same name 557/// for the first 'CharStart' characters. Only the end of the name needs to be 558/// discriminated. 559typedef std::map<std::string, std::string>::const_iterator StrMapIterator; 560static void EmitBuiltinComparisons(StrMapIterator Start, StrMapIterator End, 561 unsigned CharStart, unsigned Indent, | 538 OS << "// Get the GCC builtin that corresponds to an LLVM intrinsic.\n"; 539 OS << "#ifdef GET_GCC_BUILTIN_NAME\n"; 540 OS << " switch (F->getIntrinsicID()) {\n"; 541 OS << " default: BuiltinName = \"\"; break;\n"; 542 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 543 if (!Ints[i].GCCBuiltinName.empty()) { 544 OS << " case Intrinsic::" << Ints[i].EnumName << ": BuiltinName = \"" 545 << Ints[i].GCCBuiltinName << "\"; break;\n"; --- 8 unchanged lines hidden (view full) --- 554/// it down into a simple tree. 555/// 556/// At this point, we know that all the builtins in the range have the same name 557/// for the first 'CharStart' characters. Only the end of the name needs to be 558/// discriminated. 559typedef std::map<std::string, std::string>::const_iterator StrMapIterator; 560static void EmitBuiltinComparisons(StrMapIterator Start, StrMapIterator End, 561 unsigned CharStart, unsigned Indent, |
562 std::string TargetPrefix, std::ostream &OS) { | 562 std::string TargetPrefix, raw_ostream &OS) { |
563 if (Start == End) return; // empty range. 564 565 // Determine what, if anything, is the same about all these strings. 566 std::string CommonString = Start->first; 567 unsigned NumInRange = 0; 568 for (StrMapIterator I = Start; I != End; ++I, ++NumInRange) { 569 // Find the first character that doesn't match. 570 const std::string &ThisStr = I->first; --- 57 unchanged lines hidden (view full) --- 628 } 629 OS << std::string(Indent*2, ' ') << "}\n"; 630} 631 632/// EmitTargetBuiltins - All of the builtins in the specified map are for the 633/// same target, and we already checked it. 634static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM, 635 const std::string &TargetPrefix, | 563 if (Start == End) return; // empty range. 564 565 // Determine what, if anything, is the same about all these strings. 566 std::string CommonString = Start->first; 567 unsigned NumInRange = 0; 568 for (StrMapIterator I = Start; I != End; ++I, ++NumInRange) { 569 // Find the first character that doesn't match. 570 const std::string &ThisStr = I->first; --- 57 unchanged lines hidden (view full) --- 628 } 629 OS << std::string(Indent*2, ' ') << "}\n"; 630} 631 632/// EmitTargetBuiltins - All of the builtins in the specified map are for the 633/// same target, and we already checked it. 634static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM, 635 const std::string &TargetPrefix, |
636 std::ostream &OS) { | 636 raw_ostream &OS) { |
637 // Rearrange the builtins by length. 638 std::vector<std::map<std::string, std::string> > BuiltinsByLen; 639 BuiltinsByLen.reserve(100); 640 641 for (StrMapIterator I = BIM.begin(), E = BIM.end(); I != E; ++I) { 642 if (I->first.size() >= BuiltinsByLen.size()) 643 BuiltinsByLen.resize(I->first.size()+1); 644 BuiltinsByLen[I->first.size()].insert(*I); --- 10 unchanged lines hidden (view full) --- 655 OS << " break;\n"; 656 } 657 OS << " }\n"; 658} 659 660 661void IntrinsicEmitter:: 662EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, | 637 // Rearrange the builtins by length. 638 std::vector<std::map<std::string, std::string> > BuiltinsByLen; 639 BuiltinsByLen.reserve(100); 640 641 for (StrMapIterator I = BIM.begin(), E = BIM.end(); I != E; ++I) { 642 if (I->first.size() >= BuiltinsByLen.size()) 643 BuiltinsByLen.resize(I->first.size()+1); 644 BuiltinsByLen[I->first.size()].insert(*I); --- 10 unchanged lines hidden (view full) --- 655 OS << " break;\n"; 656 } 657 OS << " }\n"; 658} 659 660 661void IntrinsicEmitter:: 662EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, |
663 std::ostream &OS) { | 663 raw_ostream &OS) { |
664 typedef std::map<std::string, std::map<std::string, std::string> > BIMTy; 665 BIMTy BuiltinMap; 666 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 667 if (!Ints[i].GCCBuiltinName.empty()) { 668 // Get the map for this target prefix. 669 std::map<std::string, std::string> &BIM =BuiltinMap[Ints[i].TargetPrefix]; 670 671 if (!BIM.insert(std::make_pair(Ints[i].GCCBuiltinName, --- 45 unchanged lines hidden --- | 664 typedef std::map<std::string, std::map<std::string, std::string> > BIMTy; 665 BIMTy BuiltinMap; 666 for (unsigned i = 0, e = Ints.size(); i != e; ++i) { 667 if (!Ints[i].GCCBuiltinName.empty()) { 668 // Get the map for this target prefix. 669 std::map<std::string, std::string> &BIM =BuiltinMap[Ints[i].TargetPrefix]; 670 671 if (!BIM.insert(std::make_pair(Ints[i].GCCBuiltinName, --- 45 unchanged lines hidden --- |