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 "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 return createELFStreamer(Context, std::move(MAB), std::move(OW),
77 std::move(Emitter));
78}
79
80static MCTargetStreamer *
82 return new AVRELFStreamer(S, STI);
83}
84
87 MCInstPrinter *InstPrint) {
88 return new AVRTargetAsmStreamer(S);
89}
90
92 // Register the MC asm info.
94
95 // Register the MC instruction info.
97
98 // Register the MC register info.
100
101 // Register the MC subtarget info.
104
105 // Register the MCInstPrinter.
108
109 // 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}
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:135
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:45
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: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()
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)