aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/ELFWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-05 05:54:46 +0000
committerChris Lattner <sabre@nondot.org>2009-10-05 05:54:46 +0000
commitcf0fe8d813727383d630055bb9d1cde21b00b7e7 (patch)
tree4ed7b0bdfe761ae52997a152437d00ddaae10360 /lib/CodeGen/ELFWriter.cpp
parent5f7962c1b6574e6d834925158886d7c0a1bab5dc (diff)
strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a pointer comparison. Besides being cheaper, this allows a smart compiler to turn the if sequence into a switch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ELFWriter.cpp')
-rw-r--r--lib/CodeGen/ELFWriter.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp
index 55a2f70064..3e1ee11b21 100644
--- a/lib/CodeGen/ELFWriter.cpp
+++ b/lib/CodeGen/ELFWriter.cpp
@@ -457,16 +457,15 @@ void ELFWriter::EmitGlobalConstant(const Constant *CV, ELFSection &GblS) {
return;
} else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
APInt Val = CFP->getValueAPF().bitcastToAPInt();
- if (CFP->getType() == Type::getDoubleTy(CV->getContext()))
+ if (CFP->getType()->isDoubleTy())
GblS.emitWord64(Val.getZExtValue());
- else if (CFP->getType() == Type::getFloatTy(CV->getContext()))
+ else if (CFP->getType()->isFloatTy())
GblS.emitWord32(Val.getZExtValue());
- else if (CFP->getType() == Type::getX86_FP80Ty(CV->getContext())) {
- unsigned PadSize =
- TD->getTypeAllocSize(Type::getX86_FP80Ty(CV->getContext()))-
- TD->getTypeStoreSize(Type::getX86_FP80Ty(CV->getContext()));
+ else if (CFP->getType()->isX86_FP80Ty()) {
+ unsigned PadSize = TD->getTypeAllocSize(CFP->getType())-
+ TD->getTypeStoreSize(CFP->getType());
GblS.emitWordFP80(Val.getRawData(), PadSize);
- } else if (CFP->getType() == Type::getPPC_FP128Ty(CV->getContext()))
+ } else if (CFP->getType()->isPPC_FP128Ty())
llvm_unreachable("PPC_FP128Ty global emission not implemented");
return;
} else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {