LLVM  13.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"
19 #include "llvm/MC/MCRegisterInfo.h"
23 
24 using namespace llvm;
25 
26 #define GET_INSTRINFO_MC_DESC
27 #include "VEGenInstrInfo.inc"
28 
29 #define GET_SUBTARGETINFO_MC_DESC
30 #include "VEGenSubtargetInfo.inc"
31 
32 #define GET_REGINFO_MC_DESC
33 #include "VEGenRegisterInfo.inc"
34 
36  const MCTargetOptions &Options) {
37  MCAsmInfo *MAI = new VEELFMCAsmInfo(TT);
38  unsigned Reg = MRI.getDwarfRegNum(VE::SX11, true);
40  MAI->addInitialFrameState(Inst);
41  return MAI;
42 }
43 
45  MCInstrInfo *X = new MCInstrInfo();
46  InitVEMCInstrInfo(X);
47  return X;
48 }
49 
52  InitVEMCRegisterInfo(X, VE::SX10);
53  return X;
54 }
55 
57  StringRef FS) {
58  if (CPU.empty())
59  CPU = "generic";
60  return createVEMCSubtargetInfoImpl(TT, CPU, /*TuneCPU=*/CPU, FS);
61 }
62 
63 static MCTargetStreamer *
65  return new VETargetELFStreamer(S);
66 }
67 
70  MCInstPrinter *InstPrint,
71  bool isVerboseAsm) {
72  return new VETargetAsmStreamer(S, OS);
73 }
74 
76  unsigned SyntaxVariant,
77  const MCAsmInfo &MAI,
78  const MCInstrInfo &MII,
79  const MCRegisterInfo &MRI) {
80  return new VEInstPrinter(MAI, MII, MRI);
81 }
82 
84  // Register the MC asm info.
86 
87  for (Target *T : {&getTheVETarget()}) {
88  // Register the MC instruction info.
90 
91  // Register the MC register info.
93 
94  // Register the MC subtarget info.
96 
97  // Register the MC Code Emitter.
99 
100  // Register the asm backend.
102 
103  // Register the object target streamer.
106 
107  // Register the asm streamer.
109 
110  // Register the MCInstPrinter
112  }
113 }
llvm
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:125
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
createVEMCRegisterInfo
static MCRegisterInfo * createVEMCRegisterInfo(const Triple &TT)
Definition: VEMCTargetDesc.cpp:50
ErrorHandling.h
createTargetAsmStreamer
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Definition: VEMCTargetDesc.cpp:68
llvm::TargetRegistry::RegisterAsmTargetStreamer
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:924
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::createVEAsmBackend
MCAsmBackend * createVEAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
Definition: VEAsmBackend.cpp:219
llvm::TargetRegistry::RegisterMCInstPrinter
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Definition: TargetRegistry.h:882
llvm::VEInstPrinter
Definition: VEInstPrinter.h:21
VEInstPrinter.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
LLVMInitializeVETargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVETargetMC()
Definition: VEMCTargetDesc.cpp:83
llvm::getTheVETarget
Target & getTheVETarget()
Definition: VETargetInfo.cpp:14
llvm::createVEMCCodeEmitter
MCCodeEmitter * createVEMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Definition: VEMCCodeEmitter.cpp:161
createVEMCInstPrinter
static MCInstPrinter * createVEMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: VEMCTargetDesc.cpp:75
llvm::VETargetELFStreamer
Definition: VETargetStreamer.h:39
createVEMCAsmInfo
static MCAsmInfo * createVEMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Definition: VEMCTargetDesc.cpp:35
MCInstrInfo.h
MCSubtargetInfo.h
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::MCTargetStreamer
Target specific streamer interface.
Definition: MCStreamer.h:91
llvm::RegisterMCAsmInfoFn
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
Definition: TargetRegistry.h:1021
createVEMCSubtargetInfo
static MCSubtargetInfo * createVEMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: VEMCTargetDesc.cpp:56
llvm::MCCFIInstruction
Definition: MCDwarf.h:441
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
VEMCTargetDesc.h
llvm::TargetRegistry::RegisterMCAsmBackend
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Definition: TargetRegistry.h:829
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:132
llvm::TargetRegistry::RegisterObjectTargetStreamer
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:930
VEMCAsmInfo.h
MCRegisterInfo.h
llvm::VETargetAsmStreamer
Definition: VETargetStreamer.h:29
llvm::VEELFMCAsmInfo
Definition: VEMCAsmInfo.h:22
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::MCCFIInstruction::cfiDefCfa
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Definition: MCDwarf.h:488
llvm::MCAsmInfo::addInitialFrameState
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:85
VETargetStreamer.h
llvm::TargetRegistry::RegisterMCSubtargetInfo
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
Definition: TargetRegistry.h:802
llvm::MCTargetOptions
Definition: MCTargetOptions.h:36
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
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
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
VETargetInfo.h
llvm::TargetRegistry::RegisterMCInstrInfo
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Definition: TargetRegistry.h:769
llvm::TargetRegistry::RegisterMCCodeEmitter
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
Definition: TargetRegistry.h:895
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
createObjectTargetStreamer
static MCTargetStreamer * createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition: VEMCTargetDesc.cpp:64
llvm::TargetRegistry::RegisterMCRegInfo
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Definition: TargetRegistry.h:789
llvm::X86AS::FS
@ FS
Definition: X86.h:188
createVEMCInstrInfo
static MCInstrInfo * createVEMCInstrInfo()
Definition: VEMCTargetDesc.cpp:44
TargetRegistry.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75