From 24d02ee1411131bc01c918ffe934e1b1a23f6a66 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sat, 8 Oct 2016 00:50:11 +0000 Subject: [PATCH] [AVR] Set up the instruction printer and the assembly backend llvm-svn: 283629 --- .../AVR/MCTargetDesc/AVRMCTargetDesc.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp index a8ca6b31ec9d..96736c2aa22f 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp @@ -15,6 +15,7 @@ #include "AVRMCAsmInfo.h" #include "AVRMCTargetDesc.h" #include "AVRTargetStreamer.h" +#include "InstPrinter/AVRInstPrinter.h" #include "llvm/MC/MCELFStreamer.h" #include "llvm/MC/MCInstrInfo.h" @@ -52,6 +53,18 @@ static MCSubtargetInfo *createAVRMCSubtargetInfo(const Triple &TT, return createAVRMCSubtargetInfoImpl(TT, CPU, FS); } +static MCInstPrinter *createAVRMCInstPrinter(const Triple &T, + unsigned SyntaxVariant, + const MCAsmInfo &MAI, + const MCInstrInfo &MII, + const MCRegisterInfo &MRI) { + if (SyntaxVariant == 0) { + return new AVRInstPrinter(MAI, MII, MRI); + } + + return nullptr; +} + static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll) { @@ -84,6 +97,9 @@ extern "C" void LLVMInitializeAVRTargetMC() { TargetRegistry::RegisterMCSubtargetInfo(TheAVRTarget, createAVRMCSubtargetInfo); + // Register the MCInstPrinter. + TargetRegistry::RegisterMCInstPrinter(TheAVRTarget, createAVRMCInstPrinter); + // Register the ELF streamer TargetRegistry::RegisterELFStreamer(TheAVRTarget, createMCStreamer); @@ -94,5 +110,8 @@ extern "C" void LLVMInitializeAVRTargetMC() { // Register the asm target streamer. TargetRegistry::RegisterAsmTargetStreamer(TheAVRTarget, createMCAsmTargetStreamer); + + // Register the asm backend (as little endian). + TargetRegistry::RegisterMCAsmBackend(TheAVRTarget, createAVRAsmBackend); }