Put comma in correct place for call to StructType::get
[oota-llvm.git] / utils / TableGen / IntrinsicEmitter.cpp
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 //===----------------------------------------------------------------------===//
9 //
10 // This tablegen backend emits information about intrinsic functions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "CodeGenTarget.h"
15 #include "IntrinsicEmitter.h"
16 #include "Record.h"
17 #include "llvm/ADT/StringExtras.h"
18 #include <algorithm>
19 using namespace llvm;
20
21 //===----------------------------------------------------------------------===//
22 // IntrinsicEmitter Implementation
23 //===----------------------------------------------------------------------===//
24
25 void IntrinsicEmitter::run(std::ostream &OS) {
26   EmitSourceFileHeader("Intrinsic Function Source Fragment", OS);
27   
28   std::vector<CodeGenIntrinsic> Ints = LoadIntrinsics(Records);
29
30   // Emit the enum information.
31   EmitEnumInfo(Ints, OS);
32
33   // Emit the intrinsic ID -> name table.
34   EmitIntrinsicToNameTable(Ints, OS);
35   
36   // Emit the function name recognizer.
37   EmitFnNameRecognizer(Ints, OS);
38   
39   // Emit the intrinsic verifier.
40   EmitVerifier(Ints, OS);
41   
42   // Emit the intrinsic declaration generator.
43   EmitGenerator(Ints, OS);
44   
45   // Emit the intrinsic parameter attributes.
46   EmitAttributes(Ints, OS);
47
48   // Emit a list of intrinsics with corresponding GCC builtins.
49   EmitGCCBuiltinList(Ints, OS);
50
51   // Emit code to translate GCC builtins into LLVM intrinsics.
52   EmitIntrinsicToGCCBuiltinMap(Ints, OS);
53 }
54
55 void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints,
56                                     std::ostream &OS) {
57   OS << "// Enum values for Intrinsics.h\n";
58   OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n";
59   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
60     OS << "    " << Ints[i].EnumName;
61     OS << ((i != e-1) ? ", " : "  ");
62     OS << std::string(40-Ints[i].EnumName.size(), ' ') 
63       << "// " << Ints[i].Name << "\n";
64   }
65   OS << "#endif\n\n";
66 }
67
68 void IntrinsicEmitter::
69 EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, 
70                      std::ostream &OS) {
71   // Build a function name -> intrinsic name mapping.
72   std::map<std::string, unsigned> IntMapping;
73   for (unsigned i = 0, e = Ints.size(); i != e; ++i)
74     IntMapping[Ints[i].Name] = i;
75     
76   OS << "// Function name -> enum value recognizer code.\n";
77   OS << "#ifdef GET_FUNCTION_RECOGNIZER\n";
78   OS << "  switch (Name[5]) {\n";
79   OS << "  default:\n";
80   // Emit the intrinsics in sorted order.
81   char LastChar = 0;
82   for (std::map<std::string, unsigned>::iterator I = IntMapping.begin(),
83        E = IntMapping.end(); I != E; ++I) {
84     if (I->first[5] != LastChar) {
85       LastChar = I->first[5];
86       OS << "    break;\n";
87       OS << "  case '" << LastChar << "':\n";
88     }
89     
90     // For overloaded intrinsics, only the prefix needs to match
91     if (Ints[I->second].isOverloaded)
92       OS << "    if (Len > " << I->first.size()
93        << " && !memcmp(Name, \"" << I->first << ".\", "
94        << (I->first.size() + 1) << ")) return Intrinsic::"
95        << Ints[I->second].EnumName << ";\n";
96     else 
97       OS << "    if (Len == " << I->first.size()
98          << " && !memcmp(Name, \"" << I->first << "\", "
99          << I->first.size() << ")) return Intrinsic::"
100          << Ints[I->second].EnumName << ";\n";
101   }
102   OS << "  }\n";
103   OS << "#endif\n\n";
104 }
105
106 void IntrinsicEmitter::
107 EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, 
108                          std::ostream &OS) {
109   OS << "// Intrinsic ID to name table\n";
110   OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n";
111   OS << "  // Note that entry #0 is the invalid intrinsic!\n";
112   for (unsigned i = 0, e = Ints.size(); i != e; ++i)
113     OS << "  \"" << Ints[i].Name << "\",\n";
114   OS << "#endif\n\n";
115 }
116
117 static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) {
118   if (MVT(VT).isInteger()) {
119     unsigned BitWidth = MVT(VT).getSizeInBits();
120     OS << "IntegerType::get(" << BitWidth << ")";
121   } else if (VT == MVT::Other) {
122     // MVT::OtherVT is used to mean the empty struct type here.
123     OS << "StructType::get(std::vector<const Type *>())";
124   } else if (VT == MVT::f32) {
125     OS << "Type::FloatTy";
126   } else if (VT == MVT::f64) {
127     OS << "Type::DoubleTy";
128   } else if (VT == MVT::f80) {
129     OS << "Type::X86_FP80Ty";
130   } else if (VT == MVT::f128) {
131     OS << "Type::FP128Ty";
132   } else if (VT == MVT::ppcf128) {
133     OS << "Type::PPC_FP128Ty";
134   } else if (VT == MVT::isVoid) {
135     OS << "Type::VoidTy";
136   } else {
137     assert(false && "Unsupported ValueType!");
138   }
139 }
140
141 static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType,
142                              unsigned &ArgNo);
143
144 static void EmitTypeGenerate(std::ostream &OS,
145                              const std::vector<Record*> &ArgTypes,
146                              unsigned &ArgNo) {
147   if (ArgTypes.size() == 1) {
148     EmitTypeGenerate(OS, ArgTypes.front(), ArgNo);
149     return;
150   }
151
152   OS << "StructType::get(";
153
154   for (std::vector<Record*>::const_iterator
155          I = ArgTypes.begin(), E = ArgTypes.end(); I != E; ++I) {
156     EmitTypeGenerate(OS, *I, ArgNo);
157     OS << ", ";
158   }
159
160   OS << " NULL)";
161 }
162
163 static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType,
164                              unsigned &ArgNo) {
165   MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
166
167   if (ArgType->isSubClassOf("LLVMMatchType")) {
168     unsigned Number = ArgType->getValueAsInt("Number");
169     assert(Number < ArgNo && "Invalid matching number!");
170     OS << "Tys[" << Number << "]";
171   } else if (VT == MVT::iAny || VT == MVT::fAny) {
172     // NOTE: The ArgNo variable here is not the absolute argument number, it is
173     // the index of the "arbitrary" type in the Tys array passed to the
174     // Intrinsic::getDeclaration function. Consequently, we only want to
175     // increment it when we actually hit an overloaded type. Getting this wrong
176     // leads to very subtle bugs!
177     OS << "Tys[" << ArgNo++ << "]";
178   } else if (MVT(VT).isVector()) {
179     MVT VVT = VT;
180     OS << "VectorType::get(";
181     EmitTypeForValueType(OS, VVT.getVectorElementType().getSimpleVT());
182     OS << ", " << VVT.getVectorNumElements() << ")";
183   } else if (VT == MVT::iPTR) {
184     OS << "PointerType::getUnqual(";
185     EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"), ArgNo);
186     OS << ")";
187   } else if (VT == MVT::iPTRAny) {
188     // Make sure the user has passed us an argument type to overload. If not,
189     // treat it as an ordinary (not overloaded) intrinsic.
190     OS << "(" << ArgNo << " < numTys) ? Tys[" << ArgNo 
191     << "] : PointerType::getUnqual(";
192     EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"), ArgNo);
193     OS << ")";
194     ++ArgNo;
195   } else if (VT == MVT::isVoid) {
196     if (ArgNo == 0)
197       OS << "Type::VoidTy";
198     else
199       // MVT::isVoid is used to mean varargs here.
200       OS << "...";
201   } else {
202     EmitTypeForValueType(OS, VT);
203   }
204 }
205
206 /// RecordListComparator - Provide a determinstic comparator for lists of
207 /// records.
208 namespace {
209   typedef std::pair<std::vector<Record*>, std::vector<Record*> > RecPair;
210   struct RecordListComparator {
211     bool operator()(const RecPair &LHS,
212                     const RecPair &RHS) const {
213       unsigned i = 0;
214       const std::vector<Record*> *LHSVec = &LHS.first;
215       const std::vector<Record*> *RHSVec = &RHS.first;
216       unsigned RHSSize = RHSVec->size();
217       unsigned LHSSize = LHSVec->size();
218
219       do {
220         if (i == RHSSize) return false;  // RHS is shorter than LHS.
221         if ((*LHSVec)[i] != (*RHSVec)[i])
222           return (*LHSVec)[i]->getName() < (*RHSVec)[i]->getName();
223       } while (++i != LHSSize);
224
225       if (i != RHSSize) return false;
226
227       i = 0;
228       LHSVec = &LHS.second;
229       RHSVec = &RHS.second;
230       RHSSize = RHSVec->size();
231       LHSSize = LHSVec->size();
232
233       for (i = 0; i != LHSSize; ++i) {
234         if (i == RHSSize) return false;  // RHS is shorter than LHS.
235         if ((*LHSVec)[i] != (*RHSVec)[i])
236           return (*LHSVec)[i]->getName() < (*RHSVec)[i]->getName();
237       }
238
239       return i != RHSSize;
240     }
241   };
242 }
243
244 void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints, 
245                                     std::ostream &OS) {
246   OS << "// Verifier::visitIntrinsicFunctionCall code.\n";
247   OS << "#ifdef GET_INTRINSIC_VERIFIER\n";
248   OS << "  switch (ID) {\n";
249   OS << "  default: assert(0 && \"Invalid intrinsic!\");\n";
250   
251   // This checking can emit a lot of very common code.  To reduce the amount of
252   // code that we emit, batch up cases that have identical types.  This avoids
253   // problems where GCC can run out of memory compiling Verifier.cpp.
254   typedef std::map<RecPair, std::vector<unsigned>, RecordListComparator> MapTy;
255   MapTy UniqueArgInfos;
256   
257   // Compute the unique argument type info.
258   for (unsigned i = 0, e = Ints.size(); i != e; ++i)
259     UniqueArgInfos[make_pair(Ints[i].IS.RetTypeDefs,
260                              Ints[i].IS.ParamTypeDefs)].push_back(i);
261
262   // Loop through the array, emitting one comparison for each batch.
263   for (MapTy::iterator I = UniqueArgInfos.begin(),
264        E = UniqueArgInfos.end(); I != E; ++I) {
265     for (unsigned i = 0, e = I->second.size(); i != e; ++i)
266       OS << "  case Intrinsic::" << Ints[I->second[i]].EnumName << ":\t\t// "
267          << Ints[I->second[i]].Name << "\n";
268     
269     const RecPair &ArgTypes = I->first;
270     const std::vector<Record*> &RetTys = ArgTypes.first;
271     const std::vector<Record*> &ParamTys = ArgTypes.second;
272
273     OS << "    VerifyIntrinsicPrototype(ID, IF, " << RetTys.size() << ", "
274        << ParamTys.size();
275
276     // Emit return types.
277     for (unsigned j = 0, je = RetTys.size(); j != je; ++j) {
278       Record *ArgType = RetTys[j];
279       OS << ", ";
280
281       if (ArgType->isSubClassOf("LLVMMatchType")) {
282         unsigned Number = ArgType->getValueAsInt("Number");
283         assert(Number < j && "Invalid matching number!");
284         OS << "~" << Number;
285       } else {
286         MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
287         OS << getEnumName(VT);
288
289         if (VT == MVT::isVoid && j != 0 && j != je - 1)
290           throw "Var arg type not last argument";
291       }
292     }
293
294     // Emit the parameter types.
295     for (unsigned j = 0, je = ParamTys.size(); j != je; ++j) {
296       Record *ArgType = ParamTys[j];
297       OS << ", ";
298
299       if (ArgType->isSubClassOf("LLVMMatchType")) {
300         unsigned Number = ArgType->getValueAsInt("Number");
301         assert(Number < j + RetTys.size() && "Invalid matching number!");
302         OS << "~" << Number;
303       } else {
304         MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
305         OS << getEnumName(VT);
306
307         if (VT == MVT::isVoid && j != 0 && j != je - 1)
308           throw "Var arg type not last argument";
309       }
310     }
311       
312     OS << ");\n";
313     OS << "    break;\n";
314   }
315   OS << "  }\n";
316   OS << "#endif\n\n";
317 }
318
319 void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints, 
320                                      std::ostream &OS) {
321   OS << "// Code for generating Intrinsic function declarations.\n";
322   OS << "#ifdef GET_INTRINSIC_GENERATOR\n";
323   OS << "  switch (id) {\n";
324   OS << "  default: assert(0 && \"Invalid intrinsic!\");\n";
325   
326   // Similar to GET_INTRINSIC_VERIFIER, batch up cases that have identical
327   // types.
328   typedef std::map<RecPair, std::vector<unsigned>, RecordListComparator> MapTy;
329   MapTy UniqueArgInfos;
330   
331   // Compute the unique argument type info.
332   for (unsigned i = 0, e = Ints.size(); i != e; ++i)
333     UniqueArgInfos[make_pair(Ints[i].IS.RetTypeDefs,
334                              Ints[i].IS.ParamTypeDefs)].push_back(i);
335
336   // Loop through the array, emitting one generator for each batch.
337   for (MapTy::iterator I = UniqueArgInfos.begin(),
338        E = UniqueArgInfos.end(); I != E; ++I) {
339     for (unsigned i = 0, e = I->second.size(); i != e; ++i)
340       OS << "  case Intrinsic::" << Ints[I->second[i]].EnumName << ":\t\t// "
341          << Ints[I->second[i]].Name << "\n";
342     
343     const RecPair &ArgTypes = I->first;
344     const std::vector<Record*> &RetTys = ArgTypes.first;
345     const std::vector<Record*> &ParamTys = ArgTypes.second;
346
347     unsigned N = ParamTys.size();
348
349     if (N > 1 &&
350         getValueType(ParamTys[N - 1]->getValueAsDef("VT")) == MVT::isVoid) {
351       OS << "    IsVarArg = true;\n";
352       --N;
353     }
354
355     unsigned ArgNo = 0;
356     OS << "    ResultTy = ";
357     EmitTypeGenerate(OS, RetTys, ArgNo);
358     OS << ";\n";
359     
360     for (unsigned j = 0; j != N; ++j) {
361       OS << "    ArgTys.push_back(";
362       EmitTypeGenerate(OS, ParamTys[j], ArgNo);
363       OS << ");\n";
364     }
365
366     OS << "    break;\n";
367   }
368
369   OS << "  }\n";
370   OS << "#endif\n\n";
371 }
372
373 void IntrinsicEmitter::
374 EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) {
375   OS << "// Add parameter attributes that are not common to all intrinsics.\n";
376   OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n";
377   OS << "  switch (id) {\n";
378   OS << "  default: break;\n";
379   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
380     switch (Ints[i].ModRef) {
381     default: break;
382     case CodeGenIntrinsic::NoMem:
383       OS << "  case Intrinsic::" << Ints[i].EnumName << ":\n";
384       break;
385     }
386   }
387   OS << "    Attr |= Attribute::ReadNone; // These do not access memory.\n";
388   OS << "    break;\n";
389   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
390     switch (Ints[i].ModRef) {
391     default: break;
392     case CodeGenIntrinsic::ReadArgMem:
393     case CodeGenIntrinsic::ReadMem:
394       OS << "  case Intrinsic::" << Ints[i].EnumName << ":\n";
395       break;
396     }
397   }
398   OS << "    Attr |= Attribute::ReadOnly; // These do not write memory.\n";
399   OS << "    break;\n";
400   OS << "  }\n";
401   OS << "#endif\n\n";
402 }
403
404 void IntrinsicEmitter::
405 EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){
406   OS << "// Get the GCC builtin that corresponds to an LLVM intrinsic.\n";
407   OS << "#ifdef GET_GCC_BUILTIN_NAME\n";
408   OS << "  switch (F->getIntrinsicID()) {\n";
409   OS << "  default: BuiltinName = \"\"; break;\n";
410   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
411     if (!Ints[i].GCCBuiltinName.empty()) {
412       OS << "  case Intrinsic::" << Ints[i].EnumName << ": BuiltinName = \""
413          << Ints[i].GCCBuiltinName << "\"; break;\n";
414     }
415   }
416   OS << "  }\n";
417   OS << "#endif\n\n";
418 }
419
420 /// EmitBuiltinComparisons - Emit comparisons to determine whether the specified
421 /// sorted range of builtin names is equal to the current builtin.  This breaks
422 /// it down into a simple tree.
423 ///
424 /// At this point, we know that all the builtins in the range have the same name
425 /// for the first 'CharStart' characters.  Only the end of the name needs to be
426 /// discriminated.
427 typedef std::map<std::string, std::string>::const_iterator StrMapIterator;
428 static void EmitBuiltinComparisons(StrMapIterator Start, StrMapIterator End,
429                                    unsigned CharStart, unsigned Indent,
430                                    std::ostream &OS) {
431   if (Start == End) return; // empty range.
432   
433   // Determine what, if anything, is the same about all these strings.
434   std::string CommonString = Start->first;
435   unsigned NumInRange = 0;
436   for (StrMapIterator I = Start; I != End; ++I, ++NumInRange) {
437     // Find the first character that doesn't match.
438     const std::string &ThisStr = I->first;
439     unsigned NonMatchChar = CharStart;
440     while (NonMatchChar < CommonString.size() && 
441            NonMatchChar < ThisStr.size() &&
442            CommonString[NonMatchChar] == ThisStr[NonMatchChar])
443       ++NonMatchChar;
444     // Truncate off pieces that don't match.
445     CommonString.resize(NonMatchChar);
446   }
447   
448   // Just compare the rest of the string.
449   if (NumInRange == 1) {
450     if (CharStart != CommonString.size()) {
451       OS << std::string(Indent*2, ' ') << "if (!memcmp(BuiltinName";
452       if (CharStart) OS << "+" << CharStart;
453       OS << ", \"" << (CommonString.c_str()+CharStart) << "\", ";
454       OS << CommonString.size() - CharStart << "))\n";
455       ++Indent;
456     }
457     OS << std::string(Indent*2, ' ') << "IntrinsicID = Intrinsic::";
458     OS << Start->second << ";\n";
459     return;
460   }
461
462   // At this point, we potentially have a common prefix for these builtins, emit
463   // a check for this common prefix.
464   if (CommonString.size() != CharStart) {
465     OS << std::string(Indent*2, ' ') << "if (!memcmp(BuiltinName";
466     if (CharStart) OS << "+" << CharStart;
467     OS << ", \"" << (CommonString.c_str()+CharStart) << "\", ";
468     OS << CommonString.size()-CharStart << ")) {\n";
469     
470     EmitBuiltinComparisons(Start, End, CommonString.size(), Indent+1, OS);
471     OS << std::string(Indent*2, ' ') << "}\n";
472     return;
473   }
474   
475   // Output a switch on the character that differs across the set.
476   OS << std::string(Indent*2, ' ') << "switch (BuiltinName[" << CharStart
477       << "]) {";
478   if (CharStart)
479     OS << "  // \"" << std::string(Start->first.begin(), 
480                                    Start->first.begin()+CharStart) << "\"";
481   OS << "\n";
482   
483   for (StrMapIterator I = Start; I != End; ) {
484     char ThisChar = I->first[CharStart];
485     OS << std::string(Indent*2, ' ') << "case '" << ThisChar << "':\n";
486     // Figure out the range that has this common character.
487     StrMapIterator NextChar = I;
488     for (++NextChar; NextChar != End && NextChar->first[CharStart] == ThisChar;
489          ++NextChar)
490       /*empty*/;
491     EmitBuiltinComparisons(I, NextChar, CharStart+1, Indent+1, OS);
492     OS << std::string(Indent*2, ' ') << "  break;\n";
493     I = NextChar;
494   }
495   OS << std::string(Indent*2, ' ') << "}\n";
496 }
497
498 /// EmitTargetBuiltins - All of the builtins in the specified map are for the
499 /// same target, and we already checked it.
500 static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM,
501                                std::ostream &OS) {
502   // Rearrange the builtins by length.
503   std::vector<std::map<std::string, std::string> > BuiltinsByLen;
504   BuiltinsByLen.reserve(100);
505   
506   for (StrMapIterator I = BIM.begin(), E = BIM.end(); I != E; ++I) {
507     if (I->first.size() >= BuiltinsByLen.size())
508       BuiltinsByLen.resize(I->first.size()+1);
509     BuiltinsByLen[I->first.size()].insert(*I);
510   }
511   
512   // Now that we have all the builtins by their length, emit a switch stmt.
513   OS << "    switch (strlen(BuiltinName)) {\n";
514   OS << "    default: break;\n";
515   for (unsigned i = 0, e = BuiltinsByLen.size(); i != e; ++i) {
516     if (BuiltinsByLen[i].empty()) continue;
517     OS << "    case " << i << ":\n";
518     EmitBuiltinComparisons(BuiltinsByLen[i].begin(), BuiltinsByLen[i].end(),
519                            0, 3, OS);
520     OS << "      break;\n";
521   }
522   OS << "    }\n";
523 }
524
525         
526 void IntrinsicEmitter::
527 EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, 
528                              std::ostream &OS) {
529   typedef std::map<std::string, std::map<std::string, std::string> > BIMTy;
530   BIMTy BuiltinMap;
531   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
532     if (!Ints[i].GCCBuiltinName.empty()) {
533       // Get the map for this target prefix.
534       std::map<std::string, std::string> &BIM =BuiltinMap[Ints[i].TargetPrefix];
535       
536       if (!BIM.insert(std::make_pair(Ints[i].GCCBuiltinName,
537                                      Ints[i].EnumName)).second)
538         throw "Intrinsic '" + Ints[i].TheDef->getName() +
539               "': duplicate GCC builtin name!";
540     }
541   }
542   
543   OS << "// Get the LLVM intrinsic that corresponds to a GCC builtin.\n";
544   OS << "// This is used by the C front-end.  The GCC builtin name is passed\n";
545   OS << "// in as BuiltinName, and a target prefix (e.g. 'ppc') is passed\n";
546   OS << "// in as TargetPrefix.  The result is assigned to 'IntrinsicID'.\n";
547   OS << "#ifdef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN\n";
548   OS << "  IntrinsicID = Intrinsic::not_intrinsic;\n";
549   
550   // Note: this could emit significantly better code if we cared.
551   for (BIMTy::iterator I = BuiltinMap.begin(), E = BuiltinMap.end();I != E;++I){
552     OS << "  ";
553     if (!I->first.empty())
554       OS << "if (!strcmp(TargetPrefix, \"" << I->first << "\")) ";
555     else
556       OS << "/* Target Independent Builtins */ ";
557     OS << "{\n";
558
559     // Emit the comparisons for this target prefix.
560     EmitTargetBuiltins(I->second, OS);
561     OS << "  }\n";
562   }
563   OS << "#endif\n\n";
564 }