LLVM 19.0.0git
VEMCTargetDesc.cpp
Go to the documentation of this file.
1//===-- VEMCTargetDesc.cpp - VE 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 VE specific target descriptions.
10//
11//===----------------------------------------------------------------------===//
12
13#include "VEMCTargetDesc.h"
15#include "VEInstPrinter.h"
16#include "VEMCAsmInfo.h"
17#include "VETargetStreamer.h"
18#include "llvm/MC/MCInstrInfo.h"
23
24using namespace llvm;
25
26#define GET_INSTRINFO_MC_DESC
27#define ENABLE_INSTR_PREDICATE_VERIFIER
28#include "VEGenInstrInfo.inc"
29
30#define GET_SUBTARGETINFO_MC_DESC
31#include "VEGenSubtargetInfo.inc"
32
33#define GET_REGINFO_MC_DESC
34#include "VEGenRegisterInfo.inc"
35
37 const MCTargetOptions &Options) {
38 MCAsmInfo *MAI = new VEELFMCAsmInfo(TT);
39 unsigned Reg = MRI.getDwarfRegNum(VE::SX11, true);
40 MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, 0);
41 MAI->addInitialFrameState(Inst);
42 return MAI;
43}
44
46 MCInstrInfo *X = new MCInstrInfo();
47 InitVEMCInstrInfo(X);
48 return X;
49}
50
53 InitVEMCRegisterInfo(X, VE::SX10);
54 return X;
55}
56
58 StringRef FS) {
59 if (CPU.empty())
60 CPU = "generic";
61 return createVEMCSubtargetInfoImpl(TT, CPU, /*TuneCPU=*/CPU, FS);
62}
63
64static MCTargetStreamer *
66 return new VETargetELFStreamer(S);
67}
68
71 MCInstPrinter *InstPrint,
72 bool isVerboseAsm) {
73 return new VETargetAsmStreamer(S, OS);
74}
75
77 return new VETargetStreamer(S);
78}
79
81 unsigned SyntaxVariant,
82 const MCAsmInfo &MAI,
83 const MCInstrInfo &MII,
84 const MCRegisterInfo &MRI) {
85 return new VEInstPrinter(MAI, MII, MRI);
86}
87
89 // Register the MC asm info.
91
92 for (Target *T : {&getTheVETarget()}) {
93 // Register the MC instruction info.
95
96 // Register the MC register info.
98
99 // Register the MC subtarget info.
101
102 // Register the MC Code Emitter.
104
105 // Register the asm backend.
107
108 // Register the object target streamer.
111
112 // Register the asm streamer.
114
115 // Register the null streamer.
117
118 // Register the MCInstPrinter
120 }
121}
unsigned const MachineRegisterInfo * MRI
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:135
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static LVOptions Options
Definition: LVOptions.cpp:25
raw_pwrite_stream & OS
static MCAsmInfo * createVEMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
static MCTargetStreamer * createNullTargetStreamer(MCStreamer &S)
static MCTargetStreamer * createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVETargetMC()
static MCRegisterInfo * createVEMCRegisterInfo(const Triple &TT)
static MCInstrInfo * createVEMCInstrInfo()
static MCInstPrinter * createVEMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static MCSubtargetInfo * createVEMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:75
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Definition: MCDwarf.h:541
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: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
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
Target - Wrapper for Target specific information.
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
Target & getTheVETarget()
MCAsmBackend * createVEAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
MCCodeEmitter * createVEMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
RegisterMCAsmInfoFn - 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 RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy 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)