[llvm-commits] CVS: llvm/lib/VMCore/AutoUpgrade.cpp
Reid Spencer
reid at x10sys.com
Wed Jan 18 21:37:39 PST 2006
Changes in directory llvm/lib/VMCore:
AutoUpgrade.cpp updated: 1.2 -> 1.3
---
Log message:
Make get_suffix faster by using a switch on getTypeID rather than a series
of comparisons on the various type objects.
---
Diffs of the changes: (+9 -12)
AutoUpgrade.cpp | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
Index: llvm/lib/VMCore/AutoUpgrade.cpp
diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.2 llvm/lib/VMCore/AutoUpgrade.cpp:1.3
--- llvm/lib/VMCore/AutoUpgrade.cpp:1.2 Wed Jan 18 19:18:29 2006
+++ llvm/lib/VMCore/AutoUpgrade.cpp Wed Jan 18 23:37:27 2006
@@ -24,18 +24,15 @@
// 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;
}
More information about the llvm-commits
mailing list