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 /lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp | |
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 'lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp')
-rw-r--r-- | lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp b/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp index 9bd363a4a2..a5e923f4ce 100644 --- a/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp +++ b/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp @@ -38,12 +38,11 @@ typedef MCDisassembler::DecodeStatus DecodeStatus; namespace { /// AArch64 disassembler for all AArch64 platforms. class AArch64Disassembler : public MCDisassembler { - OwningPtr<const MCRegisterInfo> RegInfo; public: /// Initializes the disassembler. /// - AArch64Disassembler(const MCSubtargetInfo &STI, const MCRegisterInfo *Info) - : MCDisassembler(STI), RegInfo(Info) { + AArch64Disassembler(const MCSubtargetInfo &STI, MCContext &Ctx) + : MCDisassembler(STI, Ctx) { } ~AArch64Disassembler() {} @@ -55,8 +54,6 @@ public: uint64_t address, raw_ostream &vStream, raw_ostream &cStream) const; - - const MCRegisterInfo *getRegInfo() const { return RegInfo.get(); } }; } @@ -297,7 +294,8 @@ DecodeStatus AArch64Disassembler::getInstruction(MCInst &MI, uint64_t &Size, static unsigned getReg(const void *D, unsigned RC, unsigned RegNo) { const AArch64Disassembler *Dis = static_cast<const AArch64Disassembler*>(D); - return Dis->getRegInfo()->getRegClass(RC).getRegister(RegNo); + const MCRegisterInfo *RegInfo = Dis->getContext().getRegisterInfo(); + return RegInfo->getRegClass(RC).getRegister(RegNo); } static DecodeStatus DecodeGPR64RegisterClass(llvm::MCInst &Inst, unsigned RegNo, @@ -991,8 +989,9 @@ static DecodeStatus DecodeSingleIndexedInstruction(llvm::MCInst &Inst, } static MCDisassembler *createAArch64Disassembler(const Target &T, - const MCSubtargetInfo &STI) { - return new AArch64Disassembler(STI, T.createMCRegInfo("")); + const MCSubtargetInfo &STI, + MCContext &Ctx) { + return new AArch64Disassembler(STI, Ctx); } extern "C" void LLVMInitializeAArch64Disassembler() { |