LLVM  12.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 }
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This class represents lattice values for constants.
Definition: AllocatorList.h:23
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
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:487
Target specific streamer interface.
Definition: MCStreamer.h:92
unsigned Reg
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:156
static MCAsmInfo * createVEMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Streaming machine code generation interface.
Definition: MCStreamer.h:198
unsigned const MachineRegisterInfo * MRI
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
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)
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
static MCRegisterInfo * createVEMCRegisterInfo(const Triple &TT)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVETargetMC()
Target & getTheVETarget()
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:81
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:131
static MCSubtargetInfo * createVEMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Target - Wrapper for Target specific information.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
static MCInstrInfo * createVEMCInstrInfo()
static MCTargetStreamer * createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Generic base class for all target subtargets.
static MCInstPrinter * createVEMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
MCCodeEmitter * createVEMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
MCAsmBackend * createVEAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)