LLVM 19.0.0git
TargetRegistry.h
Go to the documentation of this file.
1//===- MC/TargetRegistry.h - Target Registration ----------------*- 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 exposes the TargetRegistry interface, which tools can use to access
10// the appropriate target specific classes (TargetMachine, AsmPrinter, etc.)
11// which have been registered.
12//
13// Target specific class implementations should register themselves using the
14// appropriate TargetRegistry interfaces.
15//
16//===----------------------------------------------------------------------===//
17
18#ifndef LLVM_MC_TARGETREGISTRY_H
19#define LLVM_MC_TARGETREGISTRY_H
20
22#include "llvm/ADT/StringRef.h"
29#include <cassert>
30#include <cstddef>
31#include <iterator>
32#include <memory>
33#include <optional>
34#include <string>
35
36namespace llvm {
37
38class AsmPrinter;
39class MCAsmBackend;
40class MCAsmInfo;
41class MCAsmParser;
42class MCCodeEmitter;
43class MCContext;
44class MCDisassembler;
45class MCInstPrinter;
46class MCInstrAnalysis;
47class MCInstrInfo;
48class MCObjectWriter;
49class MCRegisterInfo;
50class MCRelocationInfo;
51class MCStreamer;
52class MCSubtargetInfo;
53class MCSymbolizer;
54class MCTargetAsmParser;
55class MCTargetOptions;
56class MCTargetStreamer;
57class raw_ostream;
58class TargetMachine;
59class TargetOptions;
60namespace mca {
61class CustomBehaviour;
64struct SourceMgr;
65} // namespace mca
66
68// Takes ownership of \p TAB and \p CE.
69
70/// Create a machine code streamer which will print out assembly for the native
71/// target, suitable for compiling with a native assembler.
72///
73/// \param InstPrint - If given, the instruction printer to use. If not given
74/// the MCInst representation will be printed. This method takes ownership of
75/// InstPrint.
76///
77/// \param CE - If given, a code emitter to use to show the instruction
78/// encoding inline with the assembly. This method takes ownership of \p CE.
79///
80/// \param TAB - If given, a target asm backend to use to show the fixup
81/// information in conjunction with encoding information. This method takes
82/// ownership of \p TAB.
83///
84/// \param ShowInst - Whether to show the MCInst representation inline with
85/// the assembly.
87createAsmStreamer(MCContext &Ctx, std::unique_ptr<formatted_raw_ostream> OS,
88 bool isVerboseAsm, bool useDwarfDirectory,
89 MCInstPrinter *InstPrint, std::unique_ptr<MCCodeEmitter> &&CE,
90 std::unique_ptr<MCAsmBackend> &&TAB, bool ShowInst);
91
93 std::unique_ptr<MCAsmBackend> &&TAB,
94 std::unique_ptr<MCObjectWriter> &&OW,
95 std::unique_ptr<MCCodeEmitter> &&CE);
97 std::unique_ptr<MCAsmBackend> &&TAB,
98 std::unique_ptr<MCObjectWriter> &&OW,
99 std::unique_ptr<MCCodeEmitter> &&CE);
101 std::unique_ptr<MCAsmBackend> &&TAB,
102 std::unique_ptr<MCObjectWriter> &&OW,
103 std::unique_ptr<MCCodeEmitter> &&CE,
104 bool DWARFMustBeAtTheEnd,
105 bool LabelSections = false);
107 std::unique_ptr<MCAsmBackend> &&TAB,
108 std::unique_ptr<MCObjectWriter> &&OW,
109 std::unique_ptr<MCCodeEmitter> &&CE);
111 std::unique_ptr<MCAsmBackend> &&TAB,
112 std::unique_ptr<MCObjectWriter> &&OW,
113 std::unique_ptr<MCCodeEmitter> &&CE);
115 std::unique_ptr<MCAsmBackend> &&TAB,
116 std::unique_ptr<MCObjectWriter> &&OW,
117 std::unique_ptr<MCCodeEmitter> &&CE);
119 std::unique_ptr<MCAsmBackend> &&TAB,
120 std::unique_ptr<MCObjectWriter> &&OW,
121 std::unique_ptr<MCCodeEmitter> &&CE);
122
124
126 LLVMSymbolLookupCallback SymbolLookUp,
127 void *DisInfo, MCContext *Ctx,
128 std::unique_ptr<MCRelocationInfo> &&RelInfo);
129
131 const mca::SourceMgr &SrcMgr,
132 const MCInstrInfo &MCII);
133
135 const MCInstrInfo &MCII);
136
138 const MCInstrInfo &MCII);
139
140/// Target - Wrapper for Target specific information.
141///
142/// For registration purposes, this is a POD type so that targets can be
143/// registered without the use of static constructors.
144///
145/// Targets should implement a single global instance of this class (which
146/// will be zero initialized), and pass that instance to the TargetRegistry as
147/// part of their initialization.
148class Target {
149public:
150 friend struct TargetRegistry;
151
153
155 const Triple &TT,
156 const MCTargetOptions &Options);
158 bool PIC,
159 bool LargeCodeModel);
162 using MCRegInfoCtorFnTy = MCRegisterInfo *(*)(const Triple &TT);
164 StringRef CPU,
165 StringRef Features);
167 *(*)(const Target &T, const Triple &TT, StringRef CPU, StringRef Features,
168 const TargetOptions &Options, std::optional<Reloc::Model> RM,
169 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, bool JIT);
170 // If it weren't for layering issues (this header is in llvm/Support, but
171 // depends on MC?) this should take the Streamer by value rather than rvalue
172 // reference.
174 TargetMachine &TM, std::unique_ptr<MCStreamer> &&Streamer);
176 const MCSubtargetInfo &STI,
177 const MCRegisterInfo &MRI,
178 const MCTargetOptions &Options);
180 const MCSubtargetInfo &STI, MCAsmParser &P, const MCInstrInfo &MII,
181 const MCTargetOptions &Options);
183 const MCSubtargetInfo &STI,
184 MCContext &Ctx);
186 unsigned SyntaxVariant,
187 const MCAsmInfo &MAI,
188 const MCInstrInfo &MII,
189 const MCRegisterInfo &MRI);
191 MCContext &Ctx);
193 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
194 std::unique_ptr<MCAsmBackend> &&TAB,
195 std::unique_ptr<MCObjectWriter> &&OW,
196 std::unique_ptr<MCCodeEmitter> &&Emitter);
198 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
199 std::unique_ptr<MCObjectWriter> &&OW,
200 std::unique_ptr<MCCodeEmitter> &&Emitter);
202 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
203 std::unique_ptr<MCObjectWriter> &&OW,
204 std::unique_ptr<MCCodeEmitter> &&Emitter,
205 bool DWARFMustBeAtTheEnd);
207 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
208 std::unique_ptr<MCObjectWriter> &&OW,
209 std::unique_ptr<MCCodeEmitter> &&Emitter,
210 bool IncrementalLinkerCompatible);
212 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
213 std::unique_ptr<MCAsmBackend> &&TAB,
214 std::unique_ptr<MCObjectWriter> &&OW,
215 std::unique_ptr<MCCodeEmitter> &&Emitter);
217 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
218 std::unique_ptr<MCAsmBackend> &&TAB,
219 std::unique_ptr<MCObjectWriter> &&OW,
220 std::unique_ptr<MCCodeEmitter> &&Emitter);
222 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
223 std::unique_ptr<MCAsmBackend> &&TAB,
224 std::unique_ptr<MCObjectWriter> &&OW,
225 std::unique_ptr<MCCodeEmitter> &&Emitter);
226
228 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
229 std::unique_ptr<MCAsmBackend> &&TAB,
230 std::unique_ptr<MCObjectWriter> &&OW,
231 std::unique_ptr<MCCodeEmitter> &&Emitter);
232
236 bool IsVerboseAsm);
238 MCStreamer &S, const MCSubtargetInfo &STI);
240 MCContext &Ctx);
242 const Triple &TT, LLVMOpInfoCallback GetOpInfo,
243 LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx,
244 std::unique_ptr<MCRelocationInfo> &&RelInfo);
245
248 const mca::SourceMgr &SrcMgr,
249 const MCInstrInfo &MCII);
250
253 const MCInstrInfo &MCII);
254
257 const MCInstrInfo &MCII);
258
259private:
260 /// Next - The next registered target in the linked list, maintained by the
261 /// TargetRegistry.
262 Target *Next;
263
264 /// The target function for checking if an architecture is supported.
265 ArchMatchFnTy ArchMatchFn;
266
267 /// Name - The target name.
268 const char *Name;
269
270 /// ShortDesc - A short description of the target.
271 const char *ShortDesc;
272
273 /// BackendName - The name of the backend implementation. This must match the
274 /// name of the 'def X : Target ...' in TableGen.
275 const char *BackendName;
276
277 /// HasJIT - Whether this target supports the JIT.
278 bool HasJIT;
279
280 /// MCAsmInfoCtorFn - Constructor function for this target's MCAsmInfo, if
281 /// registered.
282 MCAsmInfoCtorFnTy MCAsmInfoCtorFn;
283
284 /// Constructor function for this target's MCObjectFileInfo, if registered.
285 MCObjectFileInfoCtorFnTy MCObjectFileInfoCtorFn;
286
287 /// MCInstrInfoCtorFn - Constructor function for this target's MCInstrInfo,
288 /// if registered.
289 MCInstrInfoCtorFnTy MCInstrInfoCtorFn;
290
291 /// MCInstrAnalysisCtorFn - Constructor function for this target's
292 /// MCInstrAnalysis, if registered.
293 MCInstrAnalysisCtorFnTy MCInstrAnalysisCtorFn;
294
295 /// MCRegInfoCtorFn - Constructor function for this target's MCRegisterInfo,
296 /// if registered.
297 MCRegInfoCtorFnTy MCRegInfoCtorFn;
298
299 /// MCSubtargetInfoCtorFn - Constructor function for this target's
300 /// MCSubtargetInfo, if registered.
301 MCSubtargetInfoCtorFnTy MCSubtargetInfoCtorFn;
302
303 /// TargetMachineCtorFn - Construction function for this target's
304 /// TargetMachine, if registered.
305 TargetMachineCtorTy TargetMachineCtorFn;
306
307 /// MCAsmBackendCtorFn - Construction function for this target's
308 /// MCAsmBackend, if registered.
309 MCAsmBackendCtorTy MCAsmBackendCtorFn;
310
311 /// MCAsmParserCtorFn - Construction function for this target's
312 /// MCTargetAsmParser, if registered.
313 MCAsmParserCtorTy MCAsmParserCtorFn;
314
315 /// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
316 /// if registered.
317 AsmPrinterCtorTy AsmPrinterCtorFn;
318
319 /// MCDisassemblerCtorFn - Construction function for this target's
320 /// MCDisassembler, if registered.
321 MCDisassemblerCtorTy MCDisassemblerCtorFn;
322
323 /// MCInstPrinterCtorFn - Construction function for this target's
324 /// MCInstPrinter, if registered.
325 MCInstPrinterCtorTy MCInstPrinterCtorFn;
326
327 /// MCCodeEmitterCtorFn - Construction function for this target's
328 /// CodeEmitter, if registered.
329 MCCodeEmitterCtorTy MCCodeEmitterCtorFn;
330
331 // Construction functions for the various object formats, if registered.
332 COFFStreamerCtorTy COFFStreamerCtorFn = nullptr;
333 GOFFStreamerCtorTy GOFFStreamerCtorFn = nullptr;
334 MachOStreamerCtorTy MachOStreamerCtorFn = nullptr;
335 ELFStreamerCtorTy ELFStreamerCtorFn = nullptr;
336 WasmStreamerCtorTy WasmStreamerCtorFn = nullptr;
337 XCOFFStreamerCtorTy XCOFFStreamerCtorFn = nullptr;
338 SPIRVStreamerCtorTy SPIRVStreamerCtorFn = nullptr;
339 DXContainerStreamerCtorTy DXContainerStreamerCtorFn = nullptr;
340
341 /// Construction function for this target's null TargetStreamer, if
342 /// registered (default = nullptr).
343 NullTargetStreamerCtorTy NullTargetStreamerCtorFn = nullptr;
344
345 /// Construction function for this target's asm TargetStreamer, if
346 /// registered (default = nullptr).
347 AsmTargetStreamerCtorTy AsmTargetStreamerCtorFn = nullptr;
348
349 /// Construction function for this target's obj TargetStreamer, if
350 /// registered (default = nullptr).
351 ObjectTargetStreamerCtorTy ObjectTargetStreamerCtorFn = nullptr;
352
353 /// MCRelocationInfoCtorFn - Construction function for this target's
354 /// MCRelocationInfo, if registered (default = llvm::createMCRelocationInfo)
355 MCRelocationInfoCtorTy MCRelocationInfoCtorFn = nullptr;
356
357 /// MCSymbolizerCtorFn - Construction function for this target's
358 /// MCSymbolizer, if registered (default = llvm::createMCSymbolizer)
359 MCSymbolizerCtorTy MCSymbolizerCtorFn = nullptr;
360
361 /// CustomBehaviourCtorFn - Construction function for this target's
362 /// CustomBehaviour, if registered (default = nullptr).
363 CustomBehaviourCtorTy CustomBehaviourCtorFn = nullptr;
364
365 /// InstrPostProcessCtorFn - Construction function for this target's
366 /// InstrPostProcess, if registered (default = nullptr).
367 InstrPostProcessCtorTy InstrPostProcessCtorFn = nullptr;
368
369 /// InstrumentManagerCtorFn - Construction function for this target's
370 /// InstrumentManager, if registered (default = nullptr).
371 InstrumentManagerCtorTy InstrumentManagerCtorFn = nullptr;
372
373public:
374 Target() = default;
375
376 /// @name Target Information
377 /// @{
378
379 // getNext - Return the next registered target.
380 const Target *getNext() const { return Next; }
381
382 /// getName - Get the target name.
383 const char *getName() const { return Name; }
384
385 /// getShortDescription - Get a short description of the target.
386 const char *getShortDescription() const { return ShortDesc; }
387
388 /// getBackendName - Get the backend name.
389 const char *getBackendName() const { return BackendName; }
390
391 /// @}
392 /// @name Feature Predicates
393 /// @{
394
395 /// hasJIT - Check if this targets supports the just-in-time compilation.
396 bool hasJIT() const { return HasJIT; }
397
398 /// hasTargetMachine - Check if this target supports code generation.
399 bool hasTargetMachine() const { return TargetMachineCtorFn != nullptr; }
400
401 /// hasMCAsmBackend - Check if this target supports .o generation.
402 bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != nullptr; }
403
404 /// hasMCAsmParser - Check if this target supports assembly parsing.
405 bool hasMCAsmParser() const { return MCAsmParserCtorFn != nullptr; }
406
407 /// @}
408 /// @name Feature Constructors
409 /// @{
410
411 /// createMCAsmInfo - Create a MCAsmInfo implementation for the specified
412 /// target triple.
413 ///
414 /// \param TheTriple This argument is used to determine the target machine
415 /// feature set; it should always be provided. Generally this should be
416 /// either the target triple from the module, or the target triple of the
417 /// host if that does not exist.
419 const MCTargetOptions &Options) const {
420 if (!MCAsmInfoCtorFn)
421 return nullptr;
422 return MCAsmInfoCtorFn(MRI, Triple(TheTriple), Options);
423 }
424
425 /// Create a MCObjectFileInfo implementation for the specified target
426 /// triple.
427 ///
429 bool LargeCodeModel = false) const {
430 if (!MCObjectFileInfoCtorFn) {
432 MOFI->initMCObjectFileInfo(Ctx, PIC, LargeCodeModel);
433 return MOFI;
434 }
435 return MCObjectFileInfoCtorFn(Ctx, PIC, LargeCodeModel);
436 }
437
438 /// createMCInstrInfo - Create a MCInstrInfo implementation.
439 ///
441 if (!MCInstrInfoCtorFn)
442 return nullptr;
443 return MCInstrInfoCtorFn();
444 }
445
446 /// createMCInstrAnalysis - Create a MCInstrAnalysis implementation.
447 ///
449 if (!MCInstrAnalysisCtorFn)
450 return nullptr;
451 return MCInstrAnalysisCtorFn(Info);
452 }
453
454 /// createMCRegInfo - Create a MCRegisterInfo implementation.
455 ///
457 if (!MCRegInfoCtorFn)
458 return nullptr;
459 return MCRegInfoCtorFn(Triple(TT));
460 }
461
462 /// createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
463 ///
464 /// \param TheTriple This argument is used to determine the target machine
465 /// feature set; it should always be provided. Generally this should be
466 /// either the target triple from the module, or the target triple of the
467 /// host if that does not exist.
468 /// \param CPU This specifies the name of the target CPU.
469 /// \param Features This specifies the string representation of the
470 /// additional target features.
472 StringRef Features) const {
473 if (!MCSubtargetInfoCtorFn)
474 return nullptr;
475 return MCSubtargetInfoCtorFn(Triple(TheTriple), CPU, Features);
476 }
477
478 /// createTargetMachine - Create a target specific machine implementation
479 /// for the specified \p Triple.
480 ///
481 /// \param TT This argument is used to determine the target machine
482 /// feature set; it should always be provided. Generally this should be
483 /// either the target triple from the module, or the target triple of the
484 /// host if that does not exist.
486 StringRef TT, StringRef CPU, StringRef Features,
487 const TargetOptions &Options, std::optional<Reloc::Model> RM,
488 std::optional<CodeModel::Model> CM = std::nullopt,
489 CodeGenOptLevel OL = CodeGenOptLevel::Default, bool JIT = false) const {
490 if (!TargetMachineCtorFn)
491 return nullptr;
492 return TargetMachineCtorFn(*this, Triple(TT), CPU, Features, Options, RM,
493 CM, OL, JIT);
494 }
495
496 /// createMCAsmBackend - Create a target specific assembly parser.
498 const MCRegisterInfo &MRI,
499 const MCTargetOptions &Options) const {
500 if (!MCAsmBackendCtorFn)
501 return nullptr;
502 return MCAsmBackendCtorFn(*this, STI, MRI, Options);
503 }
504
505 /// createMCAsmParser - Create a target specific assembly parser.
506 ///
507 /// \param Parser The target independent parser implementation to use for
508 /// parsing and lexing.
510 MCAsmParser &Parser,
511 const MCInstrInfo &MII,
512 const MCTargetOptions &Options) const {
513 if (!MCAsmParserCtorFn)
514 return nullptr;
515 return MCAsmParserCtorFn(STI, Parser, MII, Options);
516 }
517
518 /// createAsmPrinter - Create a target specific assembly printer pass. This
519 /// takes ownership of the MCStreamer object.
521 std::unique_ptr<MCStreamer> &&Streamer) const {
522 if (!AsmPrinterCtorFn)
523 return nullptr;
524 return AsmPrinterCtorFn(TM, std::move(Streamer));
525 }
526
528 MCContext &Ctx) const {
529 if (!MCDisassemblerCtorFn)
530 return nullptr;
531 return MCDisassemblerCtorFn(*this, STI, Ctx);
532 }
533
534 MCInstPrinter *createMCInstPrinter(const Triple &T, unsigned SyntaxVariant,
535 const MCAsmInfo &MAI,
536 const MCInstrInfo &MII,
537 const MCRegisterInfo &MRI) const {
538 if (!MCInstPrinterCtorFn)
539 return nullptr;
540 return MCInstPrinterCtorFn(T, SyntaxVariant, MAI, MII, MRI);
541 }
542
543 /// createMCCodeEmitter - Create a target specific code emitter.
545 MCContext &Ctx) const {
546 if (!MCCodeEmitterCtorFn)
547 return nullptr;
548 return MCCodeEmitterCtorFn(II, Ctx);
549 }
550
551 /// Create a target specific MCStreamer.
552 ///
553 /// \param T The target triple.
554 /// \param Ctx The target context.
555 /// \param TAB The target assembler backend object. Takes ownership.
556 /// \param OW The stream object.
557 /// \param Emitter The target independent assembler object.Takes ownership.
558 /// \param RelaxAll Relax all fixups?
560 std::unique_ptr<MCAsmBackend> &&TAB,
561 std::unique_ptr<MCObjectWriter> &&OW,
562 std::unique_ptr<MCCodeEmitter> &&Emitter,
563 const MCSubtargetInfo &STI, bool,
564 bool IncrementalLinkerCompatible,
565 bool DWARFMustBeAtTheEnd) const {
566 MCStreamer *S = nullptr;
567 switch (T.getObjectFormat()) {
569 llvm_unreachable("Unknown object format");
570 case Triple::COFF:
571 assert((T.isOSWindows() || T.isUEFI()) &&
572 "only Windows and UEFI COFF are supported");
573 S = COFFStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
574 std::move(Emitter), IncrementalLinkerCompatible);
575 break;
576 case Triple::MachO:
577 if (MachOStreamerCtorFn)
578 S = MachOStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
579 std::move(Emitter), DWARFMustBeAtTheEnd);
580 else
581 S = createMachOStreamer(Ctx, std::move(TAB), std::move(OW),
582 std::move(Emitter), DWARFMustBeAtTheEnd);
583 break;
584 case Triple::ELF:
585 if (ELFStreamerCtorFn)
586 S = ELFStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
587 std::move(Emitter));
588 else
589 S = createELFStreamer(Ctx, std::move(TAB), std::move(OW),
590 std::move(Emitter));
591 break;
592 case Triple::Wasm:
593 if (WasmStreamerCtorFn)
594 S = WasmStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
595 std::move(Emitter));
596 else
597 S = createWasmStreamer(Ctx, std::move(TAB), std::move(OW),
598 std::move(Emitter));
599 break;
600 case Triple::GOFF:
601 if (GOFFStreamerCtorFn)
602 S = GOFFStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
603 std::move(Emitter));
604 else
605 S = createGOFFStreamer(Ctx, std::move(TAB), std::move(OW),
606 std::move(Emitter));
607 break;
608 case Triple::XCOFF:
609 if (XCOFFStreamerCtorFn)
610 S = XCOFFStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
611 std::move(Emitter));
612 else
613 S = createXCOFFStreamer(Ctx, std::move(TAB), std::move(OW),
614 std::move(Emitter));
615 break;
616 case Triple::SPIRV:
617 if (SPIRVStreamerCtorFn)
618 S = SPIRVStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
619 std::move(Emitter));
620 else
621 S = createSPIRVStreamer(Ctx, std::move(TAB), std::move(OW),
622 std::move(Emitter));
623 break;
625 if (DXContainerStreamerCtorFn)
626 S = DXContainerStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
627 std::move(Emitter));
628 else
629 S = createDXContainerStreamer(Ctx, std::move(TAB), std::move(OW),
630 std::move(Emitter));
631 break;
632 }
633 if (ObjectTargetStreamerCtorFn)
634 ObjectTargetStreamerCtorFn(*S, STI);
635 return S;
636 }
637
639 std::unique_ptr<formatted_raw_ostream> OS,
640 bool IsVerboseAsm, bool UseDwarfDirectory,
641 MCInstPrinter *InstPrint,
642 std::unique_ptr<MCCodeEmitter> &&CE,
643 std::unique_ptr<MCAsmBackend> &&TAB,
644 bool ShowInst) const {
645 formatted_raw_ostream &OSRef = *OS;
647 Ctx, std::move(OS), IsVerboseAsm, UseDwarfDirectory, InstPrint,
648 std::move(CE), std::move(TAB), ShowInst);
649 createAsmTargetStreamer(*S, OSRef, InstPrint, IsVerboseAsm);
650 return S;
651 }
652
655 MCInstPrinter *InstPrint,
656 bool IsVerboseAsm) const {
657 if (AsmTargetStreamerCtorFn)
658 return AsmTargetStreamerCtorFn(S, OS, InstPrint, IsVerboseAsm);
659 return nullptr;
660 }
661
665 return S;
666 }
667
669 if (NullTargetStreamerCtorFn)
670 return NullTargetStreamerCtorFn(S);
671 return nullptr;
672 }
673
674 /// createMCRelocationInfo - Create a target specific MCRelocationInfo.
675 ///
676 /// \param TT The target triple.
677 /// \param Ctx The target context.
679 MCRelocationInfoCtorTy Fn = MCRelocationInfoCtorFn
680 ? MCRelocationInfoCtorFn
682 return Fn(Triple(TT), Ctx);
683 }
684
685 /// createMCSymbolizer - Create a target specific MCSymbolizer.
686 ///
687 /// \param TT The target triple.
688 /// \param GetOpInfo The function to get the symbolic information for
689 /// operands.
690 /// \param SymbolLookUp The function to lookup a symbol name.
691 /// \param DisInfo The pointer to the block of symbolic information for above
692 /// call
693 /// back.
694 /// \param Ctx The target context.
695 /// \param RelInfo The relocation information for this target. Takes
696 /// ownership.
699 LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo,
700 MCContext *Ctx,
701 std::unique_ptr<MCRelocationInfo> &&RelInfo) const {
703 MCSymbolizerCtorFn ? MCSymbolizerCtorFn : llvm::createMCSymbolizer;
704 return Fn(Triple(TT), GetOpInfo, SymbolLookUp, DisInfo, Ctx,
705 std::move(RelInfo));
706 }
707
708 /// createCustomBehaviour - Create a target specific CustomBehaviour.
709 /// This class is used by llvm-mca and requires backend functionality.
711 const mca::SourceMgr &SrcMgr,
712 const MCInstrInfo &MCII) const {
713 if (CustomBehaviourCtorFn)
714 return CustomBehaviourCtorFn(STI, SrcMgr, MCII);
715 return nullptr;
716 }
717
718 /// createInstrPostProcess - Create a target specific InstrPostProcess.
719 /// This class is used by llvm-mca and requires backend functionality.
721 const MCInstrInfo &MCII) const {
722 if (InstrPostProcessCtorFn)
723 return InstrPostProcessCtorFn(STI, MCII);
724 return nullptr;
725 }
726
727 /// createInstrumentManager - Create a target specific
728 /// InstrumentManager. This class is used by llvm-mca and requires
729 /// backend functionality.
732 const MCInstrInfo &MCII) const {
733 if (InstrumentManagerCtorFn)
734 return InstrumentManagerCtorFn(STI, MCII);
735 return nullptr;
736 }
737
738 /// @}
739};
740
741/// TargetRegistry - Generic interface to target specific features.
743 // FIXME: Make this a namespace, probably just move all the Register*
744 // functions into Target (currently they all just set members on the Target
745 // anyway, and Target friends this class so those functions can...
746 // function).
747 TargetRegistry() = delete;
748
749 class iterator {
750 friend struct TargetRegistry;
751
752 const Target *Current = nullptr;
753
754 explicit iterator(Target *T) : Current(T) {}
755
756 public:
757 using iterator_category = std::forward_iterator_tag;
759 using difference_type = std::ptrdiff_t;
762
763 iterator() = default;
764
765 bool operator==(const iterator &x) const { return Current == x.Current; }
766 bool operator!=(const iterator &x) const { return !operator==(x); }
767
768 // Iterator traversal: forward iteration only
769 iterator &operator++() { // Preincrement
770 assert(Current && "Cannot increment end iterator!");
771 Current = Current->getNext();
772 return *this;
773 }
774 iterator operator++(int) { // Postincrement
775 iterator tmp = *this;
776 ++*this;
777 return tmp;
778 }
779
780 const Target &operator*() const {
781 assert(Current && "Cannot dereference end iterator!");
782 return *Current;
783 }
784
785 const Target *operator->() const { return &operator*(); }
786 };
787
788 /// printRegisteredTargetsForVersion - Print the registered targets
789 /// appropriately for inclusion in a tool's version output.
791
792 /// @name Registry Access
793 /// @{
794
796
797 /// lookupTarget - Lookup a target based on a target triple.
798 ///
799 /// \param Triple - The triple to use for finding a target.
800 /// \param Error - On failure, an error string describing why no target was
801 /// found.
802 static const Target *lookupTarget(StringRef Triple, std::string &Error);
803
804 /// lookupTarget - Lookup a target based on an architecture name
805 /// and a target triple. If the architecture name is non-empty,
806 /// then the lookup is done by architecture. Otherwise, the target
807 /// triple is used.
808 ///
809 /// \param ArchName - The architecture to use for finding a target.
810 /// \param TheTriple - The triple to use for finding a target. The
811 /// triple is updated with canonical architecture name if a lookup
812 /// by architecture is done.
813 /// \param Error - On failure, an error string describing why no target was
814 /// found.
815 static const Target *lookupTarget(StringRef ArchName, Triple &TheTriple,
816 std::string &Error);
817
818 /// @}
819 /// @name Target Registration
820 /// @{
821
822 /// RegisterTarget - Register the given target. Attempts to register a
823 /// target which has already been registered will be ignored.
824 ///
825 /// Clients are responsible for ensuring that registration doesn't occur
826 /// while another thread is attempting to access the registry. Typically
827 /// this is done by initializing all targets at program startup.
828 ///
829 /// @param T - The target being registered.
830 /// @param Name - The target name. This should be a static string.
831 /// @param ShortDesc - A short target description. This should be a static
832 /// string.
833 /// @param BackendName - The name of the backend. This should be a static
834 /// string that is the same for all targets that share a backend
835 /// implementation and must match the name used in the 'def X : Target ...' in
836 /// TableGen.
837 /// @param ArchMatchFn - The arch match checking function for this target.
838 /// @param HasJIT - Whether the target supports JIT code
839 /// generation.
840 static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
841 const char *BackendName,
842 Target::ArchMatchFnTy ArchMatchFn,
843 bool HasJIT = false);
844
845 /// RegisterMCAsmInfo - Register a MCAsmInfo implementation for the
846 /// given target.
847 ///
848 /// Clients are responsible for ensuring that registration doesn't occur
849 /// while another thread is attempting to access the registry. Typically
850 /// this is done by initializing all targets at program startup.
851 ///
852 /// @param T - The target being registered.
853 /// @param Fn - A function to construct a MCAsmInfo for the target.
855 T.MCAsmInfoCtorFn = Fn;
856 }
857
858 /// Register a MCObjectFileInfo implementation for the given target.
859 ///
860 /// Clients are responsible for ensuring that registration doesn't occur
861 /// while another thread is attempting to access the registry. Typically
862 /// this is done by initializing all targets at program startup.
863 ///
864 /// @param T - The target being registered.
865 /// @param Fn - A function to construct a MCObjectFileInfo for the target.
868 T.MCObjectFileInfoCtorFn = Fn;
869 }
870
871 /// RegisterMCInstrInfo - Register a MCInstrInfo implementation for the
872 /// given target.
873 ///
874 /// Clients are responsible for ensuring that registration doesn't occur
875 /// while another thread is attempting to access the registry. Typically
876 /// this is done by initializing all targets at program startup.
877 ///
878 /// @param T - The target being registered.
879 /// @param Fn - A function to construct a MCInstrInfo for the target.
881 T.MCInstrInfoCtorFn = Fn;
882 }
883
884 /// RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for
885 /// the given target.
888 T.MCInstrAnalysisCtorFn = Fn;
889 }
890
891 /// RegisterMCRegInfo - Register a MCRegisterInfo implementation for the
892 /// given target.
893 ///
894 /// Clients are responsible for ensuring that registration doesn't occur
895 /// while another thread is attempting to access the registry. Typically
896 /// this is done by initializing all targets at program startup.
897 ///
898 /// @param T - The target being registered.
899 /// @param Fn - A function to construct a MCRegisterInfo for the target.
901 T.MCRegInfoCtorFn = Fn;
902 }
903
904 /// RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for
905 /// the given target.
906 ///
907 /// Clients are responsible for ensuring that registration doesn't occur
908 /// while another thread is attempting to access the registry. Typically
909 /// this is done by initializing all targets at program startup.
910 ///
911 /// @param T - The target being registered.
912 /// @param Fn - A function to construct a MCSubtargetInfo for the target.
915 T.MCSubtargetInfoCtorFn = Fn;
916 }
917
918 /// RegisterTargetMachine - Register a TargetMachine implementation for the
919 /// given target.
920 ///
921 /// Clients are responsible for ensuring that registration doesn't occur
922 /// while another thread is attempting to access the registry. Typically
923 /// this is done by initializing all targets at program startup.
924 ///
925 /// @param T - The target being registered.
926 /// @param Fn - A function to construct a TargetMachine for the target.
928 T.TargetMachineCtorFn = Fn;
929 }
930
931 /// RegisterMCAsmBackend - Register a MCAsmBackend implementation for the
932 /// given target.
933 ///
934 /// Clients are responsible for ensuring that registration doesn't occur
935 /// while another thread is attempting to access the registry. Typically
936 /// this is done by initializing all targets at program startup.
937 ///
938 /// @param T - The target being registered.
939 /// @param Fn - A function to construct an AsmBackend for the target.
941 T.MCAsmBackendCtorFn = Fn;
942 }
943
944 /// RegisterMCAsmParser - Register a MCTargetAsmParser implementation for
945 /// the given target.
946 ///
947 /// Clients are responsible for ensuring that registration doesn't occur
948 /// while another thread is attempting to access the registry. Typically
949 /// this is done by initializing all targets at program startup.
950 ///
951 /// @param T - The target being registered.
952 /// @param Fn - A function to construct an MCTargetAsmParser for the target.
954 T.MCAsmParserCtorFn = Fn;
955 }
956
957 /// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
958 /// target.
959 ///
960 /// Clients are responsible for ensuring that registration doesn't occur
961 /// while another thread is attempting to access the registry. Typically
962 /// this is done by initializing all targets at program startup.
963 ///
964 /// @param T - The target being registered.
965 /// @param Fn - A function to construct an AsmPrinter for the target.
967 T.AsmPrinterCtorFn = Fn;
968 }
969
970 /// RegisterMCDisassembler - Register a MCDisassembler implementation for
971 /// the given target.
972 ///
973 /// Clients are responsible for ensuring that registration doesn't occur
974 /// while another thread is attempting to access the registry. Typically
975 /// this is done by initializing all targets at program startup.
976 ///
977 /// @param T - The target being registered.
978 /// @param Fn - A function to construct an MCDisassembler for the target.
981 T.MCDisassemblerCtorFn = Fn;
982 }
983
984 /// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
985 /// given target.
986 ///
987 /// Clients are responsible for ensuring that registration doesn't occur
988 /// while another thread is attempting to access the registry. Typically
989 /// this is done by initializing all targets at program startup.
990 ///
991 /// @param T - The target being registered.
992 /// @param Fn - A function to construct an MCInstPrinter for the target.
994 T.MCInstPrinterCtorFn = Fn;
995 }
996
997 /// RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the
998 /// given target.
999 ///
1000 /// Clients are responsible for ensuring that registration doesn't occur
1001 /// while another thread is attempting to access the registry. Typically
1002 /// this is done by initializing all targets at program startup.
1003 ///
1004 /// @param T - The target being registered.
1005 /// @param Fn - A function to construct an MCCodeEmitter for the target.
1007 T.MCCodeEmitterCtorFn = Fn;
1008 }
1009
1011 T.COFFStreamerCtorFn = Fn;
1012 }
1013
1015 T.GOFFStreamerCtorFn = Fn;
1016 }
1017
1019 T.MachOStreamerCtorFn = Fn;
1020 }
1021
1023 T.ELFStreamerCtorFn = Fn;
1024 }
1025
1027 T.SPIRVStreamerCtorFn = Fn;
1028 }
1029
1031 T.DXContainerStreamerCtorFn = Fn;
1032 }
1033
1035 T.WasmStreamerCtorFn = Fn;
1036 }
1037
1039 T.XCOFFStreamerCtorFn = Fn;
1040 }
1041
1044 T.NullTargetStreamerCtorFn = Fn;
1045 }
1046
1049 T.AsmTargetStreamerCtorFn = Fn;
1050 }
1051
1052 static void
1055 T.ObjectTargetStreamerCtorFn = Fn;
1056 }
1057
1058 /// RegisterMCRelocationInfo - Register an MCRelocationInfo
1059 /// implementation for the given target.
1060 ///
1061 /// Clients are responsible for ensuring that registration doesn't occur
1062 /// while another thread is attempting to access the registry. Typically
1063 /// this is done by initializing all targets at program startup.
1064 ///
1065 /// @param T - The target being registered.
1066 /// @param Fn - A function to construct an MCRelocationInfo for the target.
1069 T.MCRelocationInfoCtorFn = Fn;
1070 }
1071
1072 /// RegisterMCSymbolizer - Register an MCSymbolizer
1073 /// implementation for the given target.
1074 ///
1075 /// Clients are responsible for ensuring that registration doesn't occur
1076 /// while another thread is attempting to access the registry. Typically
1077 /// this is done by initializing all targets at program startup.
1078 ///
1079 /// @param T - The target being registered.
1080 /// @param Fn - A function to construct an MCSymbolizer for the target.
1082 T.MCSymbolizerCtorFn = Fn;
1083 }
1084
1085 /// RegisterCustomBehaviour - Register a CustomBehaviour
1086 /// implementation for the given target.
1087 ///
1088 /// Clients are responsible for ensuring that registration doesn't occur
1089 /// while another thread is attempting to access the registry. Typically
1090 /// this is done by initializing all targets at program startup.
1091 ///
1092 /// @param T - The target being registered.
1093 /// @param Fn - A function to construct a CustomBehaviour for the target.
1096 T.CustomBehaviourCtorFn = Fn;
1097 }
1098
1099 /// RegisterInstrPostProcess - Register an InstrPostProcess
1100 /// implementation for the given target.
1101 ///
1102 /// Clients are responsible for ensuring that registration doesn't occur
1103 /// while another thread is attempting to access the registry. Typically
1104 /// this is done by initializing all targets at program startup.
1105 ///
1106 /// @param T - The target being registered.
1107 /// @param Fn - A function to construct an InstrPostProcess for the target.
1110 T.InstrPostProcessCtorFn = Fn;
1111 }
1112
1113 /// RegisterInstrumentManager - Register an InstrumentManager
1114 /// implementation for the given target.
1115 ///
1116 /// Clients are responsible for ensuring that registration doesn't occur
1117 /// while another thread is attempting to access the registry. Typically
1118 /// this is done by initializing all targets at program startup.
1119 ///
1120 /// @param T - The target being registered.
1121 /// @param Fn - A function to construct an InstrumentManager for the
1122 /// target.
1125 T.InstrumentManagerCtorFn = Fn;
1126 }
1127
1128 /// @}
1129};
1130
1131//===--------------------------------------------------------------------===//
1132
1133/// RegisterTarget - Helper template for registering a target, for use in the
1134/// target's initialization function. Usage:
1135///
1136///
1137/// Target &getTheFooTarget() { // The global target instance.
1138/// static Target TheFooTarget;
1139/// return TheFooTarget;
1140/// }
1141/// extern "C" void LLVMInitializeFooTargetInfo() {
1142/// RegisterTarget<Triple::foo> X(getTheFooTarget(), "foo", "Foo
1143/// description", "Foo" /* Backend Name */);
1144/// }
1145template <Triple::ArchType TargetArchType = Triple::UnknownArch,
1146 bool HasJIT = false>
1148 RegisterTarget(Target &T, const char *Name, const char *Desc,
1149 const char *BackendName) {
1151 HasJIT);
1152 }
1153
1154 static bool getArchMatch(Triple::ArchType Arch) {
1155 return Arch == TargetArchType;
1156 }
1157};
1158
1159/// RegisterMCAsmInfo - Helper template for registering a target assembly info
1160/// implementation. This invokes the static "Create" method on the class to
1161/// actually do the construction. Usage:
1162///
1163/// extern "C" void LLVMInitializeFooTarget() {
1164/// extern Target TheFooTarget;
1165/// RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
1166/// }
1167template <class MCAsmInfoImpl> struct RegisterMCAsmInfo {
1170 }
1171
1172private:
1173 static MCAsmInfo *Allocator(const MCRegisterInfo & /*MRI*/, const Triple &TT,
1174 const MCTargetOptions &Options) {
1175 return new MCAsmInfoImpl(TT, Options);
1176 }
1177};
1178
1179/// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
1180/// implementation. This invokes the specified function to do the
1181/// construction. Usage:
1182///
1183/// extern "C" void LLVMInitializeFooTarget() {
1184/// extern Target TheFooTarget;
1185/// RegisterMCAsmInfoFn X(TheFooTarget, TheFunction);
1186/// }
1190 }
1191};
1192
1193/// Helper template for registering a target object file info implementation.
1194/// This invokes the static "Create" method on the class to actually do the
1195/// construction. Usage:
1196///
1197/// extern "C" void LLVMInitializeFooTarget() {
1198/// extern Target TheFooTarget;
1199/// RegisterMCObjectFileInfo<FooMCObjectFileInfo> X(TheFooTarget);
1200/// }
1201template <class MCObjectFileInfoImpl> struct RegisterMCObjectFileInfo {
1204 }
1205
1206private:
1207 static MCObjectFileInfo *Allocator(MCContext &Ctx, bool PIC,
1208 bool LargeCodeModel = false) {
1209 return new MCObjectFileInfoImpl(Ctx, PIC, LargeCodeModel);
1210 }
1211};
1212
1213/// Helper template for registering a target object file info implementation.
1214/// This invokes the specified function to do the construction. Usage:
1215///
1216/// extern "C" void LLVMInitializeFooTarget() {
1217/// extern Target TheFooTarget;
1218/// RegisterMCObjectFileInfoFn X(TheFooTarget, TheFunction);
1219/// }
1223 }
1224};
1225
1226/// RegisterMCInstrInfo - Helper template for registering a target instruction
1227/// info implementation. This invokes the static "Create" method on the class
1228/// to actually do the construction. Usage:
1229///
1230/// extern "C" void LLVMInitializeFooTarget() {
1231/// extern Target TheFooTarget;
1232/// RegisterMCInstrInfo<FooMCInstrInfo> X(TheFooTarget);
1233/// }
1234template <class MCInstrInfoImpl> struct RegisterMCInstrInfo {
1237 }
1238
1239private:
1240 static MCInstrInfo *Allocator() { return new MCInstrInfoImpl(); }
1241};
1242
1243/// RegisterMCInstrInfoFn - Helper template for registering a target
1244/// instruction info implementation. This invokes the specified function to
1245/// do the construction. Usage:
1246///
1247/// extern "C" void LLVMInitializeFooTarget() {
1248/// extern Target TheFooTarget;
1249/// RegisterMCInstrInfoFn X(TheFooTarget, TheFunction);
1250/// }
1254 }
1255};
1256
1257/// RegisterMCInstrAnalysis - Helper template for registering a target
1258/// instruction analyzer implementation. This invokes the static "Create"
1259/// method on the class to actually do the construction. Usage:
1260///
1261/// extern "C" void LLVMInitializeFooTarget() {
1262/// extern Target TheFooTarget;
1263/// RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
1264/// }
1265template <class MCInstrAnalysisImpl> struct RegisterMCInstrAnalysis {
1268 }
1269
1270private:
1271 static MCInstrAnalysis *Allocator(const MCInstrInfo *Info) {
1272 return new MCInstrAnalysisImpl(Info);
1273 }
1274};
1275
1276/// RegisterMCInstrAnalysisFn - Helper template for registering a target
1277/// instruction analyzer implementation. This invokes the specified function
1278/// to do the construction. Usage:
1279///
1280/// extern "C" void LLVMInitializeFooTarget() {
1281/// extern Target TheFooTarget;
1282/// RegisterMCInstrAnalysisFn X(TheFooTarget, TheFunction);
1283/// }
1287 }
1288};
1289
1290/// RegisterMCRegInfo - Helper template for registering a target register info
1291/// implementation. This invokes the static "Create" method on the class to
1292/// actually do the construction. Usage:
1293///
1294/// extern "C" void LLVMInitializeFooTarget() {
1295/// extern Target TheFooTarget;
1296/// RegisterMCRegInfo<FooMCRegInfo> X(TheFooTarget);
1297/// }
1298template <class MCRegisterInfoImpl> struct RegisterMCRegInfo {
1301 }
1302
1303private:
1304 static MCRegisterInfo *Allocator(const Triple & /*TT*/) {
1305 return new MCRegisterInfoImpl();
1306 }
1307};
1308
1309/// RegisterMCRegInfoFn - Helper template for registering a target register
1310/// info implementation. This invokes the specified function to do the
1311/// construction. Usage:
1312///
1313/// extern "C" void LLVMInitializeFooTarget() {
1314/// extern Target TheFooTarget;
1315/// RegisterMCRegInfoFn X(TheFooTarget, TheFunction);
1316/// }
1320 }
1321};
1322
1323/// RegisterMCSubtargetInfo - Helper template for registering a target
1324/// subtarget info implementation. This invokes the static "Create" method
1325/// on the class to actually do the construction. Usage:
1326///
1327/// extern "C" void LLVMInitializeFooTarget() {
1328/// extern Target TheFooTarget;
1329/// RegisterMCSubtargetInfo<FooMCSubtargetInfo> X(TheFooTarget);
1330/// }
1331template <class MCSubtargetInfoImpl> struct RegisterMCSubtargetInfo {
1334 }
1335
1336private:
1337 static MCSubtargetInfo *Allocator(const Triple & /*TT*/, StringRef /*CPU*/,
1338 StringRef /*FS*/) {
1339 return new MCSubtargetInfoImpl();
1340 }
1341};
1342
1343/// RegisterMCSubtargetInfoFn - Helper template for registering a target
1344/// subtarget info implementation. This invokes the specified function to
1345/// do the construction. Usage:
1346///
1347/// extern "C" void LLVMInitializeFooTarget() {
1348/// extern Target TheFooTarget;
1349/// RegisterMCSubtargetInfoFn X(TheFooTarget, TheFunction);
1350/// }
1354 }
1355};
1356
1357/// RegisterTargetMachine - Helper template for registering a target machine
1358/// implementation, for use in the target machine initialization
1359/// function. Usage:
1360///
1361/// extern "C" void LLVMInitializeFooTarget() {
1362/// extern Target TheFooTarget;
1363/// RegisterTargetMachine<FooTargetMachine> X(TheFooTarget);
1364/// }
1365template <class TargetMachineImpl> struct RegisterTargetMachine {
1368 }
1369
1370private:
1371 static TargetMachine *
1372 Allocator(const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
1373 const TargetOptions &Options, std::optional<Reloc::Model> RM,
1374 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, bool JIT) {
1375 return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL, JIT);
1376 }
1377};
1378
1379/// RegisterMCAsmBackend - Helper template for registering a target specific
1380/// assembler backend. Usage:
1381///
1382/// extern "C" void LLVMInitializeFooMCAsmBackend() {
1383/// extern Target TheFooTarget;
1384/// RegisterMCAsmBackend<FooAsmLexer> X(TheFooTarget);
1385/// }
1386template <class MCAsmBackendImpl> struct RegisterMCAsmBackend {
1389 }
1390
1391private:
1392 static MCAsmBackend *Allocator(const Target &T, const MCSubtargetInfo &STI,
1393 const MCRegisterInfo &MRI,
1394 const MCTargetOptions &Options) {
1395 return new MCAsmBackendImpl(T, STI, MRI);
1396 }
1397};
1398
1399/// RegisterMCAsmParser - Helper template for registering a target specific
1400/// assembly parser, for use in the target machine initialization
1401/// function. Usage:
1402///
1403/// extern "C" void LLVMInitializeFooMCAsmParser() {
1404/// extern Target TheFooTarget;
1405/// RegisterMCAsmParser<FooAsmParser> X(TheFooTarget);
1406/// }
1407template <class MCAsmParserImpl> struct RegisterMCAsmParser {
1410 }
1411
1412private:
1413 static MCTargetAsmParser *Allocator(const MCSubtargetInfo &STI,
1414 MCAsmParser &P, const MCInstrInfo &MII,
1415 const MCTargetOptions &Options) {
1416 return new MCAsmParserImpl(STI, P, MII, Options);
1417 }
1418};
1419
1420/// RegisterAsmPrinter - Helper template for registering a target specific
1421/// assembly printer, for use in the target machine initialization
1422/// function. Usage:
1423///
1424/// extern "C" void LLVMInitializeFooAsmPrinter() {
1425/// extern Target TheFooTarget;
1426/// RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
1427/// }
1428template <class AsmPrinterImpl> struct RegisterAsmPrinter {
1431 }
1432
1433private:
1435 std::unique_ptr<MCStreamer> &&Streamer) {
1436 return new AsmPrinterImpl(TM, std::move(Streamer));
1437 }
1438};
1439
1440/// RegisterMCCodeEmitter - Helper template for registering a target specific
1441/// machine code emitter, for use in the target initialization
1442/// function. Usage:
1443///
1444/// extern "C" void LLVMInitializeFooMCCodeEmitter() {
1445/// extern Target TheFooTarget;
1446/// RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
1447/// }
1448template <class MCCodeEmitterImpl> struct RegisterMCCodeEmitter {
1451 }
1452
1453private:
1454 static MCCodeEmitter *Allocator(const MCInstrInfo & /*II*/,
1455 MCContext & /*Ctx*/) {
1456 return new MCCodeEmitterImpl();
1457 }
1458};
1459
1460} // end namespace llvm
1461
1462#endif // LLVM_MC_TARGETREGISTRY_H
unsigned const MachineRegisterInfo * MRI
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
dxil DXContainer Global Emitter
std::string Name
static LVOptions Options
Definition: LVOptions.cpp:25
#define P(N)
const char LLVMTargetMachineRef TM
PassInstrumentationCallbacks PIC
Basic Register Allocator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:84
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:43
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Generic assembler parser interface, for use by target specific assembly parsers.
Definition: MCAsmParser.h:123
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:21
Context object for machine code objects.
Definition: MCContext.h:81
Superclass for all disassemblers.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:45
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel=false)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Create MCExprs from relocations found in an object file.
Streaming machine code generation interface.
Definition: MCStreamer.h:212
Generic base class for all target subtargets.
Symbolize and annotate disassembled instructions.
Definition: MCSymbolizer.h:39
MCTargetAsmParser - Generic interface to target specific assembly parsers.
Target specific streamer interface.
Definition: MCStreamer.h:93
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
bool operator!=(const iterator &x) const
const Target * operator->() const
bool operator==(const iterator &x) const
const Target & operator*() const
std::forward_iterator_tag iterator_category
Target - Wrapper for Target specific information.
MCTargetStreamer *(*)(MCStreamer &S) NullTargetStreamerCtorTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter) XCOFFStreamerCtorTy
MCDisassembler *(*)(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx) MCDisassemblerCtorTy
Target()=default
mca::InstrPostProcess *(*)(const MCSubtargetInfo &STI, const MCInstrInfo &MCII) InstrPostProcessCtorTy
MCAsmInfo *(*)(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options) MCAsmInfoCtorFnTy
bool hasTargetMachine() const
hasTargetMachine - Check if this target supports code generation.
TargetMachine *(*)(const Target &T, const Triple &TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT) TargetMachineCtorTy
MCCodeEmitter * createMCCodeEmitter(const MCInstrInfo &II, MCContext &Ctx) const
createMCCodeEmitter - Create a target specific code emitter.
const char * getName() const
getName - Get the target name.
MCObjectFileInfo * createMCObjectFileInfo(MCContext &Ctx, bool PIC, bool LargeCodeModel=false) const
Create a MCObjectFileInfo implementation for the specified target triple.
const Target * getNext() const
MCSubtargetInfo * createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, StringRef Features) const
createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
AsmPrinter *(*)(TargetMachine &TM, std::unique_ptr< MCStreamer > &&Streamer) AsmPrinterCtorTy
MCStreamer * createAsmStreamer(MCContext &Ctx, std::unique_ptr< formatted_raw_ostream > OS, bool IsVerboseAsm, bool UseDwarfDirectory, MCInstPrinter *InstPrint, std::unique_ptr< MCCodeEmitter > &&CE, std::unique_ptr< MCAsmBackend > &&TAB, bool ShowInst) const
MCSymbolizer * createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx, std::unique_ptr< MCRelocationInfo > &&RelInfo) const
createMCSymbolizer - Create a target specific MCSymbolizer.
MCAsmBackend * createMCAsmBackend(const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options) const
createMCAsmBackend - Create a target specific assembly parser.
MCObjectFileInfo *(*)(MCContext &Ctx, bool PIC, bool LargeCodeModel) MCObjectFileInfoCtorFnTy
bool hasMCAsmParser() const
hasMCAsmParser - Check if this target supports assembly parsing.
MCStreamer * createNullStreamer(MCContext &Ctx) const
MCRelocationInfo * createMCRelocationInfo(StringRef TT, MCContext &Ctx) const
createMCRelocationInfo - Create a target specific MCRelocationInfo.
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter) GOFFStreamerCtorTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter) ELFStreamerCtorTy
MCInstrAnalysis *(*)(const MCInstrInfo *Info) MCInstrAnalysisCtorFnTy
MCRegisterInfo * createMCRegInfo(StringRef TT) const
createMCRegInfo - Create a MCRegisterInfo implementation.
MCTargetStreamer *(*)(MCStreamer &S, const MCSubtargetInfo &STI) ObjectTargetStreamerCtorTy
MCRegisterInfo *(*)(const Triple &TT) MCRegInfoCtorFnTy
MCInstrInfo *(*)() MCInstrInfoCtorFnTy
MCTargetStreamer *(*)(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool IsVerboseAsm) AsmTargetStreamerCtorTy
mca::CustomBehaviour * createCustomBehaviour(const MCSubtargetInfo &STI, const mca::SourceMgr &SrcMgr, const MCInstrInfo &MCII) const
createCustomBehaviour - Create a target specific CustomBehaviour.
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter) WasmStreamerCtorTy
bool(*)(Triple::ArchType Arch) ArchMatchFnTy
MCInstPrinter *(*)(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) MCInstPrinterCtorTy
MCDisassembler * createMCDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx) const
mca::CustomBehaviour *(*)(const MCSubtargetInfo &STI, const mca::SourceMgr &SrcMgr, const MCInstrInfo &MCII) CustomBehaviourCtorTy
TargetMachine * createTargetMachine(StringRef TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM=std::nullopt, CodeGenOptLevel OL=CodeGenOptLevel::Default, bool JIT=false) const
createTargetMachine - Create a target specific machine implementation for the specified Triple.
bool hasMCAsmBackend() const
hasMCAsmBackend - Check if this target supports .o generation.
MCStreamer * createMCObjectStreamer(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, const MCSubtargetInfo &STI, bool, bool IncrementalLinkerCompatible, bool DWARFMustBeAtTheEnd) const
Create a target specific MCStreamer.
MCAsmInfo * createMCAsmInfo(const MCRegisterInfo &MRI, StringRef TheTriple, const MCTargetOptions &Options) const
createMCAsmInfo - Create a MCAsmInfo implementation for the specified target triple.
MCInstPrinter * createMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) const
MCSymbolizer *(*)(const Triple &TT, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx, std::unique_ptr< MCRelocationInfo > &&RelInfo) MCSymbolizerCtorTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter) DXContainerStreamerCtorTy
MCSubtargetInfo *(*)(const Triple &TT, StringRef CPU, StringRef Features) MCSubtargetInfoCtorFnTy
mca::InstrPostProcess * createInstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII) const
createInstrPostProcess - Create a target specific InstrPostProcess.
const char * getBackendName() const
getBackendName - Get the backend name.
MCAsmBackend *(*)(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options) MCAsmBackendCtorTy
MCTargetAsmParser * createMCAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser, const MCInstrInfo &MII, const MCTargetOptions &Options) const
createMCAsmParser - Create a target specific assembly parser.
MCInstrAnalysis * createMCInstrAnalysis(const MCInstrInfo *Info) const
createMCInstrAnalysis - Create a MCInstrAnalysis implementation.
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool DWARFMustBeAtTheEnd) MachOStreamerCtorTy
const char * getShortDescription() const
getShortDescription - Get a short description of the target.
bool hasJIT() const
hasJIT - Check if this targets supports the just-in-time compilation.
MCCodeEmitter *(*)(const MCInstrInfo &II, MCContext &Ctx) MCCodeEmitterCtorTy
MCTargetStreamer * createAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool IsVerboseAsm) const
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter) SPIRVStreamerCtorTy
mca::InstrumentManager *(*)(const MCSubtargetInfo &STI, const MCInstrInfo &MCII) InstrumentManagerCtorTy
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool IncrementalLinkerCompatible) COFFStreamerCtorTy
MCTargetStreamer * createNullTargetStreamer(MCStreamer &S) const
MCRelocationInfo *(*)(const Triple &TT, MCContext &Ctx) MCRelocationInfoCtorTy
MCTargetAsmParser *(*)(const MCSubtargetInfo &STI, MCAsmParser &P, const MCInstrInfo &MII, const MCTargetOptions &Options) MCAsmParserCtorTy
AsmPrinter * createAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > &&Streamer) const
createAsmPrinter - Create a target specific assembly printer pass.
MCInstrInfo * createMCInstrInfo() const
createMCInstrInfo - Create a MCInstrInfo implementation.
mca::InstrumentManager * createInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII) const
createInstrumentManager - Create a target specific InstrumentManager.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
@ UnknownArch
Definition: Triple.h:47
@ DXContainer
Definition: Triple.h:300
@ UnknownObjectFormat
Definition: Triple.h:297
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
A range adaptor for a pair of iterators.
Class which can be overriden by targets to enforce instruction dependencies and behaviours that aren'...
Class which can be overriden by targets to modify the mca::Instruction objects before the pipeline st...
This class allows targets to optionally customize the logic that resolves scheduling class IDs.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
const char *(* LLVMSymbolLookupCallback)(void *DisInfo, uint64_t ReferenceValue, uint64_t *ReferenceType, uint64_t ReferencePC, const char **ReferenceName)
The type for the symbol lookup function.
int(* LLVMOpInfoCallback)(void *DisInfo, uint64_t PC, uint64_t Offset, uint64_t OpSize, uint64_t InstSize, int TagType, void *TagBuf)
The type for the operand information call back function.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
mca::CustomBehaviour * createCustomBehaviour(const MCSubtargetInfo &STI, const mca::SourceMgr &SrcMgr, const MCInstrInfo &MCII)
MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
MCStreamer * createXCOFFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
MCStreamer * createNullStreamer(MCContext &Ctx)
Create a dummy machine code streamer, which does nothing.
MCSymbolizer * createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx, std::unique_ptr< MCRelocationInfo > &&RelInfo)
MCStreamer * createMachOStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool DWARFMustBeAtTheEnd, bool LabelSections=false)
SourceMgr SrcMgr
Definition: Error.cpp:24
MCRelocationInfo * createMCRelocationInfo(const Triple &TT, MCContext &Ctx)
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
MCStreamer * createAsmStreamer(MCContext &Ctx, std::unique_ptr< formatted_raw_ostream > OS, bool isVerboseAsm, bool useDwarfDirectory, MCInstPrinter *InstPrint, std::unique_ptr< MCCodeEmitter > &&CE, std::unique_ptr< MCAsmBackend > &&TAB, bool ShowInst)
Create a machine code streamer which will print out assembly for the native target,...
MCStreamer * createDXContainerStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
mca::InstrumentManager * createInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
MCStreamer * createWasmStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
MCStreamer * createGOFFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
MCStreamer * createSPIRVStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
mca::InstrPostProcess * createInstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
Description of the encoding of one expression Op.
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...
RegisterMCAsmBackend - Helper template for registering a target specific assembler backend.
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
RegisterMCAsmInfoFn(Target &T, Target::MCAsmInfoCtorFnTy Fn)
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...
RegisterMCCodeEmitter - Helper template for registering a target specific machine code emitter,...
RegisterMCInstrAnalysisFn - Helper template for registering a target instruction analyzer implementat...
RegisterMCInstrAnalysisFn(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Helper template for registering a target instruction analyzer implementatio...
RegisterMCInstrInfoFn - Helper template for registering a target instruction info implementation.
RegisterMCInstrInfoFn(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Helper template for registering a target instruction info implementation.
Helper template for registering a target object file info implementation.
RegisterMCObjectFileInfoFn(Target &T, Target::MCObjectFileInfoCtorFnTy Fn)
Helper template for registering a target object file info implementation.
RegisterMCRegInfoFn - Helper template for registering a target register info implementation.
RegisterMCRegInfoFn(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Helper template for registering a target register info implementation.
RegisterMCSubtargetInfoFn - Helper template for registering a target subtarget info implementation.
RegisterMCSubtargetInfoFn(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Helper template for registering a target subtarget info implementation.
RegisterTargetMachine - Helper template for registering a target machine implementation,...
RegisterTarget - Helper template for registering a target, for use in the target's initialization fun...
static bool getArchMatch(Triple::ArchType Arch)
RegisterTarget(Target &T, const char *Name, const char *Desc, const char *BackendName)
TargetRegistry - Generic interface to target specific features.
static void RegisterMCSymbolizer(Target &T, Target::MCSymbolizerCtorTy Fn)
RegisterMCSymbolizer - Register an MCSymbolizer implementation for the given target.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn)
RegisterAsmPrinter - Register an AsmPrinter implementation for the given target.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static void RegisterXCOFFStreamer(Target &T, Target::XCOFFStreamerCtorTy Fn)
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 RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target.
static void RegisterSPIRVStreamer(Target &T, Target::SPIRVStreamerCtorTy Fn)
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
static void RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn)
static void RegisterInstrPostProcess(Target &T, Target::InstrPostProcessCtorTy Fn)
RegisterInstrPostProcess - Register an InstrPostProcess implementation for the given target.
static const Target * lookupTarget(StringRef Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.
static void RegisterMCAsmParser(Target &T, Target::MCAsmParserCtorTy Fn)
RegisterMCAsmParser - Register a MCTargetAsmParser implementation for the given target.
static void printRegisteredTargetsForVersion(raw_ostream &OS)
printRegisteredTargetsForVersion - Print the registered targets appropriately for inclusion in a tool...
static void RegisterTargetMachine(Target &T, Target::TargetMachineCtorTy Fn)
RegisterTargetMachine - Register a TargetMachine implementation for the given target.
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterCOFFStreamer(Target &T, Target::COFFStreamerCtorTy Fn)
static void RegisterDXContainerStreamer(Target &T, Target::DXContainerStreamerCtorTy Fn)
static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc, const char *BackendName, Target::ArchMatchFnTy ArchMatchFn, bool HasJIT=false)
RegisterTarget - Register the given target.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
static void RegisterWasmStreamer(Target &T, Target::WasmStreamerCtorTy Fn)
static iterator_range< iterator > targets()
static void RegisterGOFFStreamer(Target &T, Target::GOFFStreamerCtorTy Fn)
static void RegisterInstrumentManager(Target &T, Target::InstrumentManagerCtorTy Fn)
RegisterInstrumentManager - Register an InstrumentManager implementation for the given target.
static void RegisterCustomBehaviour(Target &T, Target::CustomBehaviourCtorTy Fn)
RegisterCustomBehaviour - Register a CustomBehaviour implementation for the given target.
static void RegisterMachOStreamer(Target &T, Target::MachOStreamerCtorTy Fn)
static void RegisterMCObjectFileInfo(Target &T, Target::MCObjectFileInfoCtorFnTy Fn)
Register a MCObjectFileInfo implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
static void RegisterMCRelocationInfo(Target &T, Target::MCRelocationInfoCtorTy Fn)
RegisterMCRelocationInfo - Register an MCRelocationInfo implementation for the given target.
Abstracting the input code sequence (a sequence of MCInst) and assigning unique identifiers to every ...
Definition: SourceMgr.h:29