use escape string.
[oota-llvm.git] / utils / TableGen / IntrinsicEmitter.cpp
index 37fc6702ede6c24595aa2a2353a5bc8edd5b796b..a63efbe93b99d55ec65da74dedd20e3ba75ffe3f 100644 (file)
@@ -35,7 +35,10 @@ void IntrinsicEmitter::run(std::ostream &OS) {
 
   // Emit the intrinsic ID -> name table.
   EmitIntrinsicToNameTable(Ints, OS);
-  
+
+  // Emit the intrinsic ID -> overload table.
+  EmitIntrinsicToOverloadTable(Ints, OS);
+
   // Emit the function name recognizer.
   EmitFnNameRecognizer(Ints, OS);
   
@@ -120,6 +123,23 @@ EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints,
   OS << "#endif\n\n";
 }
 
+void IntrinsicEmitter::
+EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints, 
+                         std::ostream &OS) {
+  OS << "// Intrinsic ID to overload table\n";
+  OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n";
+  OS << "  // Note that entry #0 is the invalid intrinsic!\n";
+  for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
+    OS << "  ";
+    if (Ints[i].isOverloaded)
+      OS << "true";
+    else
+      OS << "false";
+    OS << ",\n";
+  }
+  OS << "#endif\n\n";
+}
+
 static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) {
   if (MVT(VT).isInteger()) {
     unsigned BitWidth = MVT(VT).getSizeInBits();
@@ -216,7 +236,7 @@ static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType,
   }
 }
 
-/// RecordListComparator - Provide a determinstic comparator for lists of
+/// RecordListComparator - Provide a deterministic comparator for lists of
 /// records.
 namespace {
   typedef std::pair<std::vector<Record*>, std::vector<Record*> > RecPair;