From a54b7cbd452b3adb2f51346140d996b29c2cdb30 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Fri, 12 Jan 2007 07:05:14 +0000 Subject: For PR1064: Implement the arbitrary bit-width integer feature. The feature allows integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 16, 32, and 64 bit integers. This change does several things: 1. Introduces a new Derived Type, IntegerType, to represent the number of bits in an integer. The Type classes SubclassData field is used to store the number of bits. This allows 2^23 bits in an integer type. 2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and 64-bit integers. These are replaced with just IntegerType which is not a primitive any more. 3. Adjust the rest of LLVM to account for this change. Note that while this incremental change lays the foundation for arbitrary bit-width integers, LLVM has not yet been converted to actually deal with them in any significant way. Most optimization passes, for example, will still only deal with the byte-width integer types. Future increments will rectify this situation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp') diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 52d3cfa684..b1c2ee4b6a 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -41,11 +41,15 @@ static Interpreter *TheInterpreter; static char getTypeID(const Type *Ty) { switch (Ty->getTypeID()) { case Type::VoidTyID: return 'V'; - case Type::Int1TyID: return 'o'; - case Type::Int8TyID: return 'B'; - case Type::Int16TyID: return 'S'; - case Type::Int32TyID: return 'I'; - case Type::Int64TyID: return 'L'; + case Type::IntegerTyID: + switch (cast(Ty)->getBitWidth()) { + case 1: return 'o'; + case 8: return 'B'; + case 16: return 'S'; + case 32: return 'I'; + case 64: return 'L'; + default: return 'N'; + } case Type::FloatTyID: return 'F'; case Type::DoubleTyID: return 'D'; case Type::PointerTyID: return 'P'; -- cgit v1.2.3-18-g5258