diff options
author | Lang Hames <lhames@gmail.com> | 2014-04-15 04:40:56 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2014-04-15 04:40:56 +0000 |
commit | 508bd630466f9625ba07a3f601435e1ff824b768 (patch) | |
tree | 4d9ba7c2f255580b8a25ad0a19db9616e7f4fd62 /include/llvm/MC/MCDisassembler.h | |
parent | 88f353252d6130469d5854efb37659d3ba015c02 (diff) | |
download | llvm-508bd630466f9625ba07a3f601435e1ff824b768.tar.gz llvm-508bd630466f9625ba07a3f601435e1ff824b768.tar.bz2 llvm-508bd630466f9625ba07a3f601435e1ff824b768.tar.xz |
[MC] Require an MCContext when constructing an MCDisassembler.
This patch re-introduces the MCContext member that was removed from
MCDisassembler in r206063, and requires that an MCContext be passed in at
MCDisassembler construction time. (Previously the MCContext member had been
initialized in an ad-hoc fashion after construction). The MCCContext member
can be used by MCDisassembler sub-classes to construct constant or
target-specific MCExprs.
This patch updates disassemblers for in-tree targets, and provides the
MCRegisterInfo instance that some disassemblers were using through the
MCContext (previously those backends were constructing their own
MCRegisterInfo instances).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCDisassembler.h')
-rw-r--r-- | include/llvm/MC/MCDisassembler.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/MC/MCDisassembler.h b/include/llvm/MC/MCDisassembler.h index 7c5d160caf..169304ebd6 100644 --- a/include/llvm/MC/MCDisassembler.h +++ b/include/llvm/MC/MCDisassembler.h @@ -56,8 +56,8 @@ public: }; /// Constructor - Performs initial setup for the disassembler. - MCDisassembler(const MCSubtargetInfo &STI) - : STI(STI), Symbolizer(), CommentStream(nullptr) {} + MCDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx) + : Ctx(Ctx), STI(STI), Symbolizer(), CommentStream(nullptr) {} virtual ~MCDisassembler(); @@ -83,6 +83,8 @@ public: uint64_t address, raw_ostream &vStream, raw_ostream &cStream) const = 0; +private: + MCContext &Ctx; protected: // Subtarget information, for instruction decoding predicates if required. @@ -102,6 +104,8 @@ public: /// This takes ownership of \p Symzer, and deletes the previously set one. void setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer); + MCContext& getContext() const { return Ctx; } + const MCSubtargetInfo& getSubtargetInfo() const { return STI; } // Marked mutable because we cache it inside the disassembler, rather than |