diff options
author | Chris Lattner <sabre@nondot.org> | 2012-05-17 15:55:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-05-17 15:55:41 +0000 |
commit | 387c9dcddabe8551468647b249d3629953caab9e (patch) | |
tree | 689b7d9b1654c3bea88e164547dfa961f7cacda0 /lib/VMCore/Function.cpp | |
parent | 44600d708154e09f4e53719f503e2446eb2b7f53 (diff) |
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
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r-- | lib/VMCore/Function.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
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<unsigned char> Infos, FunctionType *Intrinsic::getType(LLVMContext &Context, ID id, ArrayRef<Type*> Tys) { - Type *ResultTy = 0; - SmallVector<Type*, 8> 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<unsigned char, 8> IITValues; + + // Decode the TableVal into an array of IITValues. + SmallVector<unsigned char, 8> IITValues; + ArrayRef<unsigned char> 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<Type*, 8> ArgTys; + while (NextElt != IITEntries.size() && IITEntries[NextElt] != 0) + ArgTys.push_back(DecodeFixedType(NextElt, IITEntries, Tys, Context)); return FunctionType::get(ResultTy, ArgTys, false); } |