LLVM 17.0.0git
AVRMCTargetDesc.cpp
Go to the documentation of this file.
1//===-- AVRMCTargetDesc.cpp - AVR Target Descriptions ---------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file provides AVR specific target descriptions.
10//
11//===----------------------------------------------------------------------===//
12
13#include "AVRMCTargetDesc.h"
14#include "AVRELFStreamer.h"
15#include "AVRInstPrinter.h"
16#include "AVRMCAsmInfo.h"
17#include "AVRMCELFStreamer.h"
18#include "AVRTargetStreamer.h"
20
24#include "llvm/MC/MCInstrInfo.h"
28
29#define GET_INSTRINFO_MC_DESC
30#define ENABLE_INSTR_PREDICATE_VERIFIER
31#include "AVRGenInstrInfo.inc"
32
33#define GET_SUBTARGETINFO_MC_DESC
34#include "AVRGenSubtargetInfo.inc"
35
36#define GET_REGINFO_MC_DESC
37#include "AVRGenRegisterInfo.inc"
38
39using namespace llvm;
40
42 MCInstrInfo *X = new MCInstrInfo();
43 InitAVRMCInstrInfo(X);
44
45 return X;
46}
47
50 InitAVRMCRegisterInfo(X, 0);
51
52 return X;
53}
54
56 StringRef CPU, StringRef FS) {
57 return createAVRMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
58}
59
61 unsigned SyntaxVariant,
62 const MCAsmInfo &MAI,
63 const MCInstrInfo &MII,
64 const MCRegisterInfo &MRI) {
65 if (SyntaxVariant == 0) {
66 return new AVRInstPrinter(MAI, MII, MRI);
67 }
68
69 return nullptr;
70}
71
72static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
73 std::unique_ptr<MCAsmBackend> &&MAB,
74 std::unique_ptr<MCObjectWriter> &&OW,
75 std::unique_ptr<MCCodeEmitter> &&Emitter,
76 bool RelaxAll) {
77 return createELFStreamer(Context, std::move(MAB), std::move(OW),
78 std::move(Emitter), RelaxAll);
79}
80
81static MCTargetStreamer *
83 return new AVRELFStreamer(S, STI);
84}
85
88 MCInstPrinter *InstPrint,
89 bool isVerboseAsm) {
90 return new AVRTargetAsmStreamer(S);
91}
92
94 // Register the MC asm info.
96
97 // Register the MC instruction info.
99
100 // Register the MC register info.
102
103 // Register the MC subtarget info.
106
107 // Register the MCInstPrinter.
110
111 // Register the MC Code Emitter
114
115 // Register the obj streamer
117
118 // Register the obj target streamer.
121
122 // Register the asm target streamer.
125
126 // Register the asm backend (as little endian).
128}
unsigned const MachineRegisterInfo * MRI
static MCSubtargetInfo * createAVRMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
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)
static MCTargetStreamer * createAVRObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static MCRegisterInfo * createAVRMCRegisterInfo(const Triple &TT)
static MCTargetStreamer * createMCAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRTargetMC()
static MCInstPrinter * createAVRMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
dxil DXContainer Global Emitter
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
LLVMContext & Context
A target streamer for an AVR ELF object file.
Prints AVR instructions to a textual stream.
A target streamer for textual AVR assembly code.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:76
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:44
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Definition: MCStreamer.h:212
Generic base class for all target subtargets.
Target specific streamer interface.
Definition: MCStreamer.h:93
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCInstrInfo * createAVRMCInstrInfo()
MCCodeEmitter * createAVRMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Creates a machine code emitter for AVR.
Target & getTheAVRTarget()
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.
MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
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)
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)