[ARM] VQADD instructions
[llvm-complete.git] / lib / Target / ARC / MCTargetDesc / ARCMCTargetDesc.cpp
blobaa4818cd57acecba0a0eb1793626f0df133c6e7c
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.
11 //===----------------------------------------------------------------------===//
13 #include "ARCMCTargetDesc.h"
14 #include "ARCInstPrinter.h"
15 #include "ARCMCAsmInfo.h"
16 #include "ARCTargetStreamer.h"
17 #include "TargetInfo/ARCTargetInfo.h"
18 #include "llvm/MC/MCDwarf.h"
19 #include "llvm/MC/MCInstrInfo.h"
20 #include "llvm/MC/MCRegisterInfo.h"
21 #include "llvm/MC/MCSubtargetInfo.h"
22 #include "llvm/Support/ErrorHandling.h"
23 #include "llvm/Support/FormattedStream.h"
24 #include "llvm/Support/TargetRegistry.h"
26 using namespace llvm;
28 #define GET_INSTRINFO_MC_DESC
29 #include "ARCGenInstrInfo.inc"
31 #define GET_SUBTARGETINFO_MC_DESC
32 #include "ARCGenSubtargetInfo.inc"
34 #define GET_REGINFO_MC_DESC
35 #include "ARCGenRegisterInfo.inc"
37 static MCInstrInfo *createARCMCInstrInfo() {
38 auto *X = new MCInstrInfo();
39 InitARCMCInstrInfo(X);
40 return X;
43 static MCRegisterInfo *createARCMCRegisterInfo(const Triple &TT) {
44 auto *X = new MCRegisterInfo();
45 InitARCMCRegisterInfo(X, ARC::BLINK);
46 return X;
49 static MCSubtargetInfo *createARCMCSubtargetInfo(const Triple &TT,
50 StringRef CPU, StringRef FS) {
51 return createARCMCSubtargetInfoImpl(TT, CPU, FS);
54 static MCAsmInfo *createARCMCAsmInfo(const MCRegisterInfo &MRI,
55 const Triple &TT) {
56 MCAsmInfo *MAI = new ARCMCAsmInfo(TT);
58 // Initial state of the frame pointer is SP.
59 MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, ARC::SP, 0);
60 MAI->addInitialFrameState(Inst);
62 return MAI;
65 static MCInstPrinter *createARCMCInstPrinter(const Triple &T,
66 unsigned SyntaxVariant,
67 const MCAsmInfo &MAI,
68 const MCInstrInfo &MII,
69 const MCRegisterInfo &MRI) {
70 return new ARCInstPrinter(MAI, MII, MRI);
73 ARCTargetStreamer::ARCTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
74 ARCTargetStreamer::~ARCTargetStreamer() = default;
76 static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
77 formatted_raw_ostream &OS,
78 MCInstPrinter *InstPrint,
79 bool isVerboseAsm) {
80 return new ARCTargetStreamer(S);
83 // Force static initialization.
84 extern "C" void LLVMInitializeARCTargetMC() {
85 // Register the MC asm info.
86 Target &TheARCTarget = getTheARCTarget();
87 RegisterMCAsmInfoFn X(TheARCTarget, createARCMCAsmInfo);
89 // Register the MC instruction info.
90 TargetRegistry::RegisterMCInstrInfo(TheARCTarget, createARCMCInstrInfo);
92 // Register the MC register info.
93 TargetRegistry::RegisterMCRegInfo(TheARCTarget, createARCMCRegisterInfo);
95 // Register the MC subtarget info.
96 TargetRegistry::RegisterMCSubtargetInfo(TheARCTarget,
97 createARCMCSubtargetInfo);
99 // Register the MCInstPrinter
100 TargetRegistry::RegisterMCInstPrinter(TheARCTarget, createARCMCInstPrinter);
102 TargetRegistry::RegisterAsmTargetStreamer(TheARCTarget,
103 createTargetAsmStreamer);