LLVM  16.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"
22 #include "llvm/MC/TargetRegistry.h"
25 
26 using namespace llvm;
27 
28 #define GET_INSTRINFO_MC_DESC
29 #define ENABLE_INSTR_PREDICATE_VERIFIER
30 #include "ARCGenInstrInfo.inc"
31 
32 #define GET_SUBTARGETINFO_MC_DESC
33 #include "ARCGenSubtargetInfo.inc"
34 
35 #define GET_REGINFO_MC_DESC
36 #include "ARCGenRegisterInfo.inc"
37 
39  auto *X = new MCInstrInfo();
40  InitARCMCInstrInfo(X);
41  return X;
42 }
43 
45  auto *X = new MCRegisterInfo();
46  InitARCMCRegisterInfo(X, ARC::BLINK);
47  return X;
48 }
49 
51  StringRef CPU, StringRef FS) {
52  return createARCMCSubtargetInfoImpl(TT, CPU, /*TuneCPU=*/CPU, FS);
53 }
54 
56  const Triple &TT,
57  const MCTargetOptions &Options) {
58  MCAsmInfo *MAI = new ARCMCAsmInfo(TT);
59 
60  // Initial state of the frame pointer is SP.
61  MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, ARC::SP, 0);
62  MAI->addInitialFrameState(Inst);
63 
64  return MAI;
65 }
66 
68  unsigned SyntaxVariant,
69  const MCAsmInfo &MAI,
70  const MCInstrInfo &MII,
71  const MCRegisterInfo &MRI) {
72  return new ARCInstPrinter(MAI, MII, MRI);
73 }
74 
77 
80  MCInstPrinter *InstPrint,
81  bool isVerboseAsm) {
82  return new ARCTargetStreamer(S);
83 }
84 
85 // Force static initialization.
87  // Register the MC asm info.
88  Target &TheARCTarget = getTheARCTarget();
90 
91  // Register the MC instruction info.
93 
94  // Register the MC register info.
96 
97  // Register the MC subtarget info.
100 
101  // Register the MCInstPrinter
103 
106 }
MCDwarf.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
T
ARCMCAsmInfo.h
createTargetAsmStreamer
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Definition: ARCMCTargetDesc.cpp:78
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:149
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
llvm::ARCTargetStreamer
Definition: ARCTargetStreamer.h:16
ErrorHandling.h
ARCTargetStreamer.h
llvm::TargetRegistry::RegisterAsmTargetStreamer
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1038
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::ARCTargetStreamer::~ARCTargetStreamer
~ARCTargetStreamer() override
llvm::TargetRegistry::RegisterMCInstPrinter
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Definition: TargetRegistry.h:988
createARCMCInstPrinter
static MCInstPrinter * createARCMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: ARCMCTargetDesc.cpp:67
FormattedStream.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:212
createARCMCRegisterInfo
static MCRegisterInfo * createARCMCRegisterInfo(const Triple &TT)
Definition: ARCMCTargetDesc.cpp:44
ARCInstPrinter.h
MCInstrInfo.h
MCSubtargetInfo.h
llvm::getTheARCTarget
Target & getTheARCTarget()
Definition: ARCTargetInfo.cpp:14
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::X86AS::FS
@ FS
Definition: X86.h:200
llvm::MCTargetStreamer
Target specific streamer interface.
Definition: MCStreamer.h:93
llvm::RegisterMCAsmInfoFn
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
Definition: TargetRegistry.h:1178
llvm::MCCFIInstruction
Definition: MCDwarf.h:478
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
LLVMInitializeARCTargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCTargetMC()
Definition: ARCMCTargetDesc.cpp:86
llvm::ARCMCAsmInfo
Definition: ARCMCAsmInfo.h:22
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:127
ARCTargetInfo.h
createARCMCAsmInfo
static MCAsmInfo * createARCMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Definition: ARCMCTargetDesc.cpp:55
MCRegisterInfo.h
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:532
llvm::MCAsmInfo::addInitialFrameState
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:86
llvm::TargetRegistry::RegisterMCSubtargetInfo
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
Definition: TargetRegistry.h:908
llvm::MCTargetOptions
Definition: MCTargetOptions.h:37
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
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
llvm::ARCTargetStreamer::ARCTargetStreamer
ARCTargetStreamer(MCStreamer &S)
Definition: ARCMCTargetDesc.cpp:75
ARCMCTargetDesc.h
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::TargetRegistry::RegisterMCInstrInfo
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Definition: TargetRegistry.h:875
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
llvm::TargetRegistry::RegisterMCRegInfo
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Definition: TargetRegistry.h:895
createARCMCInstrInfo
static MCInstrInfo * createARCMCInstrInfo()
Definition: ARCMCTargetDesc.cpp:38
llvm::ARCInstPrinter
Definition: ARCInstPrinter.h:22
createARCMCSubtargetInfo
static MCSubtargetInfo * createARCMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: ARCMCTargetDesc.cpp:50
TargetRegistry.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76