diff options
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h')
-rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h index 641f8cf7af2..58863be9cc2 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h @@ -15,8 +15,10 @@ #ifndef MIPSELFSTREAMER_H #define MIPSELFSTREAMER_H +#include "MipsOptionRecord.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCELFStreamer.h" -#include "llvm/Support/raw_ostream.h" +#include <memory> namespace llvm { class MCAsmBackend; @@ -25,13 +27,27 @@ class MCContext; class MCSubtargetInfo; class MipsELFStreamer : public MCELFStreamer { + SmallVector<std::unique_ptr<MipsOptionRecord>, 8> MipsOptionRecords; + MipsRegInfoRecord *RegInfoRecord; public: MipsELFStreamer(MCContext &Context, MCAsmBackend &MAB, raw_ostream &OS, MCCodeEmitter *Emitter, const MCSubtargetInfo &STI) - : MCELFStreamer(Context, MAB, OS, Emitter) {} + : MCELFStreamer(Context, MAB, OS, Emitter) { - virtual ~MipsELFStreamer() {} + RegInfoRecord = new MipsRegInfoRecord(this, Context, STI); + MipsOptionRecords.push_back( + std::unique_ptr<MipsRegInfoRecord>(RegInfoRecord)); + } + + /// Overriding this function allows us to add arbitrary behaviour before the + /// \p Inst is actually emitted. For example, we can inspect the operands and + /// gather sufficient information that allows us to reason about the register + /// usage for the translation unit. + void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override; + + /// Emits all the option records stored up until the point it's called. + void EmitMipsOptionRecords(); }; MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB, |