LLVM  16.0.0git
SparcMCTargetDesc.cpp
Go to the documentation of this file.
1 //===-- SparcMCTargetDesc.cpp - Sparc 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 Sparc specific target descriptions.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "SparcMCTargetDesc.h"
14 #include "SparcInstPrinter.h"
15 #include "SparcMCAsmInfo.h"
16 #include "SparcTargetStreamer.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
21 #include "llvm/MC/TargetRegistry.h"
23 
24 using namespace llvm;
25 
26 #define GET_INSTRINFO_MC_DESC
27 #define ENABLE_INSTR_PREDICATE_VERIFIER
28 #include "SparcGenInstrInfo.inc"
29 
30 #define GET_SUBTARGETINFO_MC_DESC
31 #include "SparcGenSubtargetInfo.inc"
32 
33 #define GET_REGINFO_MC_DESC
34 #include "SparcGenRegisterInfo.inc"
35 
37  const Triple &TT,
38  const MCTargetOptions &Options) {
39  MCAsmInfo *MAI = new SparcELFMCAsmInfo(TT);
40  unsigned Reg = MRI.getDwarfRegNum(SP::O6, true);
42  MAI->addInitialFrameState(Inst);
43  return MAI;
44 }
45 
47  const Triple &TT,
48  const MCTargetOptions &Options) {
49  MCAsmInfo *MAI = new SparcELFMCAsmInfo(TT);
50  unsigned Reg = MRI.getDwarfRegNum(SP::O6, true);
51  MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, 2047);
52  MAI->addInitialFrameState(Inst);
53  return MAI;
54 }
55 
57  MCInstrInfo *X = new MCInstrInfo();
58  InitSparcMCInstrInfo(X);
59  return X;
60 }
61 
64  InitSparcMCRegisterInfo(X, SP::O7);
65  return X;
66 }
67 
68 static MCSubtargetInfo *
70  if (CPU.empty())
71  CPU = (TT.getArch() == Triple::sparcv9) ? "v9" : "v8";
72  return createSparcMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
73 }
74 
75 static MCTargetStreamer *
77  return new SparcTargetELFStreamer(S);
78 }
79 
82  MCInstPrinter *InstPrint,
83  bool isVerboseAsm) {
84  return new SparcTargetAsmStreamer(S, OS);
85 }
86 
88  return new SparcTargetStreamer(S);
89 }
90 
92  unsigned SyntaxVariant,
93  const MCAsmInfo &MAI,
94  const MCInstrInfo &MII,
95  const MCRegisterInfo &MRI) {
96  return new SparcInstPrinter(MAI, MII, MRI);
97 }
98 
100  // Register the MC asm info.
104 
105  for (Target *T :
107  // Register the MC instruction info.
109 
110  // Register the MC register info.
112 
113  // Register the MC subtarget info.
115 
116  // Register the MC Code Emitter.
118 
119  // Register the asm backend.
121 
122  // Register the object target streamer.
125 
126  // Register the asm streamer.
128 
129  // Register the null streamer.
131 
132  // Register the MCInstPrinter
134  }
135 }
createSparcMCSubtargetInfo
static MCSubtargetInfo * createSparcMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: SparcMCTargetDesc.cpp:69
SparcTargetInfo.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
SparcMCTargetDesc.h
llvm::createSparcMCCodeEmitter
MCCodeEmitter * createSparcMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Definition: SparcMCCodeEmitter.cpp:248
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
ErrorHandling.h
createSparcMCRegisterInfo
static MCRegisterInfo * createSparcMCRegisterInfo(const Triple &TT)
Definition: SparcMCTargetDesc.cpp:62
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
llvm::TargetRegistry::RegisterAsmTargetStreamer
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1038
llvm::getTheSparcTarget
Target & getTheSparcTarget()
Definition: SparcTargetInfo.cpp:13
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
createTargetAsmStreamer
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Definition: SparcMCTargetDesc.cpp:80
llvm::X86AS::FS
@ FS
Definition: X86.h:200
T
#define T
Definition: Mips16ISelLowering.cpp:341
createSparcV9MCAsmInfo
static MCAsmInfo * createSparcV9MCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Definition: SparcMCTargetDesc.cpp:46
llvm::TargetRegistry::RegisterMCInstPrinter
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Definition: TargetRegistry.h:988
SparcInstPrinter.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:212
llvm::SparcTargetStreamer
Definition: SparcTargetStreamer.h:19
llvm::Triple::sparcv9
@ sparcv9
Definition: Triple.h:78
Y
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
MCInstrInfo.h
llvm::SparcELFMCAsmInfo
Definition: SparcMCAsmInfo.h:22
llvm::getTheSparcelTarget
Target & getTheSparcelTarget()
Definition: SparcTargetInfo.cpp:21
MCSubtargetInfo.h
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
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")
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
createSparcMCInstPrinter
static MCInstPrinter * createSparcMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: SparcMCTargetDesc.cpp:91
llvm::TargetRegistry::RegisterMCAsmBackend
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Definition: TargetRegistry.h:935
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
llvm::TargetRegistry::RegisterObjectTargetStreamer
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1044
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
createSparcMCAsmInfo
static MCAsmInfo * createSparcMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Definition: SparcMCTargetDesc.cpp:36
SparcTargetStreamer.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: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
SparcMCAsmInfo.h
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
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::SparcTargetELFStreamer
Definition: SparcTargetStreamer.h:41
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::TargetRegistry::RegisterMCCodeEmitter
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
Definition: TargetRegistry.h:1001
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
llvm::ARCCC::Z
@ Z
Definition: ARCInfo.h:41
createNullTargetStreamer
static MCTargetStreamer * createNullTargetStreamer(MCStreamer &S)
Definition: SparcMCTargetDesc.cpp:87
llvm::TargetRegistry::RegisterNullTargetStreamer
static void RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1033
createSparcMCInstrInfo
static MCInstrInfo * createSparcMCInstrInfo()
Definition: SparcMCTargetDesc.cpp:56
llvm::SparcInstPrinter
Definition: SparcInstPrinter.h:20
LLVMInitializeSparcTargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcTargetMC()
Definition: SparcMCTargetDesc.cpp:99
llvm::SparcTargetAsmStreamer
Definition: SparcTargetStreamer.h:31
TargetRegistry.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76
llvm::getTheSparcV9Target
Target & getTheSparcV9Target()
Definition: SparcTargetInfo.cpp:17
createObjectTargetStreamer
static MCTargetStreamer * createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition: SparcMCTargetDesc.cpp:76
llvm::createSparcAsmBackend
MCAsmBackend * createSparcAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
Definition: SparcAsmBackend.cpp:371