From 5aed30d5cf41ac0a10cc961ef815c1825c8b57d8 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Tue, 6 Feb 2007 18:02:54 +0000 Subject: Support var arg intrinsics. llvm-svn: 33962 --- llvm/include/llvm/Intrinsics.td | 7 +++++++ llvm/lib/VMCore/Verifier.cpp | 4 ++++ llvm/utils/TableGen/FileLexer.l | 2 +- llvm/utils/TableGen/IntrinsicEmitter.cpp | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) (limited to 'llvm') diff --git a/llvm/include/llvm/Intrinsics.td b/llvm/include/llvm/Intrinsics.td index 3fc55f79da6..bda4a927bbe 100644 --- a/llvm/include/llvm/Intrinsics.td +++ b/llvm/include/llvm/Intrinsics.td @@ -88,6 +88,8 @@ def llvm_v4i32_ty : LLVMPackedType; // 4 x i32 def llvm_v4f32_ty : LLVMPackedType; // 4 x float def llvm_v2f64_ty : LLVMPackedType;// 2 x double +def ... : LLVMType; // vararg + //===----------------------------------------------------------------------===// // Intrinsic Definitions. //===----------------------------------------------------------------------===// @@ -217,6 +219,11 @@ def int_dbg_func_start : Intrinsic<[llvm_void_ty, llvm_descriptor_ty]>; def int_dbg_declare : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_descriptor_ty]>; +//===------------------ Exception Handling Intrinsics----------------------===// +// +def int_eh_exception : Intrinsic<[llvm_ptr_ty]>; +def int_eh_handlers : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty, ...]>; + //===----------------------------------------------------------------------===// // Target-specific intrinsics //===----------------------------------------------------------------------===// diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index f5b0550d88e..c2fd8746b7a 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -987,6 +987,10 @@ void Verifier::VerifyIntrinsicPrototype(Function *F, ...) { for (unsigned ArgNo = 0; 1; ++ArgNo) { int TypeID = va_arg(VA, int); + if (TypeID == -2) { + break; + } + if (TypeID == -1) { if (ArgNo != FTy->getNumParams()+1) CheckFailed("Intrinsic prototype has too many arguments!", F); diff --git a/llvm/utils/TableGen/FileLexer.l b/llvm/utils/TableGen/FileLexer.l index cc6825f5e07..fa89b8ba04f 100644 --- a/llvm/utils/TableGen/FileLexer.l +++ b/llvm/utils/TableGen/FileLexer.l @@ -176,7 +176,7 @@ using namespace llvm; Comment \/\/.* -Identifier [a-zA-Z_][0-9a-zA-Z_]* +Identifier [a-zA-Z_][0-9a-zA-Z_]*|\.\.\. Integer [-+]?[0-9]+|0x[0-9a-fA-F]+|0b[01]+ CodeFragment \[\{([^}]+|\}[^\]])*\}\] StringVal \"[^"]*\" diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 7cd03751de3..9a1132a2759 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -109,6 +109,11 @@ EmitIntrinsicToNameTable(const std::vector &Ints, } static void EmitTypeVerify(std::ostream &OS, Record *ArgType) { + if (ArgType->getValueAsString("TypeVal") == "...") { + OS << "-2, "; + return; + } + OS << "(int)" << ArgType->getValueAsString("TypeVal") << ", "; // If this is an integer type, check the width is correct. if (ArgType->isSubClassOf("LLVMIntegerType")) -- cgit v1.2.3