diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-01-19 05:37:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-01-19 05:37:27 +0000 |
commit | ff696cc1fca94be3ace7de2eb3b9e52734149161 (patch) | |
tree | d579a8768c39f529bf66876db9a895a7208e8f28 | |
parent | 12f2274ba8c6af21e8b6c71ef872afe43a64b6d7 (diff) | |
download | external_llvm-ff696cc1fca94be3ace7de2eb3b9e52734149161.zip external_llvm-ff696cc1fca94be3ace7de2eb3b9e52734149161.tar.gz external_llvm-ff696cc1fca94be3ace7de2eb3b9e52734149161.tar.bz2 |
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
-rw-r--r-- | lib/VMCore/AutoUpgrade.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index 3db04cf..8107d8a 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -24,18 +24,15 @@ using namespace llvm; // Utility function for getting the correct suffix given a type static inline const char* get_suffix(const Type* Ty) { - if (Ty == Type::UIntTy) - return ".i32"; - if (Ty == Type::UShortTy) - return ".i16"; - if (Ty == Type::UByteTy) - return ".i8"; - if (Ty == Type::ULongTy) - return ".i64"; - if (Ty == Type::FloatTy) - return ".f32"; - if (Ty == Type::DoubleTy) - return ".f64"; + switch (Ty->getTypeID()) { + case Type::UIntTyID: return ".i32"; + case Type::UShortTyID: return ".i16"; + case Type::UByteTyID: return ".i8"; + case Type::ULongTyID: return ".i64"; + case Type::FloatTyID: return ".f32"; + case Type::DoubleTyID: return ".f64"; + default: break; + } return 0; } |