summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-06-26 19:40:40 +0000
committerChris Lattner <sabre@nondot.org>2004-06-26 19:40:40 +0000
commit80d2d53fbf975b1d1beb26381371b078638a8d7c (patch)
tree8d9e3811afc833915cf3fb1ccca0fea01880f289 /llvm
parent6fb22cd7ef90f37bac218939fb66dba64bee0007 (diff)
downloadbcm5719-llvm-80d2d53fbf975b1d1beb26381371b078638a8d7c.tar.gz
bcm5719-llvm-80d2d53fbf975b1d1beb26381371b078638a8d7c.zip
Don't call getValueType directly. the LLVM optimizer will turn it into the same code anyway :)
llvm-svn: 14426
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/AsmWriter.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index 3ad9ecc098a..60589ba7f10 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -1163,16 +1163,18 @@ CachedWriter::~CachedWriter() {
CachedWriter &CachedWriter::operator<<(const Value *V) {
assert(AW && SC && "CachedWriter does not have a current module!");
- switch (V->getValueType()) {
- case Value::ConstantVal:
- case Value::ArgumentVal: AW->writeOperand(V, true, true); break;
- case Value::TypeVal: AW->write(cast<Type>(V)); break;
- case Value::InstructionVal: AW->write(cast<Instruction>(V)); break;
- case Value::BasicBlockVal: AW->write(cast<BasicBlock>(V)); break;
- case Value::FunctionVal: AW->write(cast<Function>(V)); break;
- case Value::GlobalVariableVal: AW->write(cast<GlobalVariable>(V)); break;
- default: Out << "<unknown value type: " << V->getValueType() << '>'; break;
- }
+ if (const Instruction *I = dyn_cast<Instruction>(V))
+ AW->write(I);
+ else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V))
+ AW->write(BB);
+ else if (const Function *F = dyn_cast<Function>(V))
+ AW->write(F);
+ else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
+ AW->write(GV);
+ else if (const Type *Ty = dyn_cast<Type>(V))
+ AW->write(Ty);
+ else
+ AW->writeOperand(V, true, true);
return *this;
}
OpenPOWER on IntegriCloud