diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-13 01:10:38 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-13 01:10:38 +0000 |
commit | c7363f1147f8d06c34683480b0cb7e24a395a534 (patch) | |
tree | 36c922c207681823fdc444373a8004260fb25cc8 /llvm/lib/Bitcode/Writer | |
parent | 193a4fdafd9d4d4d6bbb7a1885fb30427434fe97 (diff) | |
download | bcm5719-llvm-c7363f1147f8d06c34683480b0cb7e24a395a534.tar.gz bcm5719-llvm-c7363f1147f8d06c34683480b0cb7e24a395a534.zip |
AsmWriter/Bitcode: MDSubrange
llvm-svn: 229003
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 1c2424ce11b..3d1e82d8f8c 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -809,11 +809,23 @@ static void WriteGenericDebugNode(const GenericDebugNode *N, Record.clear(); } -static void WriteMDSubrange(const MDSubrange *, const ValueEnumerator &, - BitstreamWriter &, SmallVectorImpl<uint64_t> &, - unsigned) { - llvm_unreachable("write not implemented"); +static uint64_t rotateSign(int64_t I) { + uint64_t U = I; + return I < 0 ? ~(U << 1) : U << 1; +} + +static void WriteMDSubrange(const MDSubrange *N, const ValueEnumerator &, + BitstreamWriter &Stream, + SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev) { + Record.push_back(N->isDistinct()); + Record.push_back(N->getCount()); + Record.push_back(rotateSign(N->getLo())); + + Stream.EmitRecord(bitc::METADATA_SUBRANGE, Record, Abbrev); + Record.clear(); } + static void WriteMDEnumerator(const MDEnumerator *, const ValueEnumerator &, BitstreamWriter &, SmallVectorImpl<uint64_t> &, unsigned) { |