Index: llvm/trunk/lib/IR/Function.cpp =================================================================== --- llvm/trunk/lib/IR/Function.cpp +++ llvm/trunk/lib/IR/Function.cpp @@ -649,7 +649,10 @@ IIT_VEC_OF_ANYPTRS_TO_ELT = 34, IIT_I128 = 35, IIT_V512 = 36, - IIT_V1024 = 37 + IIT_V1024 = 37, + IIT_STRUCT6 = 38, + IIT_STRUCT7 = 39, + IIT_STRUCT8 = 40 }; static void DecodeIITType(unsigned &NextElt, ArrayRef Infos, @@ -798,6 +801,9 @@ case IIT_EMPTYSTRUCT: OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct, 0)); return; + case IIT_STRUCT8: ++StructElts; LLVM_FALLTHROUGH; + case IIT_STRUCT7: ++StructElts; LLVM_FALLTHROUGH; + case IIT_STRUCT6: ++StructElts; LLVM_FALLTHROUGH; case IIT_STRUCT5: ++StructElts; LLVM_FALLTHROUGH; case IIT_STRUCT4: ++StructElts; LLVM_FALLTHROUGH; case IIT_STRUCT3: ++StructElts; LLVM_FALLTHROUGH; @@ -874,11 +880,10 @@ return PointerType::get(DecodeFixedType(Infos, Tys, Context), D.Pointer_AddressSpace); case IITDescriptor::Struct: { - Type *Elts[5]; - assert(D.Struct_NumElements <= 5 && "Can't handle this yet"); + SmallVector Elts; for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i) - Elts[i] = DecodeFixedType(Infos, Tys, Context); - return StructType::get(Context, makeArrayRef(Elts,D.Struct_NumElements)); + Elts.push_back(DecodeFixedType(Infos, Tys, Context)); + return StructType::get(Context, Elts); } case IITDescriptor::Argument: return Tys[D.getArgumentNumber()]; Index: llvm/trunk/test/TableGen/intrinsic-struct.td =================================================================== --- llvm/trunk/test/TableGen/intrinsic-struct.td +++ llvm/trunk/test/TableGen/intrinsic-struct.td @@ -0,0 +1,32 @@ +// RUN: llvm-tblgen -gen-intrinsic %s | FileCheck %s +// XFAIL: vg_leak + +class IntrinsicProperty; + +class ValueType { + string Namespace = "MVT"; + int Size = size; + int Value = value; +} + +class LLVMType { + ValueType VT = vt; +} + +class Intrinsic ret_types = []> { + string LLVMName = name; + bit isTarget = 0; + string TargetPrefix = ""; + list RetTypes = ret_types; + list ParamTypes = []; + list IntrProperties = []; +} + +def iAny : ValueType<0, 253>; +def llvm_anyint_ty : LLVMType; + +// Make sure we can return up to 8 values +// CHECK: returns_8_results // llvm.returns.8.results +def int_returns_8_results : Intrinsic<"llvm.returns.8.results", + [llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, + llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty]>; Index: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp =================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp @@ -214,7 +214,10 @@ IIT_VEC_OF_ANYPTRS_TO_ELT = 34, IIT_I128 = 35, IIT_V512 = 36, - IIT_V1024 = 37 + IIT_V1024 = 37, + IIT_STRUCT6 = 38, + IIT_STRUCT7 = 39, + IIT_STRUCT8 = 40 }; static void EncodeFixedValueType(MVT::SimpleValueType VT, @@ -369,6 +372,9 @@ case 3: TypeSig.push_back(IIT_STRUCT3); break; case 4: TypeSig.push_back(IIT_STRUCT4); break; case 5: TypeSig.push_back(IIT_STRUCT5); break; + case 6: TypeSig.push_back(IIT_STRUCT6); break; + case 7: TypeSig.push_back(IIT_STRUCT7); break; + case 8: TypeSig.push_back(IIT_STRUCT8); break; default: llvm_unreachable("Unhandled case in struct"); }