aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCStreamer.cpp')
-rw-r--r--lib/MC/MCStreamer.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp
index 3e9d02ea5a..54071eba46 100644
--- a/lib/MC/MCStreamer.cpp
+++ b/lib/MC/MCStreamer.cpp
@@ -9,6 +9,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCObjectWriter.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
@@ -35,6 +36,24 @@ void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size,
EmitValue(MCConstantExpr::Create(Value, getContext()), Size, AddrSpace);
}
+// EmitULEB128Value - Special case of EmitValue that emits a ULEB128 of the
+// Value as the sequence of ULEB128 encoded bytes.
+void MCStreamer::EmitULEB128Value(uint64_t Value, unsigned AddrSpace) {
+ SmallString<32> Tmp;
+ raw_svector_ostream OS(Tmp);
+ MCObjectWriter::EncodeULEB128(Value, OS);
+ EmitBytes(OS.str(), AddrSpace);
+}
+
+// EmitSLEB128Value - Special case of EmitValue that emits a SLEB128 of the
+// Value as the sequence of ULEB128 encoded bytes.
+void MCStreamer::EmitSLEB128Value(int64_t Value, unsigned AddrSpace) {
+ SmallString<32> Tmp;
+ raw_svector_ostream OS(Tmp);
+ MCObjectWriter::EncodeSLEB128(Value, OS);
+ EmitBytes(OS.str(), AddrSpace);
+}
+
void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
unsigned AddrSpace) {
EmitValue(MCSymbolRefExpr::Create(Sym, getContext()), Size, AddrSpace);