LLVM  8.0.0svn
AVRMCTargetDesc.cpp
Go to the documentation of this file.
1 //===-- AVRMCTargetDesc.cpp - AVR Target Descriptions ---------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides AVR specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "AVRELFStreamer.h"
15 #include "AVRMCAsmInfo.h"
16 #include "AVRMCELFStreamer.h"
17 #include "AVRMCTargetDesc.h"
18 #include "AVRTargetStreamer.h"
20 
21 #include "llvm/MC/MCAsmBackend.h"
22 #include "llvm/MC/MCELFStreamer.h"
23 #include "llvm/MC/MCCodeEmitter.h"
24 #include "llvm/MC/MCInstrInfo.h"
25 #include "llvm/MC/MCRegisterInfo.h"
28 
29 #define GET_INSTRINFO_MC_DESC
30 #include "AVRGenInstrInfo.inc"
31 
32 #define GET_SUBTARGETINFO_MC_DESC
33 #include "AVRGenSubtargetInfo.inc"
34 
35 #define GET_REGINFO_MC_DESC
36 #include "AVRGenRegisterInfo.inc"
37 
38 using namespace llvm;
39 
41  MCInstrInfo *X = new MCInstrInfo();
42  InitAVRMCInstrInfo(X);
43 
44  return X;
45 }
46 
49  InitAVRMCRegisterInfo(X, 0);
50 
51  return X;
52 }
53 
55  StringRef CPU, StringRef FS) {
56  return createAVRMCSubtargetInfoImpl(TT, CPU, FS);
57 }
58 
60  unsigned SyntaxVariant,
61  const MCAsmInfo &MAI,
62  const MCInstrInfo &MII,
63  const MCRegisterInfo &MRI) {
64  if (SyntaxVariant == 0) {
65  return new AVRInstPrinter(MAI, MII, MRI);
66  }
67 
68  return nullptr;
69 }
70 
72  std::unique_ptr<MCAsmBackend> &&MAB,
73  std::unique_ptr<MCObjectWriter> &&OW,
74  std::unique_ptr<MCCodeEmitter> &&Emitter,
75  bool RelaxAll) {
76  return createELFStreamer(Context, std::move(MAB), std::move(OW),
77  std::move(Emitter), RelaxAll);
78 }
79 
80 static MCTargetStreamer *
82  return new AVRELFStreamer(S, STI);
83 }
84 
87  MCInstPrinter *InstPrint,
88  bool isVerboseAsm) {
89  return new AVRTargetAsmStreamer(S);
90 }
91 
92 extern "C" void LLVMInitializeAVRTargetMC() {
93  // Register the MC asm info.
95 
96  // Register the MC instruction info.
98 
99  // Register the MC register info.
101 
102  // Register the MC subtarget info.
105 
106  // Register the MCInstPrinter.
109 
110  // Register the MC Code Emitter
112 
113  // Register the obj streamer
115 
116  // Register the obj target streamer.
119 
120  // Register the asm target streamer.
123 
124  // Register the asm backend (as little endian).
126 }
127 
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static MCSubtargetInfo * createAVRMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
LLVMContext & Context
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void LLVMInitializeAVRTargetMC()
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
MCCodeEmitter * createAVRMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Creates a machine code emitter for AVR.
MCInstrInfo * createAVRMCInstrInfo()
Target specific streamer interface.
Definition: MCStreamer.h:84
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
A target streamer for textual AVR assembly code.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
Prints AVR instructions to a textual stream.
Target & getTheAVRTarget()
Context object for machine code objects.
Definition: MCContext.h:63
static MCTargetStreamer * createMCAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Streaming machine code generation interface.
Definition: MCStreamer.h:189
unsigned const MachineRegisterInfo * MRI
static MCInstPrinter * createAVRMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static MCStreamer * createMCStreamer(const Triple &T, MCContext &Context, std::unique_ptr< MCAsmBackend > &&MAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll)
MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target...
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
static MCRegisterInfo * createAVRMCRegisterInfo(const Triple &TT)
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static MCTargetStreamer * createAVRObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:40
A target streamer for an AVR ELF object file.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target. ...
Generic base class for all target subtargets.
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.