LLVM  8.0.1
ARCMCTargetDesc.cpp
Go to the documentation of this file.
1 //===- ARCMCTargetDesc.cpp - ARC Target Descriptions ------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides ARC specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "ARCMCTargetDesc.h"
15 #include "ARCMCAsmInfo.h"
16 #include "ARCTargetStreamer.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
24 
25 using namespace llvm;
26 
27 #define GET_INSTRINFO_MC_DESC
28 #include "ARCGenInstrInfo.inc"
29 
30 #define GET_SUBTARGETINFO_MC_DESC
31 #include "ARCGenSubtargetInfo.inc"
32 
33 #define GET_REGINFO_MC_DESC
34 #include "ARCGenRegisterInfo.inc"
35 
37  auto *X = new MCInstrInfo();
38  InitARCMCInstrInfo(X);
39  return X;
40 }
41 
43  auto *X = new MCRegisterInfo();
44  InitARCMCRegisterInfo(X, ARC::BLINK);
45  return X;
46 }
47 
49  StringRef CPU, StringRef FS) {
50  return createARCMCSubtargetInfoImpl(TT, CPU, FS);
51 }
52 
54  const Triple &TT) {
55  MCAsmInfo *MAI = new ARCMCAsmInfo(TT);
56 
57  // Initial state of the frame pointer is SP.
58  MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, ARC::SP, 0);
59  MAI->addInitialFrameState(Inst);
60 
61  return MAI;
62 }
63 
65  unsigned SyntaxVariant,
66  const MCAsmInfo &MAI,
67  const MCInstrInfo &MII,
68  const MCRegisterInfo &MRI) {
69  return new ARCInstPrinter(MAI, MII, MRI);
70 }
71 
74 
77  MCInstPrinter *InstPrint,
78  bool isVerboseAsm) {
79  return new ARCTargetStreamer(S);
80 }
81 
82 // Force static initialization.
83 extern "C" void LLVMInitializeARCTargetMC() {
84  // Register the MC asm info.
85  Target &TheARCTarget = getTheARCTarget();
87 
88  // Register the MC instruction info.
90 
91  // Register the MC register info.
93 
94  // Register the MC subtarget info.
97 
98  // Register the MCInstPrinter
100 
103 }
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This class represents lattice values for constants.
Definition: AllocatorList.h:24
~ARCTargetStreamer() override
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:84
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 MCAsmInfo * createARCMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT)
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.h:601
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:189
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:461
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:24
ARCTargetStreamer(MCStreamer &S)
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Target - Wrapper for Target specific information.
void LLVMInitializeARCTargetMC()
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:40
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:49
static MCInstPrinter * createARCMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)