Reorder Type fields to make various isa< > check more concise

Depending on the order of fields, some isa < > checks can be faster because of
tests that check a range of type, leading to assembly simplification.

To find a relevant ordering, I... brute-forced the permutation among the derived
types and pick the combination that resulted in the smallest libLLVM-11.so.

On my laptop (x86_64), this reduces the size of libLLVM-11.so from 127344064 bytes to 127335336,
that's 8728 bytes shaved without much effort.

Also removed obsolete comments in the process.

Differential Revision: https://reviews.llvm.org/D79996
This commit is contained in:
serge-sans-paille 2020-05-12 18:46:32 +02:00
parent c579ab9962
commit ab1fb38d8f
1 changed files with 20 additions and 21 deletions

View File

@ -53,29 +53,28 @@ public:
/// Also update LLVMTypeKind and LLVMGetTypeKind () in the C binding.
///
enum TypeID {
// PrimitiveTypes - make sure LastPrimitiveTyID stays up to date.
VoidTyID = 0, ///< 0: type with no size
HalfTyID, ///< 1: 16-bit floating point type
BFloatTyID, ///< 2: 16-bit floating point type (7-bit significand)
FloatTyID, ///< 3: 32-bit floating point type
DoubleTyID, ///< 4: 64-bit floating point type
X86_FP80TyID, ///< 5: 80-bit floating point type (X87)
FP128TyID, ///< 6: 128-bit floating point type (112-bit significand)
PPC_FP128TyID, ///< 7: 128-bit floating point type (two 64-bits, PowerPC)
LabelTyID, ///< 8: Labels
MetadataTyID, ///< 9: Metadata
X86_MMXTyID, ///< 10: MMX vectors (64 bits, X86 specific)
TokenTyID, ///< 11: Tokens
// PrimitiveTypes
HalfTyID = 0, ///< 16-bit floating point type
BFloatTyID, ///< 16-bit floating point type (7-bit significand)
FloatTyID, ///< 32-bit floating point type
DoubleTyID, ///< 64-bit floating point type
X86_FP80TyID, ///< 80-bit floating point type (X87)
FP128TyID, ///< 128-bit floating point type (112-bit significand)
PPC_FP128TyID, ///< 128-bit floating point type (two 64-bits, PowerPC)
VoidTyID, ///< type with no size
LabelTyID, ///< Labels
MetadataTyID, ///< Metadata
X86_MMXTyID, ///< MMX vectors (64 bits, X86 specific)
TokenTyID, ///< Tokens
// Derived types... see DerivedTypes.h file.
// Make sure FirstDerivedTyID stays up to date!
IntegerTyID, ///< 12: Arbitrary bit width integers
FunctionTyID, ///< 13: Functions
StructTyID, ///< 14: Structures
ArrayTyID, ///< 15: Arrays
PointerTyID, ///< 16: Pointers
FixedVectorTyID, ///< 17: Fixed width SIMD vector type
ScalableVectorTyID ///< 18: Scalable SIMD vector type
IntegerTyID, ///< Arbitrary bit width integers
FunctionTyID, ///< Functions
PointerTyID, ///< Pointers
StructTyID, ///< Structures
ArrayTyID, ///< Arrays
FixedVectorTyID, ///< Fixed width SIMD vector type
ScalableVectorTyID ///< Scalable SIMD vector type
};
private: