diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-19 06:01:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-19 06:01:12 +0000 |
commit | 1c3673b238c8b016ee1137e39a44e06807e8ec44 (patch) | |
tree | 41fd21b019ccf2961cd8dd04cc49b8b2a905c733 /lib/Bytecode/Reader/Reader.cpp | |
parent | cc33d70a92866e615a0e1d5b97d9cd3e90e99115 (diff) |
Minor speedup to do less linear time searches of information we already have.
speeds up disassembly of kc++ by .6s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 9acb93d48a..4c2ec04141 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/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); |