summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-19 06:01:12 +0000
committerChris Lattner <sabre@nondot.org>2003-11-19 06:01:12 +0000
commitffa9d511f9df70838a77777de6b192554973ae22 (patch)
tree7daae64084ccb812cab4f2cab3e603e6244116bb /llvm/lib/Bytecode/Reader/Reader.cpp
parent2335331635ab66c823444b77271e1ebbbd7d3008 (diff)
downloadbcm5719-llvm-ffa9d511f9df70838a77777de6b192554973ae22.tar.gz
bcm5719-llvm-ffa9d511f9df70838a77777de6b192554973ae22.zip
Minor speedup to do less linear time searches of information we already have.
speeds up disassembly of kc++ by .6s llvm-svn: 10079
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 9acb93d48a6..4c2ec041418 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -172,13 +172,14 @@ BasicBlock *BytecodeParser::getBasicBlock(unsigned ID) {
/// constant hasn't been parsed yet, a placeholder is defined and used. Later,
/// after the real value is parsed, the placeholder is eliminated.
///
-Constant *BytecodeParser::getConstantValue(const Type *Ty, unsigned Slot) {
- if (Value *V = getValue(Ty, Slot, false))
+Constant *BytecodeParser::getConstantValue(unsigned TypeSlot, unsigned Slot) {
+ if (Value *V = getValue(TypeSlot, Slot, false))
if (Constant *C = dyn_cast<Constant>(V))
return C; // If we already have the value parsed, just return it
else
throw std::string("Reference of a value is expected to be a constant!");
+ const Type *Ty = getType(TypeSlot);
std::pair<const Type*, unsigned> Key(Ty, Slot);
GlobalRefsType::iterator I = GlobalRefs.lower_bound(Key);
OpenPOWER on IntegriCloud