LLVM 20.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 "AVRTargetStreamer.h"
19
23#include "llvm/MC/MCInstrInfo.h"
27
28#define GET_INSTRINFO_MC_DESC
29#define ENABLE_INSTR_PREDICATE_VERIFIER
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
38using 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, /*TuneCPU*/ 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
71static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
72 std::unique_ptr<MCAsmBackend> &&MAB,
73 std::unique_ptr<MCObjectWriter> &&OW,
74 std::unique_ptr<MCCodeEmitter> &&Emitter) {
75 return createELFStreamer(Context, std::move(MAB), std::move(OW),
76 std::move(Emitter));
77}
78
79static MCTargetStreamer *
81 return new AVRELFStreamer(S, STI);
82}
83
86 MCInstPrinter *InstPrint) {
87 return new AVRTargetAsmStreamer(S);
88}
89
91 // Register the MC asm info.
93
94 // Register the MC instruction info.
96
97 // Register the MC register info.
99
100 // Register the MC subtarget info.
103
104 // Register the MCInstPrinter.
107
108 // Register the MC Code Emitter
111
112 // Register the obj streamer
114
115 // Register the obj target streamer.
118
119 // Register the asm target streamer.
122
123 // Register the asm backend (as little endian).
125}
unsigned const MachineRegisterInfo * MRI
static MCSubtargetInfo * createAVRMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static MCTargetStreamer * createAVRObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static MCStreamer * createMCStreamer(const Triple &T, MCContext &Context, std::unique_ptr< MCAsmBackend > &&MAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter)
static MCRegisterInfo * createAVRMCRegisterInfo(const Triple &TT)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRTargetMC()
static MCTargetStreamer * createMCAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint)
static MCInstPrinter * createAVRMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:128
dxil DXContainer Global Emitter
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
raw_pwrite_stream & OS
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:83
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:46
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:213
Generic base class for all target subtargets.
Target specific streamer interface.
Definition: MCStreamer.h:94
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
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()
MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.
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)