LLVM  13.0.0git
CSKYMCTargetDesc.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
12 
13 #include "CSKYMCTargetDesc.h"
14 #include "CSKYAsmBackend.h"
15 #include "CSKYMCAsmInfo.h"
16 #include "CSKYMCCodeEmitter.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
22 
23 #define GET_INSTRINFO_MC_DESC
24 #include "CSKYGenInstrInfo.inc"
25 
26 #define GET_REGINFO_MC_DESC
27 #include "CSKYGenRegisterInfo.inc"
28 
29 using namespace llvm;
30 
32  const Triple &TT,
33  const MCTargetOptions &Options) {
34  MCAsmInfo *MAI = new CSKYMCAsmInfo(TT);
35 
36  // Initial state of the frame pointer is SP.
37  unsigned Reg = MRI.getDwarfRegNum(CSKY::R14, true);
39  MAI->addInitialFrameState(Inst);
40  return MAI;
41 }
42 
44  MCInstrInfo *Info = new MCInstrInfo();
45  InitCSKYMCInstrInfo(Info);
46  return Info;
47 }
48 
51  InitCSKYMCRegisterInfo(Info, CSKY::R15);
52  return Info;
53 }
54 
56  auto &CSKYTarget = getTheCSKYTarget();
62 }
llvm
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::CSKYMCAsmInfo
Definition: CSKYMCAsmInfo.h:21
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::createCSKYMCCodeEmitter
MCCodeEmitter * createCSKYMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Definition: CSKYMCCodeEmitter.cpp:65
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::getTheCSKYTarget
Target & getTheCSKYTarget()
Definition: CSKYTargetInfo.cpp:13
CSKYAsmBackend.h
MCInstrInfo.h
MCSubtargetInfo.h
llvm::createCSKYAsmBackend
MCAsmBackend * createCSKYAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
Definition: CSKYAsmBackend.cpp:64
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:26
CSKYMCCodeEmitter.h
llvm::MCCFIInstruction
Definition: MCDwarf.h:441
llvm::TargetRegistry::RegisterMCAsmBackend
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Definition: TargetRegistry.h:785
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
MCRegisterInfo.h
createCSKYMCAsmInfo
static MCAsmInfo * createCSKYMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Definition: CSKYMCTargetDesc.cpp:31
llvm::TargetRegistry::RegisterMCAsmInfo
static void RegisterMCAsmInfo(Target &T, Target::MCAsmInfoCtorFnTy Fn)
RegisterMCAsmInfo - Register a MCAsmInfo implementation for the given target.
Definition: TargetRegistry.h:712
CSKYMCTargetDesc.h
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:488
llvm::MCAsmInfo::addInitialFrameState
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:81
llvm::MCTargetOptions
Definition: MCTargetOptions.h:36
createCSKYMCRegisterInfo
static MCRegisterInfo * createCSKYMCRegisterInfo(const Triple &TT)
Definition: CSKYMCTargetDesc.cpp:49
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
CSKYMCAsmInfo.h
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
LLVMInitializeCSKYTargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYTargetMC()
Definition: CSKYMCTargetDesc.cpp:55
llvm::TargetRegistry::RegisterMCInstrInfo
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Definition: TargetRegistry.h:725
llvm::TargetRegistry::RegisterMCCodeEmitter
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
Definition: TargetRegistry.h:851
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::TargetRegistry::RegisterMCRegInfo
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Definition: TargetRegistry.h:745
createCSKYMCInstrInfo
static MCInstrInfo * createCSKYMCInstrInfo()
Definition: CSKYMCTargetDesc.cpp:43
CSKYTargetInfo.h
TargetRegistry.h