[llvm-commits] CVS: llvm/utils/TableGen/IntrinsicEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 30 20:48:38 PST 2006



Changes in directory llvm/utils/TableGen:

IntrinsicEmitter.cpp updated: 1.18 -> 1.19
---
Log message:

Final bugfix for PR724: http://llvm.cs.uiuc.edu/PR724 .  GCC won't inline varargs functions, so use one to
validate the prototype of intrinsic functions.  This prevents GCC from going
crazy and inlining too much stuff, eventually running out of memory.



---
Diffs of the changes:  (+9 -17)

 IntrinsicEmitter.cpp |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)


Index: llvm/utils/TableGen/IntrinsicEmitter.cpp
diff -u llvm/utils/TableGen/IntrinsicEmitter.cpp:1.18 llvm/utils/TableGen/IntrinsicEmitter.cpp:1.19
--- llvm/utils/TableGen/IntrinsicEmitter.cpp:1.18	Thu Mar 30 22:24:58 2006
+++ llvm/utils/TableGen/IntrinsicEmitter.cpp	Thu Mar 30 22:48:26 2006
@@ -108,22 +108,14 @@
   OS << "#endif\n\n";
 }
 
-static void EmitTypeVerify(std::ostream &OS, const std::string &Val,
-                           Record *ArgType) {
-  OS << "    Assert1(" << Val << "->getTypeID() == "
-     << ArgType->getValueAsString("TypeVal") << ",\n"
-     << "            \"Illegal intrinsic type!\", IF);\n";
+static void EmitTypeVerify(std::ostream &OS, Record *ArgType) {
+  OS << "(int)" << ArgType->getValueAsString("TypeVal") << ", ";
 
   // If this is a packed type, check that the subtype and size are correct.
   if (ArgType->isSubClassOf("LLVMPackedType")) {
     Record *SubType = ArgType->getValueAsDef("ElTy");
-    OS << "    Assert1(cast<PackedType>(" << Val
-       << ")->getElementType()->getTypeID() == "
-       << SubType->getValueAsString("TypeVal") << ",\n"
-       << "            \"Illegal intrinsic type!\", IF);\n";
-    OS << "    Assert1(cast<PackedType>(" << Val << ")->getNumElements() == "
-       << ArgType->getValueAsInt("NumElts") << ",\n"
-       << "            \"Illegal intrinsic type!\", IF);\n";
+    OS << "(int)" << SubType->getValueAsString("TypeVal") << ", "
+       << ArgType->getValueAsInt("NumElts") << ", ";
   }
 }
 
@@ -170,12 +162,12 @@
       OS << "  case Intrinsic::" << Ints[I->second[i]].EnumName << ":\t\t// "
          << Ints[I->second[i]].Name << "\n";
     }
+    
     const std::vector<Record*> &ArgTypes = I->first;
-    OS << "    Assert1(FTy->getNumParams() == " << ArgTypes.size()-1 << ",\n"
-       << "            \"Illegal # arguments for intrinsic function!\", IF);\n";
-    EmitTypeVerify(OS, "FTy->getReturnType()", ArgTypes[0]);
-    for (unsigned j = 1; j != ArgTypes.size(); ++j)
-      EmitTypeVerify(OS, "FTy->getParamType(" + utostr(j-1) + ")", ArgTypes[j]);
+    OS << "    VerifyIntrinsicPrototype(IF, ";
+    for (unsigned j = 0; j != ArgTypes.size(); ++j)
+      EmitTypeVerify(OS, ArgTypes[j]);
+    OS << "-1);\n";
     OS << "    break;\n";
   }
   OS << "  }\n";






More information about the llvm-commits mailing list