summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/include/llvm/CodeGen/DIE.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/include/llvm/CodeGen/DIE.h')
-rw-r--r--contrib/llvm/include/llvm/CodeGen/DIE.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/llvm/include/llvm/CodeGen/DIE.h b/contrib/llvm/include/llvm/CodeGen/DIE.h
index fa612d9..72b3adc 100644
--- a/contrib/llvm/include/llvm/CodeGen/DIE.h
+++ b/contrib/llvm/include/llvm/CodeGen/DIE.h
@@ -29,6 +29,48 @@ class MCSymbol;
class raw_ostream;
class DwarfTypeUnit;
+// AsmStreamerBase - A base abstract interface class defines methods that
+// can be implemented to stream objects or can be implemented to
+// calculate the size of the streamed objects.
+// The derived classes will use an AsmPrinter to implement the methods.
+//
+// TODO: complete this interface and use it to merge EmitValue and SizeOf
+// methods in the DIE classes below.
+class AsmStreamerBase {
+protected:
+ const AsmPrinter *AP;
+ AsmStreamerBase(const AsmPrinter *AP) : AP(AP) {}
+
+public:
+ virtual ~AsmStreamerBase() {}
+ virtual unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr,
+ unsigned PadTo = 0) = 0;
+ virtual unsigned emitInt8(unsigned char Value) = 0;
+ virtual unsigned emitBytes(StringRef Data) = 0;
+};
+
+/// EmittingAsmStreamer - Implements AbstractAsmStreamer to stream objects.
+/// Notice that the return value is not the actual size of the streamed object.
+/// For size calculation use SizeReporterAsmStreamer.
+class EmittingAsmStreamer : public AsmStreamerBase {
+public:
+ EmittingAsmStreamer(const AsmPrinter *AP) : AsmStreamerBase(AP) {}
+ unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr,
+ unsigned PadTo = 0) override;
+ unsigned emitInt8(unsigned char Value) override;
+ unsigned emitBytes(StringRef Data) override;
+};
+
+/// SizeReporterAsmStreamer - Only reports the size of the streamed objects.
+class SizeReporterAsmStreamer : public AsmStreamerBase {
+public:
+ SizeReporterAsmStreamer(const AsmPrinter *AP) : AsmStreamerBase(AP) {}
+ unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr,
+ unsigned PadTo = 0) override;
+ unsigned emitInt8(unsigned char Value) override;
+ unsigned emitBytes(StringRef Data) override;
+};
+
//===--------------------------------------------------------------------===//
/// DIEAbbrevData - Dwarf abbreviation data, describes one attribute of a
/// Dwarf abbreviation.
OpenPOWER on IntegriCloud