[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / Target / CSKY / MCTargetDesc / CSKYMCTargetDesc.cpp
blob169e1e14eb0a4b9cdaf58fe7a8a07b6206eb8157
1 //===-- CSKYMCTargetDesc.cpp - CSKY 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 CSKY specific target descriptions.
10 ///
11 //===----------------------------------------------------------------------===//
13 #include "CSKYMCTargetDesc.h"
14 #include "CSKYAsmBackend.h"
15 #include "CSKYInstPrinter.h"
16 #include "CSKYMCAsmInfo.h"
17 #include "CSKYMCCodeEmitter.h"
18 #include "TargetInfo/CSKYTargetInfo.h"
19 #include "llvm/MC/MCInstrInfo.h"
20 #include "llvm/MC/MCRegisterInfo.h"
21 #include "llvm/MC/MCSubtargetInfo.h"
22 #include "llvm/Support/TargetRegistry.h"
24 #define GET_INSTRINFO_MC_DESC
25 #include "CSKYGenInstrInfo.inc"
27 #define GET_REGINFO_MC_DESC
28 #include "CSKYGenRegisterInfo.inc"
30 #define GET_SUBTARGETINFO_MC_DESC
31 #include "CSKYGenSubtargetInfo.inc"
33 using namespace llvm;
35 static MCAsmInfo *createCSKYMCAsmInfo(const MCRegisterInfo &MRI,
36 const Triple &TT,
37 const MCTargetOptions &Options) {
38 MCAsmInfo *MAI = new CSKYMCAsmInfo(TT);
40 // Initial state of the frame pointer is SP.
41 unsigned Reg = MRI.getDwarfRegNum(CSKY::R14, true);
42 MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, 0);
43 MAI->addInitialFrameState(Inst);
44 return MAI;
47 static MCInstrInfo *createCSKYMCInstrInfo() {
48 MCInstrInfo *Info = new MCInstrInfo();
49 InitCSKYMCInstrInfo(Info);
50 return Info;
53 static MCInstPrinter *createCSKYMCInstPrinter(const Triple &T,
54 unsigned SyntaxVariant,
55 const MCAsmInfo &MAI,
56 const MCInstrInfo &MII,
57 const MCRegisterInfo &MRI) {
58 return new CSKYInstPrinter(MAI, MII, MRI);
61 static MCRegisterInfo *createCSKYMCRegisterInfo(const Triple &TT) {
62 MCRegisterInfo *Info = new MCRegisterInfo();
63 InitCSKYMCRegisterInfo(Info, CSKY::R15);
64 return Info;
67 static MCSubtargetInfo *createCSKYMCSubtargetInfo(const Triple &TT,
68 StringRef CPU, StringRef FS) {
69 std::string CPUName = std::string(CPU);
70 if (CPUName.empty())
71 CPUName = "generic";
72 return createCSKYMCSubtargetInfoImpl(TT, CPUName, /*TuneCPU=*/CPUName, FS);
75 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYTargetMC() {
76 auto &CSKYTarget = getTheCSKYTarget();
77 TargetRegistry::RegisterMCAsmBackend(CSKYTarget, createCSKYAsmBackend);
78 TargetRegistry::RegisterMCAsmInfo(CSKYTarget, createCSKYMCAsmInfo);
79 TargetRegistry::RegisterMCInstrInfo(CSKYTarget, createCSKYMCInstrInfo);
80 TargetRegistry::RegisterMCRegInfo(CSKYTarget, createCSKYMCRegisterInfo);
81 TargetRegistry::RegisterMCCodeEmitter(CSKYTarget, createCSKYMCCodeEmitter);
82 TargetRegistry::RegisterMCInstPrinter(CSKYTarget, createCSKYMCInstPrinter);
83 TargetRegistry::RegisterMCSubtargetInfo(CSKYTarget,
84 createCSKYMCSubtargetInfo);