diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-28 05:24:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-28 05:24:40 +0000 |
commit | f540d74b58539cfcb9b1ad1e340ba4c50d0fca2a (patch) | |
tree | 1b6a6322bc95dd201d5e8484d349179da9b0855a /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | a91a56353086b8cd70ace87a4e290ac278ff345b (diff) | |
download | llvm-f540d74b58539cfcb9b1ad1e340ba4c50d0fca2a.zip llvm-f540d74b58539cfcb9b1ad1e340ba4c50d0fca2a.tar.gz llvm-f540d74b58539cfcb9b1ad1e340ba4c50d0fca2a.tar.bz2 |
bitcode writer support for blockaddress.
llvm-svn: 85376
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 98f782f..af0b8ac 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -853,6 +853,13 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Record.push_back(CE->getPredicate()); break; } + } else if (const BlockAddress *BA = dyn_cast<BlockAddress>(C)) { + assert(BA->getFunction() == BA->getBasicBlock()->getParent() && + "Malformed blockaddress"); + Code = bitc::CST_CODE_BLOCKADDRESS; + Record.push_back(VE.getTypeID(BA->getFunction()->getType())); + Record.push_back(VE.getValueID(BA->getFunction())); + Record.push_back(VE.getGlobalBasicBlockID(BA->getBasicBlock())); } else { llvm_unreachable("Unknown constant!"); } |