Separate MCInstPrinter registration from AsmPrinter registration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2011-07-25 21:20:24 +00:00
parent fd47a59661
commit 4b64e8a9e1
16 changed files with 81 additions and 77 deletions

View File

@@ -316,18 +316,7 @@ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const {
return I == Pred->end() || !I->getDesc().isBarrier();
}
static MCInstPrinter *createMBlazeMCInstPrinter(const Target &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI) {
if (SyntaxVariant == 0)
return new MBlazeInstPrinter(MAI);
return 0;
}
// Force static initialization.
extern "C" void LLVMInitializeMBlazeAsmPrinter() {
RegisterAsmPrinter<MBlazeAsmPrinter> X(TheMBlazeTarget);
TargetRegistry::RegisterMCInstPrinter(TheMBlazeTarget,
createMBlazeMCInstPrinter);
}

View File

@@ -13,6 +13,7 @@
#include "MBlazeMCTargetDesc.h"
#include "MBlazeMCAsmInfo.h"
#include "InstPrinter/MBlazeInstPrinter.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCStreamer.h"
@@ -91,6 +92,14 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll, NoExecStack);
}
static MCInstPrinter *createMBlazeMCInstPrinter(const Target &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI) {
if (SyntaxVariant == 0)
return new MBlazeInstPrinter(MAI);
return 0;
}
// Force static initialization.
extern "C" void LLVMInitializeMBlazeTargetMC() {
// Register the MC asm info.
@@ -122,4 +131,8 @@ extern "C" void LLVMInitializeMBlazeTargetMC() {
// Register the object streamer
TargetRegistry::RegisterObjectStreamer(TheMBlazeTarget,
createMCStreamer);
// Register the MCInstPrinter.
TargetRegistry::RegisterMCInstPrinter(TheMBlazeTarget,
createMBlazeMCInstPrinter);
}