LLVM  16.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 
21 #include "llvm/MC/MCAsmBackend.h"
22 #include "llvm/MC/MCCodeEmitter.h"
23 #include "llvm/MC/MCELFStreamer.h"
24 #include "llvm/MC/MCInstrInfo.h"
25 #include "llvm/MC/MCRegisterInfo.h"
27 #include "llvm/MC/TargetRegistry.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 
39 using 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 
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 
81 static 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 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
AVRInstPrinter.h
llvm::createAVRMCCodeEmitter
MCCodeEmitter * createAVRMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Creates a machine code emitter for AVR.
T
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:76
createAVRMCSubtargetInfo
static MCSubtargetInfo * createAVRMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: AVRMCTargetDesc.cpp:55
AVRMCELFStreamer.h
MCCodeEmitter.h
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::AVRInstPrinter
Prints AVR instructions to a textual stream.
Definition: AVRInstPrinter.h:23
llvm::TargetRegistry::RegisterAsmTargetStreamer
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1015
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
createAVRMCRegisterInfo
static MCRegisterInfo * createAVRMCRegisterInfo(const Triple &TT)
Definition: AVRMCTargetDesc.cpp:48
llvm::TargetRegistry::RegisterMCInstPrinter
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Definition: TargetRegistry.h:965
MCELFStreamer.h
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:212
MCAsmBackend.h
MCInstrInfo.h
llvm::getTheAVRTarget
Target & getTheAVRTarget()
Definition: AVRTargetInfo.cpp:12
MCSubtargetInfo.h
AVRTargetInfo.h
llvm::AVRELFStreamer
A target streamer for an AVR ELF object file.
Definition: AVRELFStreamer.h:17
llvm::MCTargetStreamer
Target specific streamer interface.
Definition: MCStreamer.h:93
createAVRObjectTargetStreamer
static MCTargetStreamer * createAVRObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition: AVRMCTargetDesc.cpp:82
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::TargetRegistry::RegisterMCAsmBackend
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Definition: TargetRegistry.h:912
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::createAVRMCInstrInfo
MCInstrInfo * createAVRMCInstrInfo()
Definition: AVRMCTargetDesc.cpp:41
llvm::TargetRegistry::RegisterObjectTargetStreamer
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1021
MCRegisterInfo.h
llvm::AVRTargetAsmStreamer
A target streamer for textual AVR assembly code.
Definition: AVRTargetStreamer.h:24
AVRMCAsmInfo.h
llvm::formatted_raw_ostream
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
Definition: FormattedStream.h:30
llvm::X86AS::FS
@ FS
Definition: X86.h:200
AVRMCTargetDesc.h
llvm::createAVRAsmBackend
MCAsmBackend * createAVRAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO)
Creates an assembly backend for AVR.
Definition: AVRAsmBackend.cpp:486
llvm::TargetRegistry::RegisterMCSubtargetInfo
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
Definition: TargetRegistry.h:885
AVRELFStreamer.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::RegisterMCAsmInfo
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
Definition: TargetRegistry.h:1120
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
LLVMInitializeAVRTargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRTargetMC()
Definition: AVRMCTargetDesc.cpp:93
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::createELFStreamer
MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
Definition: MCELFStreamer.cpp:887
llvm::TargetRegistry::RegisterMCInstrInfo
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Definition: TargetRegistry.h:852
llvm::TargetRegistry::RegisterMCCodeEmitter
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
Definition: TargetRegistry.h:978
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
AVRTargetStreamer.h
llvm::TargetRegistry::RegisterMCRegInfo
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Definition: TargetRegistry.h:872
createAVRMCInstPrinter
static MCInstPrinter * createAVRMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: AVRMCTargetDesc.cpp:60
llvm::TargetRegistry::RegisterELFStreamer
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
Definition: TargetRegistry.h:990
createMCStreamer
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)
Definition: AVRMCTargetDesc.cpp:72
createMCAsmTargetStreamer
static MCTargetStreamer * createMCAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Definition: AVRMCTargetDesc.cpp:86
TargetRegistry.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76