Make get_suffix faster by using a switch on getTypeID rather than a series

of comparisons on the various type objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2006-01-19 05:37:27 +00:00
parent 12f2274ba8
commit ff696cc1fc

View File

@ -24,18 +24,15 @@ using namespace llvm;
// Utility function for getting the correct suffix given a type // Utility function for getting the correct suffix given a type
static inline const char* get_suffix(const Type* Ty) { static inline const char* get_suffix(const Type* Ty) {
if (Ty == Type::UIntTy) switch (Ty->getTypeID()) {
return ".i32"; case Type::UIntTyID: return ".i32";
if (Ty == Type::UShortTy) case Type::UShortTyID: return ".i16";
return ".i16"; case Type::UByteTyID: return ".i8";
if (Ty == Type::UByteTy) case Type::ULongTyID: return ".i64";
return ".i8"; case Type::FloatTyID: return ".f32";
if (Ty == Type::ULongTy) case Type::DoubleTyID: return ".f64";
return ".i64"; default: break;
if (Ty == Type::FloatTy) }
return ".f32";
if (Ty == Type::DoubleTy)
return ".f64";
return 0; return 0;
} }