From 387c9dcddabe8551468647b249d3629953caab9e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 17 May 2012 15:55:41 +0000 Subject: enhance the intrinsic info stuff to emit encodings that don't fit in 32-bits into a separate side table, using the handy SequenceToOffsetTable class. This encodes all these weird things into another 256 bytes, allowing all intrinsics to be encoded this way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156995 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Function.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'lib/VMCore/Function.cpp') diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 60a5113828..5a2a56637e 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -419,31 +419,34 @@ static Type *DecodeFixedType(unsigned &NextElt, ArrayRef Infos, FunctionType *Intrinsic::getType(LLVMContext &Context, ID id, ArrayRef Tys) { - Type *ResultTy = 0; - SmallVector ArgTys; - // Check to see if the intrinsic's type was expressible by the table. unsigned TableVal = IIT_Table[id-1]; - if (TableVal != ~0U) { - // Decode the TableVal into an array of IITValues. - SmallVector IITValues; + + // Decode the TableVal into an array of IITValues. + SmallVector IITValues; + ArrayRef IITEntries; + unsigned NextElt = 0; + if ((TableVal >> 31) != 0) { + // This is an offset into the IIT_LongEncodingTable. + IITEntries = IIT_LongEncodingTable; + + // Strip sentinel bit. + NextElt = (TableVal << 1) >> 1; + } else { do { IITValues.push_back(TableVal & 0xF); TableVal >>= 4; } while (TableVal); - unsigned NextElt = 0; - ResultTy = DecodeFixedType(NextElt, IITValues, Tys, Context); - - while (NextElt != IITValues.size()) - ArgTys.push_back(DecodeFixedType(NextElt, IITValues, Tys, Context)); - - return FunctionType::get(ResultTy, ArgTys, false); + IITEntries = IITValues; + NextElt = 0; } - -#define GET_INTRINSIC_GENERATOR -#include "llvm/Intrinsics.gen" -#undef GET_INTRINSIC_GENERATOR + + Type *ResultTy = DecodeFixedType(NextElt, IITEntries, Tys, Context); + + SmallVector ArgTys; + while (NextElt != IITEntries.size() && IITEntries[NextElt] != 0) + ArgTys.push_back(DecodeFixedType(NextElt, IITEntries, Tys, Context)); return FunctionType::get(ResultTy, ArgTys, false); } -- cgit v1.2.3