diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-06-20 14:18:48 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-06-20 14:18:48 +0000 |
commit | 372ad64b4db770404805a5ca88ab9d78bea3c386 (patch) | |
tree | c2e5ffa958e080d5f5542dde76d47c728cab2ec5 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 5c54d75763d0a21d2b8e45ce1cd9b3f201164112 (diff) | |
download | bcm5719-llvm-372ad64b4db770404805a5ca88ab9d78bea3c386.tar.gz bcm5719-llvm-372ad64b4db770404805a5ca88ab9d78bea3c386.zip |
Make better use of the PHINode API.
Change various bits of code to make better use of the existing PHINode
API, to insulate them from forthcoming changes in how PHINodes store
their operands.
llvm-svn: 133434
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index ed006f0fc87..24b5e2d52a8 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1079,12 +1079,16 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, AbbrevToUse = FUNCTION_INST_UNREACHABLE_ABBREV; break; - case Instruction::PHI: + case Instruction::PHI: { + const PHINode &PN = cast<PHINode>(I); Code = bitc::FUNC_CODE_INST_PHI; - Vals.push_back(VE.getTypeID(I.getType())); - for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) - Vals.push_back(VE.getValueID(I.getOperand(i))); + Vals.push_back(VE.getTypeID(PN.getType())); + for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) { + Vals.push_back(VE.getValueID(PN.getIncomingValue(i))); + Vals.push_back(VE.getValueID(PN.getIncomingBlock(i))); + } break; + } case Instruction::Alloca: Code = bitc::FUNC_CODE_INST_ALLOCA; |