LLVM 22.0.0git
MSP430MCTargetDesc.cpp
Go to the documentation of this file.
1//===-- MSP430MCTargetDesc.cpp - MSP430 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 MSP430 specific target descriptions.
10//
11//===----------------------------------------------------------------------===//
12
13#include "MSP430MCTargetDesc.h"
14#include "MSP430InstPrinter.h"
15#include "MSP430MCAsmInfo.h"
17#include "llvm/MC/MCDwarf.h"
18#include "llvm/MC/MCInstrInfo.h"
23
24using namespace llvm;
25
26#define GET_INSTRINFO_MC_DESC
27#define ENABLE_INSTR_PREDICATE_VERIFIER
28#include "MSP430GenInstrInfo.inc"
29
30#define GET_SUBTARGETINFO_MC_DESC
31#include "MSP430GenSubtargetInfo.inc"
32
33#define GET_REGINFO_MC_DESC
34#include "MSP430GenRegisterInfo.inc"
35
37 MCInstrInfo *X = new MCInstrInfo();
38 InitMSP430MCInstrInfo(X);
39 return X;
40}
41
44 InitMSP430MCRegisterInfo(X, MSP430::PC);
45 return X;
46}
47
49 const Triple &TT,
50 const MCTargetOptions &Options) {
51 MCAsmInfo *MAI = new MSP430MCAsmInfo(TT);
52
53 // Initialize initial frame state.
54 int stackGrowth = -2;
55
56 // Initial state of the frame pointer is sp+ptr_size.
58 nullptr, MRI.getDwarfRegNum(MSP430::SP, true), -stackGrowth);
59 MAI->addInitialFrameState(Inst);
60
61 // Add return address to move list
63 nullptr, MRI.getDwarfRegNum(MSP430::PC, true), stackGrowth);
64 MAI->addInitialFrameState(Inst2);
65
66 return MAI;
67}
68
69static MCSubtargetInfo *
71 return createMSP430MCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
72}
73
75 unsigned SyntaxVariant,
76 const MCAsmInfo &MAI,
77 const MCInstrInfo &MII,
78 const MCRegisterInfo &MRI) {
79 if (SyntaxVariant == 0)
80 return new MSP430InstPrinter(MAI, MII, MRI);
81 return nullptr;
82}
83
87
97}
unsigned const MachineRegisterInfo * MRI
#define LLVM_ABI
Definition: Compiler.h:213
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static LVOptions Options
Definition: LVOptions.cpp:25
static MCRegisterInfo * createMSP430MCRegisterInfo(const Triple &TT)
static MCSubtargetInfo * createMSP430MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static MCInstPrinter * createMSP430MCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430TargetMC()
static MCAsmInfo * createMSP430MCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
static MCInstrInfo * createMSP430MCInstrInfo()
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:64
void addInitialFrameState(const MCCFIInstruction &Inst)
Definition: MCAsmInfo.cpp:74
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Definition: MCDwarf.h:585
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Definition: MCDwarf.h:627
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:46
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:27
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:47
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCTargetStreamer * createMSP430ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Target & getTheMSP430Target()
MCCodeEmitter * createMSP430MCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Creates a machine code emitter for MSP430.
MCAsmBackend * createMSP430MCAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
static void RegisterMCAsmInfo(Target &T, Target::MCAsmInfoCtorFnTy Fn)
RegisterMCAsmInfo - Register a MCAsmInfo implementation for the given target.
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.