[llvm] r282597 - [AVR] Add AVRMCTargetDesc.cpp
Dylan McKay via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 28 08:31:13 PDT 2016
Author: dylanmckay
Date: Wed Sep 28 10:31:12 2016
New Revision: 282597
URL: http://llvm.org/viewvc/llvm-project?rev=282597&view=rev
Log:
[AVR] Add AVRMCTargetDesc.cpp
Summary:
This adds the AVRMCTargetDesc file in tree. It allows creation of the
core classes used in the backend.
Reviewers: arsenm, kparzysz
Subscribers: wdng, beanz, mgorny
Differential Revision: https://reviews.llvm.org/D25023
Added:
llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp
Modified:
llvm/trunk/lib/Target/AVR/MCTargetDesc/CMakeLists.txt
llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
Added: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp?rev=282597&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp (added)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp Wed Sep 28 10:31:12 2016
@@ -0,0 +1,96 @@
+//===-- AVRMCTargetDesc.cpp - AVR Target Descriptions ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides AVR specific target descriptions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "AVRELFStreamer.h"
+#include "AVRMCAsmInfo.h"
+#include "AVRMCTargetDesc.h"
+#include "AVRTargetStreamer.h"
+
+#include "llvm/MC/MCELFStreamer.h"
+#include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/Support/TargetRegistry.h"
+
+#define GET_INSTRINFO_MC_DESC
+#include "AVRGenInstrInfo.inc"
+
+#define GET_SUBTARGETINFO_MC_DESC
+#include "AVRGenSubtargetInfo.inc"
+
+#define GET_REGINFO_MC_DESC
+#include "AVRGenRegisterInfo.inc"
+
+static MCInstrInfo *createAVRMCInstrInfo() {
+ MCInstrInfo *X = new MCInstrInfo();
+ InitAVRMCInstrInfo(X);
+
+ return X;
+}
+
+static MCRegisterInfo *createAVRMCRegisterInfo(const Triple &TT) {
+ MCRegisterInfo *X = new MCRegisterInfo();
+ InitAVRMCRegisterInfo(X, 0);
+
+ return X;
+}
+
+static MCSubtargetInfo *createAVRMCSubtargetInfo(const Triple &TT,
+ StringRef CPU, StringRef FS) {
+ return createAVRMCSubtargetInfoImpl(TT, CPU, FS);
+}
+
+static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
+ MCAsmBackend &MAB, raw_pwrite_stream &OS,
+ MCCodeEmitter *Emitter, bool RelaxAll) {
+ return createELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
+}
+
+static MCTargetStreamer *
+createAVRObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI) {
+ return new AVRELFStreamer(S, STI);
+}
+
+static MCTargetStreamer *createMCAsmTargetStreamer(MCStreamer &S,
+ formatted_raw_ostream &OS,
+ MCInstPrinter *InstPrint,
+ bool isVerboseAsm) {
+ return new AVRTargetAsmStreamer(S);
+}
+
+extern "C" void LLVMInitializeAVRTargetMC() {
+ // Register the MC asm info.
+ RegisterMCAsmInfo<AVRMCAsmInfo> X(TheAVRTarget);
+
+ // Register the MC instruction info.
+ TargetRegistry::RegisterMCInstrInfo(TheAVRTarget, createAVRMCInstrInfo);
+
+ // Register the MC register info.
+ TargetRegistry::RegisterMCRegInfo(TheAVRTarget, createAVRMCRegisterInfo);
+
+ // Register the MC subtarget info.
+ TargetRegistry::RegisterMCSubtargetInfo(TheAVRTarget,
+ createAVRMCSubtargetInfo);
+
+ // Register the ELF streamer
+ TargetRegistry::RegisterELFStreamer(TheAVRTarget, createMCStreamer);
+
+ // Register the obj target streamer.
+ TargetRegistry::RegisterObjectTargetStreamer(TheAVRTarget,
+ createAVRObjectTargetStreamer);
+
+ // Register the asm target streamer.
+ TargetRegistry::RegisterAsmTargetStreamer(TheAVRTarget,
+ createMCAsmTargetStreamer);
+}
+
Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/CMakeLists.txt?rev=282597&r1=282596&r2=282597&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/CMakeLists.txt (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/CMakeLists.txt Wed Sep 28 10:31:12 2016
@@ -2,6 +2,7 @@ add_llvm_library(LLVMAVRDesc
AVRELFStreamer.cpp
AVRMCAsmInfo.cpp
AVRMCExpr.cpp
+ AVRMCTargetDesc.cpp
AVRTargetStreamer.cpp
)
Modified: llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp?rev=282597&r1=282596&r2=282597&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp (original)
+++ llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp Wed Sep 28 10:31:12 2016
@@ -19,7 +19,3 @@ extern "C" void LLVMInitializeAVRTargetI
llvm::TheAVRTarget, "avr", "Atmel AVR Microcontroller");
}
-// FIXME: Temporary stub - this function must be defined for linking
-// to succeed. Remove once this function is properly implemented.
-extern "C" void LLVMInitializeAVRTargetMC() {
-}
More information about the llvm-commits
mailing list