diff options
author | Craig Topper <craig.topper@gmail.com> | 2012-04-02 06:09:36 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2012-04-02 06:09:36 +0000 |
commit | 17463b3ef1a3d39b10619254f12e806c8c43f9e7 (patch) | |
tree | 35c3631e8b4a3f1abea9c951e930c084128aa915 /tools | |
parent | 1fcbca05db736afc3e555aadc14ae3a5bef59198 (diff) | |
download | external_llvm-17463b3ef1a3d39b10619254f12e806c8c43f9e7.zip external_llvm-17463b3ef1a3d39b10619254f12e806c8c43f9e7.tar.gz external_llvm-17463b3ef1a3d39b10619254f12e806c8c43f9e7.tar.bz2 |
Make MCInstrInfo available to the MCInstPrinter. This will be used to remove getInstructionName and the static data it contains since the same tables are already in MCInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-mc/Disassembler.cpp | 14 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 2 | ||||
-rw-r--r-- | tools/llvm-objdump/MachODump.cpp | 5 | ||||
-rw-r--r-- | tools/llvm-objdump/llvm-objdump.cpp | 9 |
4 files changed, 23 insertions, 7 deletions
diff --git a/tools/llvm-mc/Disassembler.cpp b/tools/llvm-mc/Disassembler.cpp index 6793d7e..a8cd7c1 100644 --- a/tools/llvm-mc/Disassembler.cpp +++ b/tools/llvm-mc/Disassembler.cpp @@ -21,6 +21,7 @@ #include "llvm/MC/MCDisassembler.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstPrinter.h" +#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/ADT/OwningPtr.h" @@ -156,7 +157,8 @@ int Disassembler::disassemble(const Target &T, return -1; } - OwningPtr<const MCSubtargetInfo> STI(T.createMCSubtargetInfo(Triple, Cpu, FeaturesStr)); + OwningPtr<const MCSubtargetInfo> STI(T.createMCSubtargetInfo(Triple, Cpu, + FeaturesStr)); if (!STI) { errs() << "error: no subtarget info for target " << Triple << "\n"; return -1; @@ -174,9 +176,15 @@ int Disassembler::disassemble(const Target &T, return -1; } + OwningPtr<const MCInstrInfo> MII(T.createMCInstrInfo()); + if (!MII) { + errs() << "error: no instruction info for target " << Triple << "\n"; + return -1; + } + int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); - OwningPtr<MCInstPrinter> IP(T.createMCInstPrinter(AsmPrinterVariant, - *AsmInfo, *MRI, *STI)); + OwningPtr<MCInstPrinter> IP(T.createMCInstPrinter(AsmPrinterVariant, *AsmInfo, + *MII, *MRI, *STI)); if (!IP) { errs() << "error: no instruction printer for target " << Triple << '\n'; return -1; diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index ceed2d6..d882e01 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -416,7 +416,7 @@ static int AssembleInput(const char *ProgName) { // FIXME: There is a bit of code duplication with addPassesToEmitFile. if (FileType == OFT_AssemblyFile) { MCInstPrinter *IP = - TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MRI, *STI); + TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI); MCCodeEmitter *CE = 0; MCAsmBackend *MAB = 0; if (ShowEncoding) { diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index b9ea041..0e7f3fd 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -260,8 +260,9 @@ void llvm::DisassembleInputMachO(StringRef Filename) { OwningPtr<const MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI)); OwningPtr<const MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName)); int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); - OwningPtr<MCInstPrinter> IP(TheTarget->createMCInstPrinter( - AsmPrinterVariant, *AsmInfo, *MRI, *STI)); + OwningPtr<MCInstPrinter> + IP(TheTarget->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *InstrInfo, + *MRI, *STI)); if (!InstrAnalysis || !AsmInfo || !STI || !DisAsm || !IP) { errs() << "error: couldn't initialize disassembler for target " diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 387f056..5a6f94a 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -26,6 +26,7 @@ #include "llvm/MC/MCDisassembler.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstPrinter.h" +#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/Casting.h" @@ -254,9 +255,15 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { return; } + OwningPtr<const MCInstrInfo> MII(TheTarget->createMCInstrInfo()); + if (!MII) { + errs() << "error: no instruction info for target " << TripleName << "\n"; + return; + } + int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); OwningPtr<MCInstPrinter> IP(TheTarget->createMCInstPrinter( - AsmPrinterVariant, *AsmInfo, *MRI, *STI)); + AsmPrinterVariant, *AsmInfo, *MII, *MRI, *STI)); if (!IP) { errs() << "error: no instruction printer for target " << TripleName << '\n'; |