LLVM 17.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,
96 bool RelaxAll);
98 std::unique_ptr<MCAsmBackend> &&TAB,
99 std::unique_ptr<MCObjectWriter> &&OW,
100 std::unique_ptr<MCCodeEmitter> &&CE,
101 bool RelaxAll, bool DWARFMustBeAtTheEnd,
102 bool LabelSections = false);
104 std::unique_ptr<MCAsmBackend> &&TAB,
105 std::unique_ptr<MCObjectWriter> &&OW,
106 std::unique_ptr<MCCodeEmitter> &&CE,
107 bool RelaxAll);
109 std::unique_ptr<MCAsmBackend> &&TAB,
110 std::unique_ptr<MCObjectWriter> &&OW,
111 std::unique_ptr<MCCodeEmitter> &&CE,
112 bool RelaxAll);
114 std::unique_ptr<MCAsmBackend> &&TAB,
115 std::unique_ptr<MCObjectWriter> &&OW,
116 std::unique_ptr<MCCodeEmitter> &&CE,
117 bool RelaxAll);
119 std::unique_ptr<MCAsmBackend> &&TAB,
120 std::unique_ptr<MCObjectWriter> &&OW,
121 std::unique_ptr<MCCodeEmitter> &&CE,
122 bool RelaxAll);
123
125
127 LLVMSymbolLookupCallback SymbolLookUp,
128 void *DisInfo, MCContext *Ctx,
129 std::unique_ptr<MCRelocationInfo> &&RelInfo);
130
132 const mca::SourceMgr &SrcMgr,
133 const MCInstrInfo &MCII);
134
136 const MCInstrInfo &MCII);
137
139 const MCInstrInfo &MCII);
140
141/// Target - Wrapper for Target specific information.
142///
143/// For registration purposes, this is a POD type so that targets can be
144/// registered without the use of static constructors.
145///
146/// Targets should implement a single global instance of this class (which
147/// will be zero initialized), and pass that instance to the TargetRegistry as
148/// part of their initialization.
149class Target {
150public:
151 friend struct TargetRegistry;
152
154
156 const Triple &TT,
157 const MCTargetOptions &Options);
159 bool PIC,
160 bool LargeCodeModel);
163 using MCRegInfoCtorFnTy = MCRegisterInfo *(*)(const Triple &TT);
165 StringRef CPU,
166 StringRef Features);
168 *(*)(const Target &T, const Triple &TT, StringRef CPU, StringRef Features,
169 const TargetOptions &Options, std::optional<Reloc::Model> RM,
170 std::optional<CodeModel::Model> CM, CodeGenOpt::Level OL, bool JIT);
171 // If it weren't for layering issues (this header is in llvm/Support, but
172 // depends on MC?) this should take the Streamer by value rather than rvalue
173 // reference.
175 TargetMachine &TM, std::unique_ptr<MCStreamer> &&Streamer);
177 const MCSubtargetInfo &STI,
178 const MCRegisterInfo &MRI,
179 const MCTargetOptions &Options);
181 const MCSubtargetInfo &STI, MCAsmParser &P, const MCInstrInfo &MII,
182 const MCTargetOptions &Options);
184 const MCSubtargetInfo &STI,
185 MCContext &Ctx);
187 unsigned SyntaxVariant,
188 const MCAsmInfo &MAI,
189 const MCInstrInfo &MII,
190 const MCRegisterInfo &MRI);
192 MCContext &Ctx);
194 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
195 std::unique_ptr<MCAsmBackend> &&TAB,
196 std::unique_ptr<MCObjectWriter> &&OW,
197 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll);
199 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
200 std::unique_ptr<MCObjectWriter> &&OW,
201 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll,
202 bool DWARFMustBeAtTheEnd);
204 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
205 std::unique_ptr<MCObjectWriter> &&OW,
206 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll,
207 bool IncrementalLinkerCompatible);
209 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
210 std::unique_ptr<MCAsmBackend> &&TAB,
211 std::unique_ptr<MCObjectWriter> &&OW,
212 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll);
214 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
215 std::unique_ptr<MCAsmBackend> &&TAB,
216 std::unique_ptr<MCObjectWriter> &&OW,
217 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll);
219 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
220 std::unique_ptr<MCAsmBackend> &&TAB,
221 std::unique_ptr<MCObjectWriter> &&OW,
222 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll);
223
225 MCStreamer *(*)(const Triple &T, MCContext &Ctx,
226 std::unique_ptr<MCAsmBackend> &&TAB,
227 std::unique_ptr<MCObjectWriter> &&OW,
228 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll);
229
233 bool IsVerboseAsm);
235 MCStreamer &S, const MCSubtargetInfo &STI);
237 MCContext &Ctx);
239 const Triple &TT, LLVMOpInfoCallback GetOpInfo,
240 LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx,
241 std::unique_ptr<MCRelocationInfo> &&RelInfo);
242
245 const mca::SourceMgr &SrcMgr,
246 const MCInstrInfo &MCII);
247
250 const MCInstrInfo &MCII);
251
254 const MCInstrInfo &MCII);
255
256private:
257 /// Next - The next registered target in the linked list, maintained by the
258 /// TargetRegistry.
259 Target *Next;
260
261 /// The target function for checking if an architecture is supported.
262 ArchMatchFnTy ArchMatchFn;
263
264 /// Name - The target name.
265 const char *Name;
266
267 /// ShortDesc - A short description of the target.
268 const char *ShortDesc;
269
270 /// BackendName - The name of the backend implementation. This must match the
271 /// name of the 'def X : Target ...' in TableGen.
272 const char *BackendName;
273
274 /// HasJIT - Whether this target supports the JIT.
275 bool HasJIT;
276
277 /// MCAsmInfoCtorFn - Constructor function for this target's MCAsmInfo, if
278 /// registered.
279 MCAsmInfoCtorFnTy MCAsmInfoCtorFn;
280
281 /// Constructor function for this target's MCObjectFileInfo, if registered.
282 MCObjectFileInfoCtorFnTy MCObjectFileInfoCtorFn;
283
284 /// MCInstrInfoCtorFn - Constructor function for this target's MCInstrInfo,
285 /// if registered.
286 MCInstrInfoCtorFnTy MCInstrInfoCtorFn;
287
288 /// MCInstrAnalysisCtorFn - Constructor function for this target's
289 /// MCInstrAnalysis, if registered.
290 MCInstrAnalysisCtorFnTy MCInstrAnalysisCtorFn;
291
292 /// MCRegInfoCtorFn - Constructor function for this target's MCRegisterInfo,
293 /// if registered.
294 MCRegInfoCtorFnTy MCRegInfoCtorFn;
295
296 /// MCSubtargetInfoCtorFn - Constructor function for this target's
297 /// MCSubtargetInfo, if registered.
298 MCSubtargetInfoCtorFnTy MCSubtargetInfoCtorFn;
299
300 /// TargetMachineCtorFn - Construction function for this target's
301 /// TargetMachine, if registered.
302 TargetMachineCtorTy TargetMachineCtorFn;
303
304 /// MCAsmBackendCtorFn - Construction function for this target's
305 /// MCAsmBackend, if registered.
306 MCAsmBackendCtorTy MCAsmBackendCtorFn;
307
308 /// MCAsmParserCtorFn - Construction function for this target's
309 /// MCTargetAsmParser, if registered.
310 MCAsmParserCtorTy MCAsmParserCtorFn;
311
312 /// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
313 /// if registered.
314 AsmPrinterCtorTy AsmPrinterCtorFn;
315
316 /// MCDisassemblerCtorFn - Construction function for this target's
317 /// MCDisassembler, if registered.
318 MCDisassemblerCtorTy MCDisassemblerCtorFn;
319
320 /// MCInstPrinterCtorFn - Construction function for this target's
321 /// MCInstPrinter, if registered.
322 MCInstPrinterCtorTy MCInstPrinterCtorFn;
323
324 /// MCCodeEmitterCtorFn - Construction function for this target's
325 /// CodeEmitter, if registered.
326 MCCodeEmitterCtorTy MCCodeEmitterCtorFn;
327
328 // Construction functions for the various object formats, if registered.
329 COFFStreamerCtorTy COFFStreamerCtorFn = nullptr;
330 MachOStreamerCtorTy MachOStreamerCtorFn = nullptr;
331 ELFStreamerCtorTy ELFStreamerCtorFn = nullptr;
332 WasmStreamerCtorTy WasmStreamerCtorFn = nullptr;
333 XCOFFStreamerCtorTy XCOFFStreamerCtorFn = nullptr;
334 SPIRVStreamerCtorTy SPIRVStreamerCtorFn = nullptr;
335 DXContainerStreamerCtorTy DXContainerStreamerCtorFn = nullptr;
336
337 /// Construction function for this target's null TargetStreamer, if
338 /// registered (default = nullptr).
339 NullTargetStreamerCtorTy NullTargetStreamerCtorFn = nullptr;
340
341 /// Construction function for this target's asm TargetStreamer, if
342 /// registered (default = nullptr).
343 AsmTargetStreamerCtorTy AsmTargetStreamerCtorFn = nullptr;
344
345 /// Construction function for this target's obj TargetStreamer, if
346 /// registered (default = nullptr).
347 ObjectTargetStreamerCtorTy ObjectTargetStreamerCtorFn = nullptr;
348
349 /// MCRelocationInfoCtorFn - Construction function for this target's
350 /// MCRelocationInfo, if registered (default = llvm::createMCRelocationInfo)
351 MCRelocationInfoCtorTy MCRelocationInfoCtorFn = nullptr;
352
353 /// MCSymbolizerCtorFn - Construction function for this target's
354 /// MCSymbolizer, if registered (default = llvm::createMCSymbolizer)
355 MCSymbolizerCtorTy MCSymbolizerCtorFn = nullptr;
356
357 /// CustomBehaviourCtorFn - Construction function for this target's
358 /// CustomBehaviour, if registered (default = nullptr).
359 CustomBehaviourCtorTy CustomBehaviourCtorFn = nullptr;
360
361 /// InstrPostProcessCtorFn - Construction function for this target's
362 /// InstrPostProcess, if registered (default = nullptr).
363 InstrPostProcessCtorTy InstrPostProcessCtorFn = nullptr;
364
365 /// InstrumentManagerCtorFn - Construction function for this target's
366 /// InstrumentManager, if registered (default = nullptr).
367 InstrumentManagerCtorTy InstrumentManagerCtorFn = nullptr;
368
369public:
370 Target() = default;
371
372 /// @name Target Information
373 /// @{
374
375 // getNext - Return the next registered target.
376 const Target *getNext() const { return Next; }
377
378 /// getName - Get the target name.
379 const char *getName() const { return Name; }
380
381 /// getShortDescription - Get a short description of the target.
382 const char *getShortDescription() const { return ShortDesc; }
383
384 /// getBackendName - Get the backend name.
385 const char *getBackendName() const { return BackendName; }
386
387 /// @}
388 /// @name Feature Predicates
389 /// @{
390
391 /// hasJIT - Check if this targets supports the just-in-time compilation.
392 bool hasJIT() const { return HasJIT; }
393
394 /// hasTargetMachine - Check if this target supports code generation.
395 bool hasTargetMachine() const { return TargetMachineCtorFn != nullptr; }
396
397 /// hasMCAsmBackend - Check if this target supports .o generation.
398 bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != nullptr; }
399
400 /// hasMCAsmParser - Check if this target supports assembly parsing.
401 bool hasMCAsmParser() const { return MCAsmParserCtorFn != nullptr; }
402
403 /// @}
404 /// @name Feature Constructors
405 /// @{
406
407 /// createMCAsmInfo - Create a MCAsmInfo implementation for the specified
408 /// target triple.
409 ///
410 /// \param TheTriple This argument is used to determine the target machine
411 /// feature set; it should always be provided. Generally this should be
412 /// either the target triple from the module, or the target triple of the
413 /// host if that does not exist.
415 const MCTargetOptions &Options) const {
416 if (!MCAsmInfoCtorFn)
417 return nullptr;
418 return MCAsmInfoCtorFn(MRI, Triple(TheTriple), Options);
419 }
420
421 /// Create a MCObjectFileInfo implementation for the specified target
422 /// triple.
423 ///
425 bool LargeCodeModel = false) const {
426 if (!MCObjectFileInfoCtorFn) {
428 MOFI->initMCObjectFileInfo(Ctx, PIC, LargeCodeModel);
429 return MOFI;
430 }
431 return MCObjectFileInfoCtorFn(Ctx, PIC, LargeCodeModel);
432 }
433
434 /// createMCInstrInfo - Create a MCInstrInfo implementation.
435 ///
437 if (!MCInstrInfoCtorFn)
438 return nullptr;
439 return MCInstrInfoCtorFn();
440 }
441
442 /// createMCInstrAnalysis - Create a MCInstrAnalysis implementation.
443 ///
445 if (!MCInstrAnalysisCtorFn)
446 return nullptr;
447 return MCInstrAnalysisCtorFn(Info);
448 }
449
450 /// createMCRegInfo - Create a MCRegisterInfo implementation.
451 ///
453 if (!MCRegInfoCtorFn)
454 return nullptr;
455 return MCRegInfoCtorFn(Triple(TT));
456 }
457
458 /// createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
459 ///
460 /// \param TheTriple This argument is used to determine the target machine
461 /// feature set; it should always be provided. Generally this should be
462 /// either the target triple from the module, or the target triple of the
463 /// host if that does not exist.
464 /// \param CPU This specifies the name of the target CPU.
465 /// \param Features This specifies the string representation of the
466 /// additional target features.
468 StringRef Features) const {
469 if (!MCSubtargetInfoCtorFn)
470 return nullptr;
471 return MCSubtargetInfoCtorFn(Triple(TheTriple), CPU, Features);
472 }
473
474 /// createTargetMachine - Create a target specific machine implementation
475 /// for the specified \p Triple.
476 ///
477 /// \param TT This argument is used to determine the target machine
478 /// feature set; it should always be provided. Generally this should be
479 /// either the target triple from the module, or the target triple of the
480 /// host if that does not exist.
482 StringRef TT, StringRef CPU, StringRef Features,
483 const TargetOptions &Options, std::optional<Reloc::Model> RM,
484 std::optional<CodeModel::Model> CM = std::nullopt,
485 CodeGenOpt::Level OL = CodeGenOpt::Default, bool JIT = false) const {
486 if (!TargetMachineCtorFn)
487 return nullptr;
488 return TargetMachineCtorFn(*this, Triple(TT), CPU, Features, Options, RM,
489 CM, OL, JIT);
490 }
491
492 /// createMCAsmBackend - Create a target specific assembly parser.
494 const MCRegisterInfo &MRI,
495 const MCTargetOptions &Options) const {
496 if (!MCAsmBackendCtorFn)
497 return nullptr;
498 return MCAsmBackendCtorFn(*this, STI, MRI, Options);
499 }
500
501 /// createMCAsmParser - Create a target specific assembly parser.
502 ///
503 /// \param Parser The target independent parser implementation to use for
504 /// parsing and lexing.
506 MCAsmParser &Parser,
507 const MCInstrInfo &MII,
508 const MCTargetOptions &Options) const {
509 if (!MCAsmParserCtorFn)
510 return nullptr;
511 return MCAsmParserCtorFn(STI, Parser, MII, Options);
512 }
513
514 /// createAsmPrinter - Create a target specific assembly printer pass. This
515 /// takes ownership of the MCStreamer object.
517 std::unique_ptr<MCStreamer> &&Streamer) const {
518 if (!AsmPrinterCtorFn)
519 return nullptr;
520 return AsmPrinterCtorFn(TM, std::move(Streamer));
521 }
522
524 MCContext &Ctx) const {
525 if (!MCDisassemblerCtorFn)
526 return nullptr;
527 return MCDisassemblerCtorFn(*this, STI, Ctx);
528 }
529
530 MCInstPrinter *createMCInstPrinter(const Triple &T, unsigned SyntaxVariant,
531 const MCAsmInfo &MAI,
532 const MCInstrInfo &MII,
533 const MCRegisterInfo &MRI) const {
534 if (!MCInstPrinterCtorFn)
535 return nullptr;
536 return MCInstPrinterCtorFn(T, SyntaxVariant, MAI, MII, MRI);
537 }
538
539 /// createMCCodeEmitter - Create a target specific code emitter.
541 MCContext &Ctx) const {
542 if (!MCCodeEmitterCtorFn)
543 return nullptr;
544 return MCCodeEmitterCtorFn(II, Ctx);
545 }
546
547 /// Create a target specific MCStreamer.
548 ///
549 /// \param T The target triple.
550 /// \param Ctx The target context.
551 /// \param TAB The target assembler backend object. Takes ownership.
552 /// \param OW The stream object.
553 /// \param Emitter The target independent assembler object.Takes ownership.
554 /// \param RelaxAll Relax all fixups?
556 std::unique_ptr<MCAsmBackend> &&TAB,
557 std::unique_ptr<MCObjectWriter> &&OW,
558 std::unique_ptr<MCCodeEmitter> &&Emitter,
559 const MCSubtargetInfo &STI, bool RelaxAll,
560 bool IncrementalLinkerCompatible,
561 bool DWARFMustBeAtTheEnd) const {
562 MCStreamer *S = nullptr;
563 switch (T.getObjectFormat()) {
565 llvm_unreachable("Unknown object format");
566 case Triple::COFF:
567 assert(T.isOSWindows() && "only Windows COFF is supported");
568 S = COFFStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
569 std::move(Emitter), RelaxAll,
570 IncrementalLinkerCompatible);
571 break;
572 case Triple::MachO:
573 if (MachOStreamerCtorFn)
574 S = MachOStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
575 std::move(Emitter), RelaxAll,
576 DWARFMustBeAtTheEnd);
577 else
578 S = createMachOStreamer(Ctx, std::move(TAB), std::move(OW),
579 std::move(Emitter), RelaxAll,
580 DWARFMustBeAtTheEnd);
581 break;
582 case Triple::ELF:
583 if (ELFStreamerCtorFn)
584 S = ELFStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
585 std::move(Emitter), RelaxAll);
586 else
587 S = createELFStreamer(Ctx, std::move(TAB), std::move(OW),
588 std::move(Emitter), RelaxAll);
589 break;
590 case Triple::Wasm:
591 if (WasmStreamerCtorFn)
592 S = WasmStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
593 std::move(Emitter), RelaxAll);
594 else
595 S = createWasmStreamer(Ctx, std::move(TAB), std::move(OW),
596 std::move(Emitter), RelaxAll);
597 break;
598 case Triple::GOFF:
599 report_fatal_error("GOFF MCObjectStreamer not implemented yet");
600 case Triple::XCOFF:
601 if (XCOFFStreamerCtorFn)
602 S = XCOFFStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
603 std::move(Emitter), RelaxAll);
604 else
605 S = createXCOFFStreamer(Ctx, std::move(TAB), std::move(OW),
606 std::move(Emitter), RelaxAll);
607 break;
608 case Triple::SPIRV:
609 if (SPIRVStreamerCtorFn)
610 S = SPIRVStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
611 std::move(Emitter), RelaxAll);
612 else
613 S = createSPIRVStreamer(Ctx, std::move(TAB), std::move(OW),
614 std::move(Emitter), RelaxAll);
615 break;
617 if (DXContainerStreamerCtorFn)
618 S = DXContainerStreamerCtorFn(T, Ctx, std::move(TAB), std::move(OW),
619 std::move(Emitter), RelaxAll);
620 else
621 S = createDXContainerStreamer(Ctx, std::move(TAB), std::move(OW),
622 std::move(Emitter), RelaxAll);
623 break;
624 }
625 if (ObjectTargetStreamerCtorFn)
626 ObjectTargetStreamerCtorFn(*S, STI);
627 return S;
628 }
629
631 std::unique_ptr<formatted_raw_ostream> OS,
632 bool IsVerboseAsm, bool UseDwarfDirectory,
633 MCInstPrinter *InstPrint,
634 std::unique_ptr<MCCodeEmitter> &&CE,
635 std::unique_ptr<MCAsmBackend> &&TAB,
636 bool ShowInst) const {
637 formatted_raw_ostream &OSRef = *OS;
639 Ctx, std::move(OS), IsVerboseAsm, UseDwarfDirectory, InstPrint,
640 std::move(CE), std::move(TAB), ShowInst);
641 createAsmTargetStreamer(*S, OSRef, InstPrint, IsVerboseAsm);
642 return S;
643 }
644
647 MCInstPrinter *InstPrint,
648 bool IsVerboseAsm) const {
649 if (AsmTargetStreamerCtorFn)
650 return AsmTargetStreamerCtorFn(S, OS, InstPrint, IsVerboseAsm);
651 return nullptr;
652 }
653
657 return S;
658 }
659
661 if (NullTargetStreamerCtorFn)
662 return NullTargetStreamerCtorFn(S);
663 return nullptr;
664 }
665
666 /// createMCRelocationInfo - Create a target specific MCRelocationInfo.
667 ///
668 /// \param TT The target triple.
669 /// \param Ctx The target context.
671 MCRelocationInfoCtorTy Fn = MCRelocationInfoCtorFn
672 ? MCRelocationInfoCtorFn
674 return Fn(Triple(TT), Ctx);
675 }
676
677 /// createMCSymbolizer - Create a target specific MCSymbolizer.
678 ///
679 /// \param TT The target triple.
680 /// \param GetOpInfo The function to get the symbolic information for
681 /// operands.
682 /// \param SymbolLookUp The function to lookup a symbol name.
683 /// \param DisInfo The pointer to the block of symbolic information for above
684 /// call
685 /// back.
686 /// \param Ctx The target context.
687 /// \param RelInfo The relocation information for this target. Takes
688 /// ownership.
691 LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo,
692 MCContext *Ctx,
693 std::unique_ptr<MCRelocationInfo> &&RelInfo) const {
695 MCSymbolizerCtorFn ? MCSymbolizerCtorFn : llvm::createMCSymbolizer;
696 return Fn(Triple(TT), GetOpInfo, SymbolLookUp, DisInfo, Ctx,
697 std::move(RelInfo));
698 }
699
700 /// createCustomBehaviour - Create a target specific CustomBehaviour.
701 /// This class is used by llvm-mca and requires backend functionality.
703 const mca::SourceMgr &SrcMgr,
704 const MCInstrInfo &MCII) const {
705 if (CustomBehaviourCtorFn)
706 return CustomBehaviourCtorFn(STI, SrcMgr, MCII);
707 return nullptr;
708 }
709
710 /// createInstrPostProcess - Create a target specific InstrPostProcess.
711 /// This class is used by llvm-mca and requires backend functionality.
713 const MCInstrInfo &MCII) const {
714 if (InstrPostProcessCtorFn)
715 return InstrPostProcessCtorFn(STI, MCII);
716 return nullptr;
717 }
718
719 /// createInstrumentManager - Create a target specific
720 /// InstrumentManager. This class is used by llvm-mca and requires
721 /// backend functionality.
724 const MCInstrInfo &MCII) const {
725 if (InstrumentManagerCtorFn)
726 return InstrumentManagerCtorFn(STI, MCII);
727 return nullptr;
728 }
729
730 /// @}
731};
732
733/// TargetRegistry - Generic interface to target specific features.
735 // FIXME: Make this a namespace, probably just move all the Register*
736 // functions into Target (currently they all just set members on the Target
737 // anyway, and Target friends this class so those functions can...
738 // function).
739 TargetRegistry() = delete;
740
741 class iterator {
742 friend struct TargetRegistry;
743
744 const Target *Current = nullptr;
745
746 explicit iterator(Target *T) : Current(T) {}
747
748 public:
749 using iterator_category = std::forward_iterator_tag;
751 using difference_type = std::ptrdiff_t;
754
755 iterator() = default;
756
757 bool operator==(const iterator &x) const { return Current == x.Current; }
758 bool operator!=(const iterator &x) const { return !operator==(x); }
759
760 // Iterator traversal: forward iteration only
761 iterator &operator++() { // Preincrement
762 assert(Current && "Cannot increment end iterator!");
763 Current = Current->getNext();
764 return *this;
765 }
766 iterator operator++(int) { // Postincrement
767 iterator tmp = *this;
768 ++*this;
769 return tmp;
770 }
771
772 const Target &operator*() const {
773 assert(Current && "Cannot dereference end iterator!");
774 return *Current;
775 }
776
777 const Target *operator->() const { return &operator*(); }
778 };
779
780 /// printRegisteredTargetsForVersion - Print the registered targets
781 /// appropriately for inclusion in a tool's version output.
783
784 /// @name Registry Access
785 /// @{
786
788
789 /// lookupTarget - Lookup a target based on a target triple.
790 ///
791 /// \param Triple - The triple to use for finding a target.
792 /// \param Error - On failure, an error string describing why no target was
793 /// found.
794 static const Target *lookupTarget(StringRef Triple, std::string &Error);
795
796 /// lookupTarget - Lookup a target based on an architecture name
797 /// and a target triple. If the architecture name is non-empty,
798 /// then the lookup is done by architecture. Otherwise, the target
799 /// triple is used.
800 ///
801 /// \param ArchName - The architecture to use for finding a target.
802 /// \param TheTriple - The triple to use for finding a target. The
803 /// triple is updated with canonical architecture name if a lookup
804 /// by architecture is done.
805 /// \param Error - On failure, an error string describing why no target was
806 /// found.
807 static const Target *lookupTarget(StringRef ArchName, Triple &TheTriple,
808 std::string &Error);
809
810 /// @}
811 /// @name Target Registration
812 /// @{
813
814 /// RegisterTarget - Register the given target. Attempts to register a
815 /// target which has already been registered will be ignored.
816 ///
817 /// Clients are responsible for ensuring that registration doesn't occur
818 /// while another thread is attempting to access the registry. Typically
819 /// this is done by initializing all targets at program startup.
820 ///
821 /// @param T - The target being registered.
822 /// @param Name - The target name. This should be a static string.
823 /// @param ShortDesc - A short target description. This should be a static
824 /// string.
825 /// @param BackendName - The name of the backend. This should be a static
826 /// string that is the same for all targets that share a backend
827 /// implementation and must match the name used in the 'def X : Target ...' in
828 /// TableGen.
829 /// @param ArchMatchFn - The arch match checking function for this target.
830 /// @param HasJIT - Whether the target supports JIT code
831 /// generation.
832 static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
833 const char *BackendName,
834 Target::ArchMatchFnTy ArchMatchFn,
835 bool HasJIT = false);
836
837 /// RegisterMCAsmInfo - Register a MCAsmInfo implementation for the
838 /// given target.
839 ///
840 /// Clients are responsible for ensuring that registration doesn't occur
841 /// while another thread is attempting to access the registry. Typically
842 /// this is done by initializing all targets at program startup.
843 ///
844 /// @param T - The target being registered.
845 /// @param Fn - A function to construct a MCAsmInfo for the target.
847 T.MCAsmInfoCtorFn = Fn;
848 }
849
850 /// Register a MCObjectFileInfo implementation for the given target.
851 ///
852 /// Clients are responsible for ensuring that registration doesn't occur
853 /// while another thread is attempting to access the registry. Typically
854 /// this is done by initializing all targets at program startup.
855 ///
856 /// @param T - The target being registered.
857 /// @param Fn - A function to construct a MCObjectFileInfo for the target.
860 T.MCObjectFileInfoCtorFn = Fn;
861 }
862
863 /// RegisterMCInstrInfo - Register a MCInstrInfo implementation for the
864 /// given target.
865 ///
866 /// Clients are responsible for ensuring that registration doesn't occur
867 /// while another thread is attempting to access the registry. Typically
868 /// this is done by initializing all targets at program startup.
869 ///
870 /// @param T - The target being registered.
871 /// @param Fn - A function to construct a MCInstrInfo for the target.
873 T.MCInstrInfoCtorFn = Fn;
874 }
875
876 /// RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for
877 /// the given target.
880 T.MCInstrAnalysisCtorFn = Fn;
881 }
882
883 /// RegisterMCRegInfo - Register a MCRegisterInfo implementation for the
884 /// given target.
885 ///
886 /// Clients are responsible for ensuring that registration doesn't occur
887 /// while another thread is attempting to access the registry. Typically
888 /// this is done by initializing all targets at program startup.
889 ///
890 /// @param T - The target being registered.
891 /// @param Fn - A function to construct a MCRegisterInfo for the target.
893 T.MCRegInfoCtorFn = Fn;
894 }
895
896 /// RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for
897 /// the given target.
898 ///
899 /// Clients are responsible for ensuring that registration doesn't occur
900 /// while another thread is attempting to access the registry. Typically
901 /// this is done by initializing all targets at program startup.
902 ///
903 /// @param T - The target being registered.
904 /// @param Fn - A function to construct a MCSubtargetInfo for the target.
907 T.MCSubtargetInfoCtorFn = Fn;
908 }
909
910 /// RegisterTargetMachine - Register a TargetMachine implementation for the
911 /// given target.
912 ///
913 /// Clients are responsible for ensuring that registration doesn't occur
914 /// while another thread is attempting to access the registry. Typically
915 /// this is done by initializing all targets at program startup.
916 ///
917 /// @param T - The target being registered.
918 /// @param Fn - A function to construct a TargetMachine for the target.
920 T.TargetMachineCtorFn = Fn;
921 }
922
923 /// RegisterMCAsmBackend - Register a MCAsmBackend implementation for the
924 /// given target.
925 ///
926 /// Clients are responsible for ensuring that registration doesn't occur
927 /// while another thread is attempting to access the registry. Typically
928 /// this is done by initializing all targets at program startup.
929 ///
930 /// @param T - The target being registered.
931 /// @param Fn - A function to construct an AsmBackend for the target.
933 T.MCAsmBackendCtorFn = Fn;
934 }
935
936 /// RegisterMCAsmParser - Register a MCTargetAsmParser implementation for
937 /// the given target.
938 ///
939 /// Clients are responsible for ensuring that registration doesn't occur
940 /// while another thread is attempting to access the registry. Typically
941 /// this is done by initializing all targets at program startup.
942 ///
943 /// @param T - The target being registered.
944 /// @param Fn - A function to construct an MCTargetAsmParser for the target.
946 T.MCAsmParserCtorFn = Fn;
947 }
948
949 /// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
950 /// target.
951 ///
952 /// Clients are responsible for ensuring that registration doesn't occur
953 /// while another thread is attempting to access the registry. Typically
954 /// this is done by initializing all targets at program startup.
955 ///
956 /// @param T - The target being registered.
957 /// @param Fn - A function to construct an AsmPrinter for the target.
959 T.AsmPrinterCtorFn = Fn;
960 }
961
962 /// RegisterMCDisassembler - Register a MCDisassembler implementation for
963 /// the given target.
964 ///
965 /// Clients are responsible for ensuring that registration doesn't occur
966 /// while another thread is attempting to access the registry. Typically
967 /// this is done by initializing all targets at program startup.
968 ///
969 /// @param T - The target being registered.
970 /// @param Fn - A function to construct an MCDisassembler for the target.
973 T.MCDisassemblerCtorFn = Fn;
974 }
975
976 /// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
977 /// given target.
978 ///
979 /// Clients are responsible for ensuring that registration doesn't occur
980 /// while another thread is attempting to access the registry. Typically
981 /// this is done by initializing all targets at program startup.
982 ///
983 /// @param T - The target being registered.
984 /// @param Fn - A function to construct an MCInstPrinter for the target.
986 T.MCInstPrinterCtorFn = Fn;
987 }
988
989 /// RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the
990 /// given target.
991 ///
992 /// Clients are responsible for ensuring that registration doesn't occur
993 /// while another thread is attempting to access the registry. Typically
994 /// this is done by initializing all targets at program startup.
995 ///
996 /// @param T - The target being registered.
997 /// @param Fn - A function to construct an MCCodeEmitter for the target.
999 T.MCCodeEmitterCtorFn = Fn;
1000 }
1001
1003 T.COFFStreamerCtorFn = Fn;
1004 }
1005
1007 T.MachOStreamerCtorFn = Fn;
1008 }
1009
1011 T.ELFStreamerCtorFn = Fn;
1012 }
1013
1015 T.SPIRVStreamerCtorFn = Fn;
1016 }
1017
1019 T.DXContainerStreamerCtorFn = Fn;
1020 }
1021
1023 T.WasmStreamerCtorFn = Fn;
1024 }
1025
1027 T.XCOFFStreamerCtorFn = Fn;
1028 }
1029
1032 T.NullTargetStreamerCtorFn = Fn;
1033 }
1034
1037 T.AsmTargetStreamerCtorFn = Fn;
1038 }
1039
1040 static void
1043 T.ObjectTargetStreamerCtorFn = Fn;
1044 }
1045
1046 /// RegisterMCRelocationInfo - Register an MCRelocationInfo
1047 /// implementation for the given target.
1048 ///
1049 /// Clients are responsible for ensuring that registration doesn't occur
1050 /// while another thread is attempting to access the registry. Typically
1051 /// this is done by initializing all targets at program startup.
1052 ///
1053 /// @param T - The target being registered.
1054 /// @param Fn - A function to construct an MCRelocationInfo for the target.
1057 T.MCRelocationInfoCtorFn = Fn;
1058 }
1059
1060 /// RegisterMCSymbolizer - Register an MCSymbolizer
1061 /// implementation for the given target.
1062 ///
1063 /// Clients are responsible for ensuring that registration doesn't occur
1064 /// while another thread is attempting to access the registry. Typically
1065 /// this is done by initializing all targets at program startup.
1066 ///
1067 /// @param T - The target being registered.
1068 /// @param Fn - A function to construct an MCSymbolizer for the target.
1070 T.MCSymbolizerCtorFn = Fn;
1071 }
1072
1073 /// RegisterCustomBehaviour - Register a CustomBehaviour
1074 /// implementation for the given target.
1075 ///
1076 /// Clients are responsible for ensuring that registration doesn't occur
1077 /// while another thread is attempting to access the registry. Typically
1078 /// this is done by initializing all targets at program startup.
1079 ///
1080 /// @param T - The target being registered.
1081 /// @param Fn - A function to construct a CustomBehaviour for the target.
1084 T.CustomBehaviourCtorFn = Fn;
1085 }
1086
1087 /// RegisterInstrPostProcess - Register an InstrPostProcess
1088 /// implementation for the given target.
1089 ///
1090 /// Clients are responsible for ensuring that registration doesn't occur
1091 /// while another thread is attempting to access the registry. Typically
1092 /// this is done by initializing all targets at program startup.
1093 ///
1094 /// @param T - The target being registered.
1095 /// @param Fn - A function to construct an InstrPostProcess for the target.
1098 T.InstrPostProcessCtorFn = Fn;
1099 }
1100
1101 /// RegisterInstrumentManager - Register an InstrumentManager
1102 /// implementation for the given target.
1103 ///
1104 /// Clients are responsible for ensuring that registration doesn't occur
1105 /// while another thread is attempting to access the registry. Typically
1106 /// this is done by initializing all targets at program startup.
1107 ///
1108 /// @param T - The target being registered.
1109 /// @param Fn - A function to construct an InstrumentManager for the
1110 /// target.
1113 T.InstrumentManagerCtorFn = Fn;
1114 }
1115
1116 /// @}
1117};
1118
1119//===--------------------------------------------------------------------===//
1120
1121/// RegisterTarget - Helper template for registering a target, for use in the
1122/// target's initialization function. Usage:
1123///
1124///
1125/// Target &getTheFooTarget() { // The global target instance.
1126/// static Target TheFooTarget;
1127/// return TheFooTarget;
1128/// }
1129/// extern "C" void LLVMInitializeFooTargetInfo() {
1130/// RegisterTarget<Triple::foo> X(getTheFooTarget(), "foo", "Foo
1131/// description", "Foo" /* Backend Name */);
1132/// }
1133template <Triple::ArchType TargetArchType = Triple::UnknownArch,
1134 bool HasJIT = false>
1136 RegisterTarget(Target &T, const char *Name, const char *Desc,
1137 const char *BackendName) {
1138 TargetRegistry::RegisterTarget(T, Name, Desc, BackendName, &getArchMatch,
1139 HasJIT);
1140 }
1141
1142 static bool getArchMatch(Triple::ArchType Arch) {
1143 return Arch == TargetArchType;
1144 }
1145};
1146
1147/// RegisterMCAsmInfo - Helper template for registering a target assembly info
1148/// implementation. This invokes the static "Create" method on the class to
1149/// actually do the construction. Usage:
1150///
1151/// extern "C" void LLVMInitializeFooTarget() {
1152/// extern Target TheFooTarget;
1153/// RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
1154/// }
1155template <class MCAsmInfoImpl> struct RegisterMCAsmInfo {
1158 }
1159
1160private:
1161 static MCAsmInfo *Allocator(const MCRegisterInfo & /*MRI*/, const Triple &TT,
1162 const MCTargetOptions &Options) {
1163 return new MCAsmInfoImpl(TT, Options);
1164 }
1165};
1166
1167/// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
1168/// implementation. This invokes the specified function to do the
1169/// construction. Usage:
1170///
1171/// extern "C" void LLVMInitializeFooTarget() {
1172/// extern Target TheFooTarget;
1173/// RegisterMCAsmInfoFn X(TheFooTarget, TheFunction);
1174/// }
1178 }
1179};
1180
1181/// Helper template for registering a target object file info implementation.
1182/// This invokes the static "Create" method on the class to actually do the
1183/// construction. Usage:
1184///
1185/// extern "C" void LLVMInitializeFooTarget() {
1186/// extern Target TheFooTarget;
1187/// RegisterMCObjectFileInfo<FooMCObjectFileInfo> X(TheFooTarget);
1188/// }
1189template <class MCObjectFileInfoImpl> struct RegisterMCObjectFileInfo {
1192 }
1193
1194private:
1195 static MCObjectFileInfo *Allocator(MCContext &Ctx, bool PIC,
1196 bool LargeCodeModel = false) {
1197 return new MCObjectFileInfoImpl(Ctx, PIC, LargeCodeModel);
1198 }
1199};
1200
1201/// Helper template for registering a target object file info implementation.
1202/// This invokes the specified function to do the construction. Usage:
1203///
1204/// extern "C" void LLVMInitializeFooTarget() {
1205/// extern Target TheFooTarget;
1206/// RegisterMCObjectFileInfoFn X(TheFooTarget, TheFunction);
1207/// }
1211 }
1212};
1213
1214/// RegisterMCInstrInfo - Helper template for registering a target instruction
1215/// info implementation. This invokes the static "Create" method on the class
1216/// to actually do the construction. Usage:
1217///
1218/// extern "C" void LLVMInitializeFooTarget() {
1219/// extern Target TheFooTarget;
1220/// RegisterMCInstrInfo<FooMCInstrInfo> X(TheFooTarget);
1221/// }
1222template <class MCInstrInfoImpl> struct RegisterMCInstrInfo {
1225 }
1226
1227private:
1228 static MCInstrInfo *Allocator() { return new MCInstrInfoImpl(); }
1229};
1230
1231/// RegisterMCInstrInfoFn - Helper template for registering a target
1232/// instruction info implementation. This invokes the specified function to
1233/// do the construction. Usage:
1234///
1235/// extern "C" void LLVMInitializeFooTarget() {
1236/// extern Target TheFooTarget;
1237/// RegisterMCInstrInfoFn X(TheFooTarget, TheFunction);
1238/// }
1242 }
1243};
1244
1245/// RegisterMCInstrAnalysis - Helper template for registering a target
1246/// instruction analyzer implementation. This invokes the static "Create"
1247/// method on the class to actually do the construction. Usage:
1248///
1249/// extern "C" void LLVMInitializeFooTarget() {
1250/// extern Target TheFooTarget;
1251/// RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
1252/// }
1253template <class MCInstrAnalysisImpl> struct RegisterMCInstrAnalysis {
1256 }
1257
1258private:
1259 static MCInstrAnalysis *Allocator(const MCInstrInfo *Info) {
1260 return new MCInstrAnalysisImpl(Info);
1261 }
1262};
1263
1264/// RegisterMCInstrAnalysisFn - Helper template for registering a target
1265/// instruction analyzer implementation. This invokes the specified function
1266/// to do the construction. Usage:
1267///
1268/// extern "C" void LLVMInitializeFooTarget() {
1269/// extern Target TheFooTarget;
1270/// RegisterMCInstrAnalysisFn X(TheFooTarget, TheFunction);
1271/// }
1275 }
1276};
1277
1278/// RegisterMCRegInfo - Helper template for registering a target register info
1279/// implementation. This invokes the static "Create" method on the class to
1280/// actually do the construction. Usage:
1281///
1282/// extern "C" void LLVMInitializeFooTarget() {
1283/// extern Target TheFooTarget;
1284/// RegisterMCRegInfo<FooMCRegInfo> X(TheFooTarget);
1285/// }
1286template <class MCRegisterInfoImpl> struct RegisterMCRegInfo {
1289 }
1290
1291private:
1292 static MCRegisterInfo *Allocator(const Triple & /*TT*/) {
1293 return new MCRegisterInfoImpl();
1294 }
1295};
1296
1297/// RegisterMCRegInfoFn - Helper template for registering a target register
1298/// info implementation. This invokes the specified function to do the
1299/// construction. Usage:
1300///
1301/// extern "C" void LLVMInitializeFooTarget() {
1302/// extern Target TheFooTarget;
1303/// RegisterMCRegInfoFn X(TheFooTarget, TheFunction);
1304/// }
1308 }
1309};
1310
1311/// RegisterMCSubtargetInfo - Helper template for registering a target
1312/// subtarget info implementation. This invokes the static "Create" method
1313/// on the class to actually do the construction. Usage:
1314///
1315/// extern "C" void LLVMInitializeFooTarget() {
1316/// extern Target TheFooTarget;
1317/// RegisterMCSubtargetInfo<FooMCSubtargetInfo> X(TheFooTarget);
1318/// }
1319template <class MCSubtargetInfoImpl> struct RegisterMCSubtargetInfo {
1322 }
1323
1324private:
1325 static MCSubtargetInfo *Allocator(const Triple & /*TT*/, StringRef /*CPU*/,
1326 StringRef /*FS*/) {
1327 return new MCSubtargetInfoImpl();
1328 }
1329};
1330
1331/// RegisterMCSubtargetInfoFn - Helper template for registering a target
1332/// subtarget info implementation. This invokes the specified function to
1333/// do the construction. Usage:
1334///
1335/// extern "C" void LLVMInitializeFooTarget() {
1336/// extern Target TheFooTarget;
1337/// RegisterMCSubtargetInfoFn X(TheFooTarget, TheFunction);
1338/// }
1342 }
1343};
1344
1345/// RegisterTargetMachine - Helper template for registering a target machine
1346/// implementation, for use in the target machine initialization
1347/// function. Usage:
1348///
1349/// extern "C" void LLVMInitializeFooTarget() {
1350/// extern Target TheFooTarget;
1351/// RegisterTargetMachine<FooTargetMachine> X(TheFooTarget);
1352/// }
1353template <class TargetMachineImpl> struct RegisterTargetMachine {
1356 }
1357
1358private:
1359 static TargetMachine *Allocator(const Target &T, const Triple &TT,
1360 StringRef CPU, StringRef FS,
1361 const TargetOptions &Options,
1362 std::optional<Reloc::Model> RM,
1363 std::optional<CodeModel::Model> CM,
1364 CodeGenOpt::Level OL, bool JIT) {
1365 return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL, JIT);
1366 }
1367};
1368
1369/// RegisterMCAsmBackend - Helper template for registering a target specific
1370/// assembler backend. Usage:
1371///
1372/// extern "C" void LLVMInitializeFooMCAsmBackend() {
1373/// extern Target TheFooTarget;
1374/// RegisterMCAsmBackend<FooAsmLexer> X(TheFooTarget);
1375/// }
1376template <class MCAsmBackendImpl> struct RegisterMCAsmBackend {
1379 }
1380
1381private:
1382 static MCAsmBackend *Allocator(const Target &T, const MCSubtargetInfo &STI,
1383 const MCRegisterInfo &MRI,
1384 const MCTargetOptions &Options) {
1385 return new MCAsmBackendImpl(T, STI, MRI);
1386 }
1387};
1388
1389/// RegisterMCAsmParser - Helper template for registering a target specific
1390/// assembly parser, for use in the target machine initialization
1391/// function. Usage:
1392///
1393/// extern "C" void LLVMInitializeFooMCAsmParser() {
1394/// extern Target TheFooTarget;
1395/// RegisterMCAsmParser<FooAsmParser> X(TheFooTarget);
1396/// }
1397template <class MCAsmParserImpl> struct RegisterMCAsmParser {
1400 }
1401
1402private:
1403 static MCTargetAsmParser *Allocator(const MCSubtargetInfo &STI,
1404 MCAsmParser &P, const MCInstrInfo &MII,
1405 const MCTargetOptions &Options) {
1406 return new MCAsmParserImpl(STI, P, MII, Options);
1407 }
1408};
1409
1410/// RegisterAsmPrinter - Helper template for registering a target specific
1411/// assembly printer, for use in the target machine initialization
1412/// function. Usage:
1413///
1414/// extern "C" void LLVMInitializeFooAsmPrinter() {
1415/// extern Target TheFooTarget;
1416/// RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
1417/// }
1418template <class AsmPrinterImpl> struct RegisterAsmPrinter {
1421 }
1422
1423private:
1425 std::unique_ptr<MCStreamer> &&Streamer) {
1426 return new AsmPrinterImpl(TM, std::move(Streamer));
1427 }
1428};
1429
1430/// RegisterMCCodeEmitter - Helper template for registering a target specific
1431/// machine code emitter, for use in the target initialization
1432/// function. Usage:
1433///
1434/// extern "C" void LLVMInitializeFooMCCodeEmitter() {
1435/// extern Target TheFooTarget;
1436/// RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
1437/// }
1438template <class MCCodeEmitterImpl> struct RegisterMCCodeEmitter {
1441 }
1442
1443private:
1444 static MCCodeEmitter *Allocator(const MCInstrInfo & /*II*/,
1445 MCContext & /*Ctx*/) {
1446 return new MCCodeEmitterImpl();
1447 }
1448};
1449
1450} // end namespace llvm
1451
1452#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
@ Target
Definition: TextStubV5.cpp:91
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:156
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:41
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:76
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:44
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:78
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
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.
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.
TargetMachine *(*)(const Target &T, const Triple &TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT) TargetMachineCtorTy
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.
bool(*)(Triple::ArchType Arch) ArchMatchFnTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll) ELFStreamerCtorTy
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
bool hasMCAsmBackend() const
hasMCAsmBackend - Check if this target supports .o generation.
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 *(*)(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll, bool DWARFMustBeAtTheEnd) MachOStreamerCtorTy
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.
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 RelaxAll, bool IncrementalLinkerCompatible, bool DWARFMustBeAtTheEnd) const
Create a target specific MCStreamer.
const char * getBackendName() const
getBackendName - Get the backend name.
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll) SPIRVStreamerCtorTy
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.
TargetMachine * createTargetMachine(StringRef TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM=std::nullopt, CodeGenOpt::Level OL=CodeGenOpt::Default, bool JIT=false) const
createTargetMachine - Create a target specific machine implementation for the specified Triple.
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
mca::InstrumentManager *(*)(const MCSubtargetInfo &STI, const MCInstrInfo &MCII) InstrumentManagerCtorTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll) WasmStreamerCtorTy
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
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll, bool IncrementalLinkerCompatible) COFFStreamerCtorTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll) XCOFFStreamerCtorTy
MCStreamer *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll) DXContainerStreamerCtorTy
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:284
@ UnknownObjectFormat
Definition: Triple.h:281
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.
Level
Code generation optimization level.
Definition: CodeGen.h:57
@ Default
-O2, -Os
Definition: CodeGen.h:60
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCStreamer * createSPIRVStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
mca::CustomBehaviour * createCustomBehaviour(const MCSubtargetInfo &STI, const mca::SourceMgr &SrcMgr, const MCInstrInfo &MCII)
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 * createDXContainerStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
SourceMgr SrcMgr
Definition: Error.cpp:24
MCRelocationInfo * createMCRelocationInfo(const Triple &TT, MCContext &Ctx)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:145
MCStreamer * createXCOFFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
MCStreamer * createMachOStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll, bool DWARFMustBeAtTheEnd, bool LabelSections=false)
MCStreamer * createWasmStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
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,...
mca::InstrumentManager * createInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
mca::InstrPostProcess * createInstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
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 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