diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-31 04:48:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-31 04:48:26 +0000 |
commit | f124b46b4f18b1a8f054a1222324ae15079f6ed8 (patch) | |
tree | e78d9c1f7ae202bbd3f01bf0df454ecee63b2e4d /utils/TableGen | |
parent | 536a9d5ea54087f72a8f1e9f9b4c5fec80b3844b (diff) | |
download | llvm-f124b46b4f18b1a8f054a1222324ae15079f6ed8.tar.gz llvm-f124b46b4f18b1a8f054a1222324ae15079f6ed8.tar.bz2 llvm-f124b46b4f18b1a8f054a1222324ae15079f6ed8.tar.xz |
Final bugfix for 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/IntrinsicEmitter.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp index f53c8ea8c9..1da361c934 100644 --- a/utils/TableGen/IntrinsicEmitter.cpp +++ b/utils/TableGen/IntrinsicEmitter.cpp @@ -108,22 +108,14 @@ EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, 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 @@ void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints, 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"; |