LLVM  10.0.0
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 "VEMCAsmInfo.h"
16 #include "VETargetStreamer.h"
17 #include "llvm/MC/MCInstrInfo.h"
18 #include "llvm/MC/MCRegisterInfo.h"
22 
23 using namespace llvm;
24 
25 #define GET_INSTRINFO_MC_DESC
26 #include "VEGenInstrInfo.inc"
27 
28 #define GET_SUBTARGETINFO_MC_DESC
29 #include "VEGenSubtargetInfo.inc"
30 
31 #define GET_REGINFO_MC_DESC
32 #include "VEGenRegisterInfo.inc"
33 
35  const MCTargetOptions &Options) {
36  MCAsmInfo *MAI = new VEELFMCAsmInfo(TT);
37  unsigned Reg = MRI.getDwarfRegNum(VE::SX11, true);
38  MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, Reg, 0);
39  MAI->addInitialFrameState(Inst);
40  return MAI;
41 }
42 
44  MCInstrInfo *X = new MCInstrInfo();
45  InitVEMCInstrInfo(X);
46  return X;
47 }
48 
51  InitVEMCRegisterInfo(X, VE::SX10);
52  return X;
53 }
54 
56  StringRef FS) {
57  if (CPU.empty())
58  CPU = "ve";
59  return createVEMCSubtargetInfoImpl(TT, CPU, FS);
60 }
61 
62 static MCTargetStreamer *
64  return new VETargetELFStreamer(S);
65 }
66 
69  MCInstPrinter *InstPrint,
70  bool isVerboseAsm) {
71  return new VETargetAsmStreamer(S, OS);
72 }
73 
75  unsigned SyntaxVariant,
76  const MCAsmInfo &MAI,
77  const MCInstrInfo &MII,
78  const MCRegisterInfo &MRI) {
79  return new VEInstPrinter(MAI, MII, MRI);
80 }
81 
82 extern "C" void LLVMInitializeVETargetMC() {
83  // Register the MC asm info.
85 
86  for (Target *T : {&getTheVETarget()}) {
87  // Register the MC instruction info.
89 
90  // Register the MC register info.
92 
93  // Register the MC subtarget info.
95 
96  // Register the object target streamer.
99 
100  // Register the asm streamer.
102 
103  // Register the MCInstPrinter
105  }
106 }
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...
Target specific streamer interface.
Definition: MCStreamer.h:91
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:147
int getDwarfRegNum(MCRegister RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
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
Streaming machine code generation interface.
Definition: MCStreamer.h:197
unsigned const MachineRegisterInfo * MRI
static MCCFIInstruction createDefCfa(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:480
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:23
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:43
static MCRegisterInfo * createVEMCRegisterInfo(const Triple &TT)
Target & getTheVETarget()
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:73
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.
void LLVMInitializeVETargetMC()
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:42
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.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)