[llvm] r283629 - [AVR] Set up the instruction printer and the assembly backend
Dylan McKay via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 7 17:50:11 PDT 2016
Author: dylanmckay
Date: Fri Oct 7 19:50:11 2016
New Revision: 283629
URL: http://llvm.org/viewvc/llvm-project?rev=283629&view=rev
Log:
[AVR] Set up the instruction printer and the assembly backend
Modified:
llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp
Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp?rev=283629&r1=283628&r2=283629&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp Fri Oct 7 19:50:11 2016
@@ -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 *createAVRMCSubta
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 LLVMInitializeAVRTargetM
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 LLVMInitializeAVRTargetM
// Register the asm target streamer.
TargetRegistry::RegisterAsmTargetStreamer(TheAVRTarget,
createMCAsmTargetStreamer);
+
+ // Register the asm backend (as little endian).
+ TargetRegistry::RegisterMCAsmBackend(TheAVRTarget, createAVRAsmBackend);
}
More information about the llvm-commits
mailing list