LLVM  11.0.0git
ARCMCTargetDesc.cpp
Go to the documentation of this file.
1 //===- ARCMCTargetDesc.cpp - ARC Target Descriptions ------------*- C++ -*-===//
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 ARC specific target descriptions.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "ARCMCTargetDesc.h"
14 #include "ARCInstPrinter.h"
15 #include "ARCMCAsmInfo.h"
16 #include "ARCTargetStreamer.h"
18 #include "llvm/MC/MCDwarf.h"
19 #include "llvm/MC/MCInstrInfo.h"
20 #include "llvm/MC/MCRegisterInfo.h"
25 
26 using namespace llvm;
27 
28 #define GET_INSTRINFO_MC_DESC
29 #include "ARCGenInstrInfo.inc"
30 
31 #define GET_SUBTARGETINFO_MC_DESC
32 #include "ARCGenSubtargetInfo.inc"
33 
34 #define GET_REGINFO_MC_DESC
35 #include "ARCGenRegisterInfo.inc"
36 
38  auto *X = new MCInstrInfo();
39  InitARCMCInstrInfo(X);
40  return X;
41 }
42 
44  auto *X = new MCRegisterInfo();
45  InitARCMCRegisterInfo(X, ARC::BLINK);
46  return X;
47 }
48 
50  StringRef CPU, StringRef FS) {
51  return createARCMCSubtargetInfoImpl(TT, CPU, FS);
52 }
53 
55  const Triple &TT,
56  const MCTargetOptions &Options) {
57  MCAsmInfo *MAI = new ARCMCAsmInfo(TT);
58 
59  // Initial state of the frame pointer is SP.
60  MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, ARC::SP, 0);
61  MAI->addInitialFrameState(Inst);
62 
63  return MAI;
64 }
65 
67  unsigned SyntaxVariant,
68  const MCAsmInfo &MAI,
69  const MCInstrInfo &MII,
70  const MCRegisterInfo &MRI) {
71  return new ARCInstPrinter(MAI, MII, MRI);
72 }
73 
76 
79  MCInstPrinter *InstPrint,
80  bool isVerboseAsm) {
81  return new ARCTargetStreamer(S);
82 }
83 
84 // Force static initialization.
86  // Register the MC asm info.
87  Target &TheARCTarget = getTheARCTarget();
89 
90  // Register the MC instruction info.
92 
93  // Register the MC register info.
95 
96  // Register the MC subtarget info.
99 
100  // Register the MCInstPrinter
102 
105 }
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This class represents lattice values for constants.
Definition: AllocatorList.h:23
~ARCTargetStreamer() override
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:485
Target specific streamer interface.
Definition: MCStreamer.h:90
Target & getTheARCTarget()
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static MCInstrInfo * createARCMCInstrInfo()
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
static MCRegisterInfo * createARCMCRegisterInfo(const Triple &TT)
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
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:196
unsigned const MachineRegisterInfo * MRI
This file contains the declaration of the ARCInstPrinter class, which is used to print ARC MCInst to ...
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
ARCTargetStreamer(MCStreamer &S)
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target...
static MCAsmInfo * createARCMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:73
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:131
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:42
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 MCSubtargetInfo * createARCMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCTargetMC()
static MCInstPrinter * createARCMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)