diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-25 21:20:24 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-25 21:20:24 +0000 |
commit | 4b64e8a9e13ba782da2034e1dee52f077bdb759c (patch) | |
tree | d634b1311e0c847d61245cfb05e25c50ec334090 /lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp | |
parent | fd47a5966141e32db461a9a96597920d5fd46498 (diff) |
Separate MCInstPrinter registration from AsmPrinter registration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135974 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp')
-rw-r--r-- | lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp index 129c3c91b3..507f696f9b 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp @@ -13,6 +13,8 @@ #include "X86MCTargetDesc.h" #include "X86MCAsmInfo.h" +#include "InstPrinter/X86ATTInstPrinter.h" +#include "InstPrinter/X86IntelInstPrinter.h" #include "llvm/MC/MachineLocation.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" @@ -381,6 +383,16 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll, NoExecStack); } +static MCInstPrinter *createX86MCInstPrinter(const Target &T, + unsigned SyntaxVariant, + const MCAsmInfo &MAI) { + if (SyntaxVariant == 0) + return new X86ATTInstPrinter(MAI); + if (SyntaxVariant == 1) + return new X86IntelInstPrinter(MAI); + return 0; +} + // Force static initialization. extern "C" void LLVMInitializeX86TargetMC() { // Register the MC asm info. @@ -422,4 +434,10 @@ extern "C" void LLVMInitializeX86TargetMC() { createMCStreamer); TargetRegistry::RegisterObjectStreamer(TheX86_64Target, createMCStreamer); + + // Register the MCInstPrinter. + TargetRegistry::RegisterMCInstPrinter(TheX86_32Target, + createX86MCInstPrinter); + TargetRegistry::RegisterMCInstPrinter(TheX86_64Target, + createX86MCInstPrinter); } |