diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-03-02 22:02:33 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-03-02 22:02:33 +0000 |
commit | 92da14b24402ece7602f4ee5d283e8baad7959c5 (patch) | |
tree | 0b7cc3d94029975c102a4f511e96149b45e46f53 /llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h | |
parent | 446a0d1329b7621f41d229c7108962d7b554db37 (diff) | |
download | bcm5719-llvm-92da14b24402ece7602f4ee5d283e8baad7959c5.tar.gz bcm5719-llvm-92da14b24402ece7602f4ee5d283e8baad7959c5.zip |
Refactor DebugLocDWARFExpression so it doesn't require access to the
TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes
of the pre-calculated DWARF expression.
Ought to be NFC, but it does slightly alter the output format of the
textual assembly.
This reapplies 230930 without the assertion in DebugLocEntry::finalize()
because not all Machine registers can be lowered into DWARF register
numbers and floating point constants cannot be expressed.
llvm-svn: 231023
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h b/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h index 42be1149e97..179a4d49582 100644 --- a/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h +++ b/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h @@ -19,6 +19,8 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/Support/LEB128.h" +#include <string> namespace llvm { class ByteStreamer { @@ -66,6 +68,33 @@ class HashingByteStreamer : public ByteStreamer { Hash.addULEB128(DWord); } }; + +class BufferByteStreamer : public ByteStreamer { +private: + SmallVectorImpl<char> &Buffer; + // FIXME: This is actually only needed for textual asm output. + SmallVectorImpl<std::string> &Comments; + +public: + BufferByteStreamer(SmallVectorImpl<char> &Buffer, + SmallVectorImpl<std::string> &Comments) + : Buffer(Buffer), Comments(Comments) {} + void EmitInt8(uint8_t Byte, const Twine &Comment) override { + Buffer.push_back(Byte); + Comments.push_back(Comment.str()); + } + void EmitSLEB128(uint64_t DWord, const Twine &Comment) override { + raw_svector_ostream OSE(Buffer); + encodeSLEB128(DWord, OSE); + Comments.push_back(Comment.str()); + } + void EmitULEB128(uint64_t DWord, const Twine &Comment) override { + raw_svector_ostream OSE(Buffer); + encodeULEB128(DWord, OSE); + Comments.push_back(Comment.str()); + } +}; + } #endif |