Fix use of uninitialized valued.
[oota-llvm.git] / include / llvm / Support / TargetRegistry.h
1 //===-- Support/TargetRegistry.h - Target Registration ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file exposes the TargetRegistry interface, which tools can use to access
11 // the appropriate target specific classes (TargetMachine, AsmPrinter, etc.)
12 // which have been registered.
13 //
14 // Target specific class implementations should register themselves using the
15 // appropriate TargetRegistry interfaces.
16 //
17 //===----------------------------------------------------------------------===//
18
19 #ifndef LLVM_SUPPORT_TARGETREGISTRY_H
20 #define LLVM_SUPPORT_TARGETREGISTRY_H
21
22 #include "llvm-c/Disassembler.h"
23 #include "llvm/ADT/Triple.h"
24 #include "llvm/Support/CodeGen.h"
25 #include <cassert>
26 #include <memory>
27 #include <string>
28
29 namespace llvm {
30   class AsmPrinter;
31   class Module;
32   class MCAssembler;
33   class MCAsmBackend;
34   class MCAsmInfo;
35   class MCAsmParser;
36   class MCCodeEmitter;
37   class MCCodeGenInfo;
38   class MCContext;
39   class MCDisassembler;
40   class MCInstrAnalysis;
41   class MCInstPrinter;
42   class MCInstrInfo;
43   class MCRegisterInfo;
44   class MCStreamer;
45   class MCSubtargetInfo;
46   class MCSymbolizer;
47   class MCRelocationInfo;
48   class MCTargetAsmParser;
49   class MCTargetOptions;
50   class MCTargetStreamer;
51   class TargetMachine;
52   class TargetOptions;
53   class raw_ostream;
54   class formatted_raw_ostream;
55
56   MCStreamer *createNullStreamer(MCContext &Ctx);
57   MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
58                                 bool isVerboseAsm, bool useDwarfDirectory,
59                                 MCInstPrinter *InstPrint, MCCodeEmitter *CE,
60                                 MCAsmBackend *TAB, bool ShowInst);
61   MCStreamer *createObjectStreamer(const Triple &T, MCContext &Ctx,
62                                    MCAsmBackend &TAB, raw_ostream &OS,
63                                    MCCodeEmitter *Emitter,
64                                    const MCSubtargetInfo &STI, bool RelaxAll);
65
66   MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx);
67
68   MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
69                                    LLVMSymbolLookupCallback SymbolLookUp,
70                                    void *DisInfo, MCContext *Ctx,
71                                    std::unique_ptr<MCRelocationInfo> &&RelInfo);
72
73   /// Target - Wrapper for Target specific information.
74   ///
75   /// For registration purposes, this is a POD type so that targets can be
76   /// registered without the use of static constructors.
77   ///
78   /// Targets should implement a single global instance of this class (which
79   /// will be zero initialized), and pass that instance to the TargetRegistry as
80   /// part of their initialization.
81   class Target {
82   public:
83     friend struct TargetRegistry;
84
85     typedef bool (*ArchMatchFnTy)(Triple::ArchType Arch);
86
87     typedef MCAsmInfo *(*MCAsmInfoCtorFnTy)(const MCRegisterInfo &MRI,
88                                             StringRef TT);
89     typedef MCCodeGenInfo *(*MCCodeGenInfoCtorFnTy)(StringRef TT,
90                                                     Reloc::Model RM,
91                                                     CodeModel::Model CM,
92                                                     CodeGenOpt::Level OL);
93     typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void);
94     typedef MCInstrAnalysis *(*MCInstrAnalysisCtorFnTy)(const MCInstrInfo*Info);
95     typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(StringRef TT);
96     typedef MCSubtargetInfo *(*MCSubtargetInfoCtorFnTy)(StringRef TT,
97                                                         StringRef CPU,
98                                                         StringRef Features);
99     typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
100                                                   StringRef TT,
101                                                   StringRef CPU,
102                                                   StringRef Features,
103                                                   const TargetOptions &Options,
104                                                   Reloc::Model RM,
105                                                   CodeModel::Model CM,
106                                                   CodeGenOpt::Level OL);
107     // If it weren't for layering issues (this header is in llvm/Support, but
108     // depends on MC?) this should take the Streamer by value rather than rvalue
109     // reference.
110     typedef AsmPrinter *(*AsmPrinterCtorTy)(
111         TargetMachine &TM, std::unique_ptr<MCStreamer> &&Streamer);
112     typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T,
113                                                 const MCRegisterInfo &MRI,
114                                                 StringRef TT,
115                                                 StringRef CPU);
116     typedef MCTargetAsmParser *(*MCAsmParserCtorTy)(
117         MCSubtargetInfo &STI,
118         MCAsmParser &P,
119         const MCInstrInfo &MII,
120         const MCTargetOptions &Options);
121     typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T,
122                                                     const MCSubtargetInfo &STI,
123                                                     MCContext &Ctx);
124     typedef MCInstPrinter *(*MCInstPrinterCtorTy)(const Target &T,
125                                                   unsigned SyntaxVariant,
126                                                   const MCAsmInfo &MAI,
127                                                   const MCInstrInfo &MII,
128                                                   const MCRegisterInfo &MRI,
129                                                   const MCSubtargetInfo &STI);
130     typedef MCCodeEmitter *(*MCCodeEmitterCtorTy)(const MCInstrInfo &II,
131                                                   const MCRegisterInfo &MRI,
132                                                   MCContext &Ctx);
133     typedef MCStreamer *(*MCObjectStreamerCtorTy)(
134         const Triple &T, MCContext &Ctx, MCAsmBackend &TAB, raw_ostream &OS,
135         MCCodeEmitter *Emitter, const MCSubtargetInfo &STI, bool RelaxAll);
136     typedef MCTargetStreamer *(*NullTargetStreamerCtorTy)(MCStreamer &S);
137     typedef MCTargetStreamer *(*AsmTargetStreamerCtorTy)(
138         MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint,
139         bool IsVerboseAsm);
140     typedef MCRelocationInfo *(*MCRelocationInfoCtorTy)(StringRef TT,
141                                                         MCContext &Ctx);
142     typedef MCSymbolizer *(*MCSymbolizerCtorTy)(
143         StringRef TT, LLVMOpInfoCallback GetOpInfo,
144         LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx,
145         std::unique_ptr<MCRelocationInfo> &&RelInfo);
146
147   private:
148     /// Next - The next registered target in the linked list, maintained by the
149     /// TargetRegistry.
150     Target *Next;
151
152     /// The target function for checking if an architecture is supported.
153     ArchMatchFnTy ArchMatchFn;
154
155     /// Name - The target name.
156     const char *Name;
157
158     /// ShortDesc - A short description of the target.
159     const char *ShortDesc;
160
161     /// HasJIT - Whether this target supports the JIT.
162     bool HasJIT;
163
164     /// MCAsmInfoCtorFn - Constructor function for this target's MCAsmInfo, if
165     /// registered.
166     MCAsmInfoCtorFnTy MCAsmInfoCtorFn;
167
168     /// MCCodeGenInfoCtorFn - Constructor function for this target's
169     /// MCCodeGenInfo, if registered.
170     MCCodeGenInfoCtorFnTy MCCodeGenInfoCtorFn;
171
172     /// MCInstrInfoCtorFn - Constructor function for this target's MCInstrInfo,
173     /// if registered.
174     MCInstrInfoCtorFnTy MCInstrInfoCtorFn;
175
176     /// MCInstrAnalysisCtorFn - Constructor function for this target's
177     /// MCInstrAnalysis, if registered.
178     MCInstrAnalysisCtorFnTy MCInstrAnalysisCtorFn;
179
180     /// MCRegInfoCtorFn - Constructor function for this target's MCRegisterInfo,
181     /// if registered.
182     MCRegInfoCtorFnTy MCRegInfoCtorFn;
183
184     /// MCSubtargetInfoCtorFn - Constructor function for this target's
185     /// MCSubtargetInfo, if registered.
186     MCSubtargetInfoCtorFnTy MCSubtargetInfoCtorFn;
187
188     /// TargetMachineCtorFn - Construction function for this target's
189     /// TargetMachine, if registered.
190     TargetMachineCtorTy TargetMachineCtorFn;
191
192     /// MCAsmBackendCtorFn - Construction function for this target's
193     /// MCAsmBackend, if registered.
194     MCAsmBackendCtorTy MCAsmBackendCtorFn;
195
196     /// MCAsmParserCtorFn - Construction function for this target's
197     /// MCTargetAsmParser, if registered.
198     MCAsmParserCtorTy MCAsmParserCtorFn;
199
200     /// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
201     /// if registered.
202     AsmPrinterCtorTy AsmPrinterCtorFn;
203
204     /// MCDisassemblerCtorFn - Construction function for this target's
205     /// MCDisassembler, if registered.
206     MCDisassemblerCtorTy MCDisassemblerCtorFn;
207
208     /// MCInstPrinterCtorFn - Construction function for this target's
209     /// MCInstPrinter, if registered.
210     MCInstPrinterCtorTy MCInstPrinterCtorFn;
211
212     /// MCCodeEmitterCtorFn - Construction function for this target's
213     /// CodeEmitter, if registered.
214     MCCodeEmitterCtorTy MCCodeEmitterCtorFn;
215
216     /// MCObjectStreamerCtorFn - Construction function for this target's
217     /// MCObjectStreamer, if registered.
218     MCObjectStreamerCtorTy MCObjectStreamerCtorFn;
219
220     /// Construction function for this target's null TargetStreamer, if
221     /// registered (default = nullptr).
222     NullTargetStreamerCtorTy NullTargetStreamerCtorFn;
223
224     /// Construction function for this target's asm TargetStreamer, if
225     /// registered (default = nullptr).
226     AsmTargetStreamerCtorTy AsmTargetStreamerCtorFn;
227
228     /// MCRelocationInfoCtorFn - Construction function for this target's
229     /// MCRelocationInfo, if registered (default = llvm::createMCRelocationInfo)
230     MCRelocationInfoCtorTy MCRelocationInfoCtorFn;
231
232     /// MCSymbolizerCtorFn - Construction function for this target's
233     /// MCSymbolizer, if registered (default = llvm::createMCSymbolizer)
234     MCSymbolizerCtorTy MCSymbolizerCtorFn;
235
236   public:
237     Target()
238         : MCObjectStreamerCtorFn(nullptr), NullTargetStreamerCtorFn(nullptr),
239           AsmTargetStreamerCtorFn(nullptr), MCRelocationInfoCtorFn(nullptr),
240           MCSymbolizerCtorFn(nullptr) {}
241
242     /// @name Target Information
243     /// @{
244
245     // getNext - Return the next registered target.
246     const Target *getNext() const { return Next; }
247
248     /// getName - Get the target name.
249     const char *getName() const { return Name; }
250
251     /// getShortDescription - Get a short description of the target.
252     const char *getShortDescription() const { return ShortDesc; }
253
254     /// @}
255     /// @name Feature Predicates
256     /// @{
257
258     /// hasJIT - Check if this targets supports the just-in-time compilation.
259     bool hasJIT() const { return HasJIT; }
260
261     /// hasTargetMachine - Check if this target supports code generation.
262     bool hasTargetMachine() const { return TargetMachineCtorFn != nullptr; }
263
264     /// hasMCAsmBackend - Check if this target supports .o generation.
265     bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != nullptr; }
266
267     /// @}
268     /// @name Feature Constructors
269     /// @{
270
271     /// createMCAsmInfo - Create a MCAsmInfo implementation for the specified
272     /// target triple.
273     ///
274     /// \param Triple This argument is used to determine the target machine
275     /// feature set; it should always be provided. Generally this should be
276     /// either the target triple from the module, or the target triple of the
277     /// host if that does not exist.
278     MCAsmInfo *createMCAsmInfo(const MCRegisterInfo &MRI,
279                                StringRef Triple) const {
280       if (!MCAsmInfoCtorFn)
281         return nullptr;
282       return MCAsmInfoCtorFn(MRI, Triple);
283     }
284
285     /// createMCCodeGenInfo - Create a MCCodeGenInfo implementation.
286     ///
287     MCCodeGenInfo *createMCCodeGenInfo(StringRef Triple, Reloc::Model RM,
288                                        CodeModel::Model CM,
289                                        CodeGenOpt::Level OL) const {
290       if (!MCCodeGenInfoCtorFn)
291         return nullptr;
292       return MCCodeGenInfoCtorFn(Triple, RM, CM, OL);
293     }
294
295     /// createMCInstrInfo - Create a MCInstrInfo implementation.
296     ///
297     MCInstrInfo *createMCInstrInfo() const {
298       if (!MCInstrInfoCtorFn)
299         return nullptr;
300       return MCInstrInfoCtorFn();
301     }
302
303     /// createMCInstrAnalysis - Create a MCInstrAnalysis implementation.
304     ///
305     MCInstrAnalysis *createMCInstrAnalysis(const MCInstrInfo *Info) const {
306       if (!MCInstrAnalysisCtorFn)
307         return nullptr;
308       return MCInstrAnalysisCtorFn(Info);
309     }
310
311     /// createMCRegInfo - Create a MCRegisterInfo implementation.
312     ///
313     MCRegisterInfo *createMCRegInfo(StringRef Triple) const {
314       if (!MCRegInfoCtorFn)
315         return nullptr;
316       return MCRegInfoCtorFn(Triple);
317     }
318
319     /// createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
320     ///
321     /// \param Triple This argument is used to determine the target machine
322     /// feature set; it should always be provided. Generally this should be
323     /// either the target triple from the module, or the target triple of the
324     /// host if that does not exist.
325     /// \param CPU This specifies the name of the target CPU.
326     /// \param Features This specifies the string representation of the
327     /// additional target features.
328     MCSubtargetInfo *createMCSubtargetInfo(StringRef Triple, StringRef CPU,
329                                            StringRef Features) const {
330       if (!MCSubtargetInfoCtorFn)
331         return nullptr;
332       return MCSubtargetInfoCtorFn(Triple, CPU, Features);
333     }
334
335     /// createTargetMachine - Create a target specific machine implementation
336     /// for the specified \p Triple.
337     ///
338     /// \param Triple This argument is used to determine the target machine
339     /// feature set; it should always be provided. Generally this should be
340     /// either the target triple from the module, or the target triple of the
341     /// host if that does not exist.
342     TargetMachine *createTargetMachine(StringRef Triple, StringRef CPU,
343                              StringRef Features, const TargetOptions &Options,
344                              Reloc::Model RM = Reloc::Default,
345                              CodeModel::Model CM = CodeModel::Default,
346                              CodeGenOpt::Level OL = CodeGenOpt::Default) const {
347       if (!TargetMachineCtorFn)
348         return nullptr;
349       return TargetMachineCtorFn(*this, Triple, CPU, Features, Options,
350                                  RM, CM, OL);
351     }
352
353     /// createMCAsmBackend - Create a target specific assembly parser.
354     ///
355     /// \param Triple The target triple string.
356     MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI,
357                                      StringRef Triple, StringRef CPU) const {
358       if (!MCAsmBackendCtorFn)
359         return nullptr;
360       return MCAsmBackendCtorFn(*this, MRI, Triple, CPU);
361     }
362
363     /// createMCAsmParser - Create a target specific assembly parser.
364     ///
365     /// \param Parser The target independent parser implementation to use for
366     /// parsing and lexing.
367     MCTargetAsmParser *createMCAsmParser(
368         MCSubtargetInfo &STI,
369         MCAsmParser &Parser,
370         const MCInstrInfo &MII,
371         const MCTargetOptions &Options) const {
372       if (!MCAsmParserCtorFn)
373         return nullptr;
374       return MCAsmParserCtorFn(STI, Parser, MII, Options);
375     }
376
377     /// createAsmPrinter - Create a target specific assembly printer pass.  This
378     /// takes ownership of the MCStreamer object.
379     AsmPrinter *createAsmPrinter(TargetMachine &TM,
380                                  std::unique_ptr<MCStreamer> &&Streamer) const {
381       if (!AsmPrinterCtorFn)
382         return nullptr;
383       return AsmPrinterCtorFn(TM, std::move(Streamer));
384     }
385
386     MCDisassembler *createMCDisassembler(const MCSubtargetInfo &STI,
387                                          MCContext &Ctx) const {
388       if (!MCDisassemblerCtorFn)
389         return nullptr;
390       return MCDisassemblerCtorFn(*this, STI, Ctx);
391     }
392
393     MCInstPrinter *createMCInstPrinter(unsigned SyntaxVariant,
394                                        const MCAsmInfo &MAI,
395                                        const MCInstrInfo &MII,
396                                        const MCRegisterInfo &MRI,
397                                        const MCSubtargetInfo &STI) const {
398       if (!MCInstPrinterCtorFn)
399         return nullptr;
400       return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, MII, MRI, STI);
401     }
402
403
404     /// createMCCodeEmitter - Create a target specific code emitter.
405     MCCodeEmitter *createMCCodeEmitter(const MCInstrInfo &II,
406                                        const MCRegisterInfo &MRI,
407                                        MCContext &Ctx) const {
408       if (!MCCodeEmitterCtorFn)
409         return nullptr;
410       return MCCodeEmitterCtorFn(II, MRI, Ctx);
411     }
412
413     /// Create a target specific MCStreamer.
414     ///
415     /// \param T The target triple.
416     /// \param Ctx The target context.
417     /// \param TAB The target assembler backend object. Takes ownership.
418     /// \param OS The stream object.
419     /// \param Emitter The target independent assembler object.Takes ownership.
420     /// \param RelaxAll Relax all fixups?
421     MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
422                                        MCAsmBackend &TAB, raw_ostream &OS,
423                                        MCCodeEmitter *Emitter,
424                                        const MCSubtargetInfo &STI,
425                                        bool RelaxAll) const {
426       if (!MCObjectStreamerCtorFn)
427         return llvm::createObjectStreamer(T, Ctx, TAB, OS, Emitter, STI,
428                                           RelaxAll);
429       return MCObjectStreamerCtorFn(T, Ctx, TAB, OS, Emitter, STI, RelaxAll);
430     }
431
432     MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
433                                   bool IsVerboseAsm, bool UseDwarfDirectory,
434                                   MCInstPrinter *InstPrint, MCCodeEmitter *CE,
435                                   MCAsmBackend *TAB, bool ShowInst) const {
436       MCStreamer *S =
437           llvm::createAsmStreamer(Ctx, OS, IsVerboseAsm, UseDwarfDirectory,
438                                   InstPrint, CE, TAB, ShowInst);
439       createAsmTargetStreamer(*S, OS, InstPrint, IsVerboseAsm);
440       return S;
441     }
442
443     MCTargetStreamer *createAsmTargetStreamer(MCStreamer &S,
444                                               formatted_raw_ostream &OS,
445                                               MCInstPrinter *InstPrint,
446                                               bool IsVerboseAsm) const {
447       if (AsmTargetStreamerCtorFn)
448         return AsmTargetStreamerCtorFn(S, OS, InstPrint, IsVerboseAsm);
449       return nullptr;
450     }
451
452     MCStreamer *createNullStreamer(MCContext &Ctx) const {
453       MCStreamer *S = llvm::createNullStreamer(Ctx);
454       createNullTargetStreamer(*S);
455       return S;
456     }
457
458     MCTargetStreamer *createNullTargetStreamer(MCStreamer &S) const {
459       if (NullTargetStreamerCtorFn)
460         return NullTargetStreamerCtorFn(S);
461       return nullptr;
462     }
463
464     /// createMCRelocationInfo - Create a target specific MCRelocationInfo.
465     ///
466     /// \param TT The target triple.
467     /// \param Ctx The target context.
468     MCRelocationInfo *
469       createMCRelocationInfo(StringRef TT, MCContext &Ctx) const {
470       MCRelocationInfoCtorTy Fn = MCRelocationInfoCtorFn
471                                       ? MCRelocationInfoCtorFn
472                                       : llvm::createMCRelocationInfo;
473       return Fn(TT, Ctx);
474     }
475
476     /// createMCSymbolizer - Create a target specific MCSymbolizer.
477     ///
478     /// \param TT The target triple.
479     /// \param GetOpInfo The function to get the symbolic information for operands.
480     /// \param SymbolLookUp The function to lookup a symbol name.
481     /// \param DisInfo The pointer to the block of symbolic information for above call
482     /// back.
483     /// \param Ctx The target context.
484     /// \param RelInfo The relocation information for this target. Takes ownership.
485     MCSymbolizer *
486     createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
487                        LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo,
488                        MCContext *Ctx,
489                        std::unique_ptr<MCRelocationInfo> &&RelInfo) const {
490       MCSymbolizerCtorTy Fn =
491           MCSymbolizerCtorFn ? MCSymbolizerCtorFn : llvm::createMCSymbolizer;
492       return Fn(TT, GetOpInfo, SymbolLookUp, DisInfo, Ctx, std::move(RelInfo));
493     }
494
495     /// @}
496   };
497
498   /// TargetRegistry - Generic interface to target specific features.
499   struct TargetRegistry {
500     class iterator {
501       const Target *Current;
502       explicit iterator(Target *T) : Current(T) {}
503       friend struct TargetRegistry;
504     public:
505       iterator() : Current(nullptr) {}
506
507       bool operator==(const iterator &x) const {
508         return Current == x.Current;
509       }
510       bool operator!=(const iterator &x) const {
511         return !operator==(x);
512       }
513
514       // Iterator traversal: forward iteration only
515       iterator &operator++() {          // Preincrement
516         assert(Current && "Cannot increment end iterator!");
517         Current = Current->getNext();
518         return *this;
519       }
520       iterator operator++(int) {        // Postincrement
521         iterator tmp = *this;
522         ++*this;
523         return tmp;
524       }
525
526       const Target &operator*() const {
527         assert(Current && "Cannot dereference end iterator!");
528         return *Current;
529       }
530
531       const Target *operator->() const {
532         return &operator*();
533       }
534     };
535
536     /// printRegisteredTargetsForVersion - Print the registered targets
537     /// appropriately for inclusion in a tool's version output.
538     static void printRegisteredTargetsForVersion();
539
540     /// @name Registry Access
541     /// @{
542
543     static iterator begin();
544
545     static iterator end() { return iterator(); }
546
547     /// lookupTarget - Lookup a target based on a target triple.
548     ///
549     /// \param Triple - The triple to use for finding a target.
550     /// \param Error - On failure, an error string describing why no target was
551     /// found.
552     static const Target *lookupTarget(const std::string &Triple,
553                                       std::string &Error);
554
555     /// lookupTarget - Lookup a target based on an architecture name
556     /// and a target triple.  If the architecture name is non-empty,
557     /// then the lookup is done by architecture.  Otherwise, the target
558     /// triple is used.
559     ///
560     /// \param ArchName - The architecture to use for finding a target.
561     /// \param TheTriple - The triple to use for finding a target.  The
562     /// triple is updated with canonical architecture name if a lookup
563     /// by architecture is done.
564     /// \param Error - On failure, an error string describing why no target was
565     /// found.
566     static const Target *lookupTarget(const std::string &ArchName,
567                                       Triple &TheTriple,
568                                       std::string &Error);
569
570     /// @}
571     /// @name Target Registration
572     /// @{
573
574     /// RegisterTarget - Register the given target. Attempts to register a
575     /// target which has already been registered will be ignored.
576     ///
577     /// Clients are responsible for ensuring that registration doesn't occur
578     /// while another thread is attempting to access the registry. Typically
579     /// this is done by initializing all targets at program startup.
580     ///
581     /// @param T - The target being registered.
582     /// @param Name - The target name. This should be a static string.
583     /// @param ShortDesc - A short target description. This should be a static
584     /// string.
585     /// @param ArchMatchFn - The arch match checking function for this target.
586     /// @param HasJIT - Whether the target supports JIT code
587     /// generation.
588     static void RegisterTarget(Target &T,
589                                const char *Name,
590                                const char *ShortDesc,
591                                Target::ArchMatchFnTy ArchMatchFn,
592                                bool HasJIT = false);
593
594     /// RegisterMCAsmInfo - Register a MCAsmInfo implementation for the
595     /// given target.
596     ///
597     /// Clients are responsible for ensuring that registration doesn't occur
598     /// while another thread is attempting to access the registry. Typically
599     /// this is done by initializing all targets at program startup.
600     ///
601     /// @param T - The target being registered.
602     /// @param Fn - A function to construct a MCAsmInfo for the target.
603     static void RegisterMCAsmInfo(Target &T, Target::MCAsmInfoCtorFnTy Fn) {
604       T.MCAsmInfoCtorFn = Fn;
605     }
606
607     /// RegisterMCCodeGenInfo - Register a MCCodeGenInfo implementation for the
608     /// given target.
609     ///
610     /// Clients are responsible for ensuring that registration doesn't occur
611     /// while another thread is attempting to access the registry. Typically
612     /// this is done by initializing all targets at program startup.
613     ///
614     /// @param T - The target being registered.
615     /// @param Fn - A function to construct a MCCodeGenInfo for the target.
616     static void RegisterMCCodeGenInfo(Target &T,
617                                      Target::MCCodeGenInfoCtorFnTy Fn) {
618       T.MCCodeGenInfoCtorFn = Fn;
619     }
620
621     /// RegisterMCInstrInfo - Register a MCInstrInfo implementation for the
622     /// given target.
623     ///
624     /// Clients are responsible for ensuring that registration doesn't occur
625     /// while another thread is attempting to access the registry. Typically
626     /// this is done by initializing all targets at program startup.
627     ///
628     /// @param T - The target being registered.
629     /// @param Fn - A function to construct a MCInstrInfo for the target.
630     static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn) {
631       T.MCInstrInfoCtorFn = Fn;
632     }
633
634     /// RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for
635     /// the given target.
636     static void RegisterMCInstrAnalysis(Target &T,
637                                         Target::MCInstrAnalysisCtorFnTy Fn) {
638       T.MCInstrAnalysisCtorFn = Fn;
639     }
640
641     /// RegisterMCRegInfo - Register a MCRegisterInfo implementation for the
642     /// given target.
643     ///
644     /// Clients are responsible for ensuring that registration doesn't occur
645     /// while another thread is attempting to access the registry. Typically
646     /// this is done by initializing all targets at program startup.
647     ///
648     /// @param T - The target being registered.
649     /// @param Fn - A function to construct a MCRegisterInfo for the target.
650     static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn) {
651       T.MCRegInfoCtorFn = Fn;
652     }
653
654     /// RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for
655     /// the given target.
656     ///
657     /// Clients are responsible for ensuring that registration doesn't occur
658     /// while another thread is attempting to access the registry. Typically
659     /// this is done by initializing all targets at program startup.
660     ///
661     /// @param T - The target being registered.
662     /// @param Fn - A function to construct a MCSubtargetInfo for the target.
663     static void RegisterMCSubtargetInfo(Target &T,
664                                         Target::MCSubtargetInfoCtorFnTy Fn) {
665       T.MCSubtargetInfoCtorFn = Fn;
666     }
667
668     /// RegisterTargetMachine - Register a TargetMachine implementation for the
669     /// given target.
670     ///
671     /// Clients are responsible for ensuring that registration doesn't occur
672     /// while another thread is attempting to access the registry. Typically
673     /// this is done by initializing all targets at program startup.
674     ///
675     /// @param T - The target being registered.
676     /// @param Fn - A function to construct a TargetMachine for the target.
677     static void RegisterTargetMachine(Target &T,
678                                       Target::TargetMachineCtorTy Fn) {
679       T.TargetMachineCtorFn = Fn;
680     }
681
682     /// RegisterMCAsmBackend - Register a MCAsmBackend implementation for the
683     /// given target.
684     ///
685     /// Clients are responsible for ensuring that registration doesn't occur
686     /// while another thread is attempting to access the registry. Typically
687     /// this is done by initializing all targets at program startup.
688     ///
689     /// @param T - The target being registered.
690     /// @param Fn - A function to construct an AsmBackend for the target.
691     static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn) {
692       T.MCAsmBackendCtorFn = Fn;
693     }
694
695     /// RegisterMCAsmParser - Register a MCTargetAsmParser implementation for
696     /// the given target.
697     ///
698     /// Clients are responsible for ensuring that registration doesn't occur
699     /// while another thread is attempting to access the registry. Typically
700     /// this is done by initializing all targets at program startup.
701     ///
702     /// @param T - The target being registered.
703     /// @param Fn - A function to construct an MCTargetAsmParser for the target.
704     static void RegisterMCAsmParser(Target &T, Target::MCAsmParserCtorTy Fn) {
705       T.MCAsmParserCtorFn = Fn;
706     }
707
708     /// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
709     /// target.
710     ///
711     /// Clients are responsible for ensuring that registration doesn't occur
712     /// while another thread is attempting to access the registry. Typically
713     /// this is done by initializing all targets at program startup.
714     ///
715     /// @param T - The target being registered.
716     /// @param Fn - A function to construct an AsmPrinter for the target.
717     static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
718       T.AsmPrinterCtorFn = Fn;
719     }
720
721     /// RegisterMCDisassembler - Register a MCDisassembler implementation for
722     /// the given target.
723     ///
724     /// Clients are responsible for ensuring that registration doesn't occur
725     /// while another thread is attempting to access the registry. Typically
726     /// this is done by initializing all targets at program startup.
727     ///
728     /// @param T - The target being registered.
729     /// @param Fn - A function to construct an MCDisassembler for the target.
730     static void RegisterMCDisassembler(Target &T,
731                                        Target::MCDisassemblerCtorTy Fn) {
732       T.MCDisassemblerCtorFn = Fn;
733     }
734
735     /// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
736     /// given target.
737     ///
738     /// Clients are responsible for ensuring that registration doesn't occur
739     /// while another thread is attempting to access the registry. Typically
740     /// this is done by initializing all targets at program startup.
741     ///
742     /// @param T - The target being registered.
743     /// @param Fn - A function to construct an MCInstPrinter for the target.
744     static void RegisterMCInstPrinter(Target &T,
745                                       Target::MCInstPrinterCtorTy Fn) {
746       T.MCInstPrinterCtorFn = Fn;
747     }
748
749     /// RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the
750     /// given target.
751     ///
752     /// Clients are responsible for ensuring that registration doesn't occur
753     /// while another thread is attempting to access the registry. Typically
754     /// this is done by initializing all targets at program startup.
755     ///
756     /// @param T - The target being registered.
757     /// @param Fn - A function to construct an MCCodeEmitter for the target.
758     static void RegisterMCCodeEmitter(Target &T,
759                                       Target::MCCodeEmitterCtorTy Fn) {
760       T.MCCodeEmitterCtorFn = Fn;
761     }
762
763     /// RegisterMCObjectStreamer - Register a object code MCStreamer
764     /// implementation for the given target.
765     ///
766     /// Clients are responsible for ensuring that registration doesn't occur
767     /// while another thread is attempting to access the registry. Typically
768     /// this is done by initializing all targets at program startup.
769     ///
770     /// @param T - The target being registered.
771     /// @param Fn - A function to construct an MCStreamer for the target.
772     static void RegisterMCObjectStreamer(Target &T,
773                                          Target::MCObjectStreamerCtorTy Fn) {
774       T.MCObjectStreamerCtorFn = Fn;
775     }
776
777     static void
778     RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn) {
779       T.NullTargetStreamerCtorFn = Fn;
780     }
781
782     static void RegisterAsmTargetStreamer(Target &T,
783                                           Target::AsmTargetStreamerCtorTy Fn) {
784       T.AsmTargetStreamerCtorFn = Fn;
785     }
786
787     /// RegisterMCRelocationInfo - Register an MCRelocationInfo
788     /// implementation for the given target.
789     ///
790     /// Clients are responsible for ensuring that registration doesn't occur
791     /// while another thread is attempting to access the registry. Typically
792     /// this is done by initializing all targets at program startup.
793     ///
794     /// @param T - The target being registered.
795     /// @param Fn - A function to construct an MCRelocationInfo for the target.
796     static void RegisterMCRelocationInfo(Target &T,
797                                          Target::MCRelocationInfoCtorTy Fn) {
798       T.MCRelocationInfoCtorFn = Fn;
799     }
800
801     /// RegisterMCSymbolizer - Register an MCSymbolizer
802     /// implementation for the given target.
803     ///
804     /// Clients are responsible for ensuring that registration doesn't occur
805     /// while another thread is attempting to access the registry. Typically
806     /// this is done by initializing all targets at program startup.
807     ///
808     /// @param T - The target being registered.
809     /// @param Fn - A function to construct an MCSymbolizer for the target.
810     static void RegisterMCSymbolizer(Target &T,
811                                      Target::MCSymbolizerCtorTy Fn) {
812       T.MCSymbolizerCtorFn = Fn;
813     }
814
815     /// @}
816   };
817
818
819   //===--------------------------------------------------------------------===//
820
821   /// RegisterTarget - Helper template for registering a target, for use in the
822   /// target's initialization function. Usage:
823   ///
824   ///
825   /// Target TheFooTarget; // The global target instance.
826   ///
827   /// extern "C" void LLVMInitializeFooTargetInfo() {
828   ///   RegisterTarget<Triple::foo> X(TheFooTarget, "foo", "Foo description");
829   /// }
830   template<Triple::ArchType TargetArchType = Triple::UnknownArch,
831            bool HasJIT = false>
832   struct RegisterTarget {
833     RegisterTarget(Target &T, const char *Name, const char *Desc) {
834       TargetRegistry::RegisterTarget(T, Name, Desc, &getArchMatch, HasJIT);
835     }
836
837     static bool getArchMatch(Triple::ArchType Arch) {
838       return Arch == TargetArchType;
839     }
840   };
841
842   /// RegisterMCAsmInfo - Helper template for registering a target assembly info
843   /// implementation.  This invokes the static "Create" method on the class to
844   /// actually do the construction.  Usage:
845   ///
846   /// extern "C" void LLVMInitializeFooTarget() {
847   ///   extern Target TheFooTarget;
848   ///   RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
849   /// }
850   template<class MCAsmInfoImpl>
851   struct RegisterMCAsmInfo {
852     RegisterMCAsmInfo(Target &T) {
853       TargetRegistry::RegisterMCAsmInfo(T, &Allocator);
854     }
855   private:
856     static MCAsmInfo *Allocator(const MCRegisterInfo &/*MRI*/, StringRef TT) {
857       return new MCAsmInfoImpl(TT);
858     }
859
860   };
861
862   /// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
863   /// implementation.  This invokes the specified function to do the
864   /// construction.  Usage:
865   ///
866   /// extern "C" void LLVMInitializeFooTarget() {
867   ///   extern Target TheFooTarget;
868   ///   RegisterMCAsmInfoFn X(TheFooTarget, TheFunction);
869   /// }
870   struct RegisterMCAsmInfoFn {
871     RegisterMCAsmInfoFn(Target &T, Target::MCAsmInfoCtorFnTy Fn) {
872       TargetRegistry::RegisterMCAsmInfo(T, Fn);
873     }
874   };
875
876   /// RegisterMCCodeGenInfo - Helper template for registering a target codegen info
877   /// implementation.  This invokes the static "Create" method on the class
878   /// to actually do the construction.  Usage:
879   ///
880   /// extern "C" void LLVMInitializeFooTarget() {
881   ///   extern Target TheFooTarget;
882   ///   RegisterMCCodeGenInfo<FooMCCodeGenInfo> X(TheFooTarget);
883   /// }
884   template<class MCCodeGenInfoImpl>
885   struct RegisterMCCodeGenInfo {
886     RegisterMCCodeGenInfo(Target &T) {
887       TargetRegistry::RegisterMCCodeGenInfo(T, &Allocator);
888     }
889   private:
890     static MCCodeGenInfo *Allocator(StringRef /*TT*/, Reloc::Model /*RM*/,
891                                     CodeModel::Model /*CM*/,
892                                     CodeGenOpt::Level /*OL*/) {
893       return new MCCodeGenInfoImpl();
894     }
895   };
896
897   /// RegisterMCCodeGenInfoFn - Helper template for registering a target codegen
898   /// info implementation.  This invokes the specified function to do the
899   /// construction.  Usage:
900   ///
901   /// extern "C" void LLVMInitializeFooTarget() {
902   ///   extern Target TheFooTarget;
903   ///   RegisterMCCodeGenInfoFn X(TheFooTarget, TheFunction);
904   /// }
905   struct RegisterMCCodeGenInfoFn {
906     RegisterMCCodeGenInfoFn(Target &T, Target::MCCodeGenInfoCtorFnTy Fn) {
907       TargetRegistry::RegisterMCCodeGenInfo(T, Fn);
908     }
909   };
910
911   /// RegisterMCInstrInfo - Helper template for registering a target instruction
912   /// info implementation.  This invokes the static "Create" method on the class
913   /// to actually do the construction.  Usage:
914   ///
915   /// extern "C" void LLVMInitializeFooTarget() {
916   ///   extern Target TheFooTarget;
917   ///   RegisterMCInstrInfo<FooMCInstrInfo> X(TheFooTarget);
918   /// }
919   template<class MCInstrInfoImpl>
920   struct RegisterMCInstrInfo {
921     RegisterMCInstrInfo(Target &T) {
922       TargetRegistry::RegisterMCInstrInfo(T, &Allocator);
923     }
924   private:
925     static MCInstrInfo *Allocator() {
926       return new MCInstrInfoImpl();
927     }
928   };
929
930   /// RegisterMCInstrInfoFn - Helper template for registering a target
931   /// instruction info implementation.  This invokes the specified function to
932   /// do the construction.  Usage:
933   ///
934   /// extern "C" void LLVMInitializeFooTarget() {
935   ///   extern Target TheFooTarget;
936   ///   RegisterMCInstrInfoFn X(TheFooTarget, TheFunction);
937   /// }
938   struct RegisterMCInstrInfoFn {
939     RegisterMCInstrInfoFn(Target &T, Target::MCInstrInfoCtorFnTy Fn) {
940       TargetRegistry::RegisterMCInstrInfo(T, Fn);
941     }
942   };
943
944   /// RegisterMCInstrAnalysis - Helper template for registering a target
945   /// instruction analyzer implementation.  This invokes the static "Create"
946   /// method on the class to actually do the construction.  Usage:
947   ///
948   /// extern "C" void LLVMInitializeFooTarget() {
949   ///   extern Target TheFooTarget;
950   ///   RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
951   /// }
952   template<class MCInstrAnalysisImpl>
953   struct RegisterMCInstrAnalysis {
954     RegisterMCInstrAnalysis(Target &T) {
955       TargetRegistry::RegisterMCInstrAnalysis(T, &Allocator);
956     }
957   private:
958     static MCInstrAnalysis *Allocator(const MCInstrInfo *Info) {
959       return new MCInstrAnalysisImpl(Info);
960     }
961   };
962
963   /// RegisterMCInstrAnalysisFn - Helper template for registering a target
964   /// instruction analyzer implementation.  This invokes the specified function
965   /// to do the construction.  Usage:
966   ///
967   /// extern "C" void LLVMInitializeFooTarget() {
968   ///   extern Target TheFooTarget;
969   ///   RegisterMCInstrAnalysisFn X(TheFooTarget, TheFunction);
970   /// }
971   struct RegisterMCInstrAnalysisFn {
972     RegisterMCInstrAnalysisFn(Target &T, Target::MCInstrAnalysisCtorFnTy Fn) {
973       TargetRegistry::RegisterMCInstrAnalysis(T, Fn);
974     }
975   };
976
977   /// RegisterMCRegInfo - Helper template for registering a target register info
978   /// implementation.  This invokes the static "Create" method on the class to
979   /// actually do the construction.  Usage:
980   ///
981   /// extern "C" void LLVMInitializeFooTarget() {
982   ///   extern Target TheFooTarget;
983   ///   RegisterMCRegInfo<FooMCRegInfo> X(TheFooTarget);
984   /// }
985   template<class MCRegisterInfoImpl>
986   struct RegisterMCRegInfo {
987     RegisterMCRegInfo(Target &T) {
988       TargetRegistry::RegisterMCRegInfo(T, &Allocator);
989     }
990   private:
991     static MCRegisterInfo *Allocator(StringRef /*TT*/) {
992       return new MCRegisterInfoImpl();
993     }
994   };
995
996   /// RegisterMCRegInfoFn - Helper template for registering a target register
997   /// info implementation.  This invokes the specified function to do the
998   /// construction.  Usage:
999   ///
1000   /// extern "C" void LLVMInitializeFooTarget() {
1001   ///   extern Target TheFooTarget;
1002   ///   RegisterMCRegInfoFn X(TheFooTarget, TheFunction);
1003   /// }
1004   struct RegisterMCRegInfoFn {
1005     RegisterMCRegInfoFn(Target &T, Target::MCRegInfoCtorFnTy Fn) {
1006       TargetRegistry::RegisterMCRegInfo(T, Fn);
1007     }
1008   };
1009
1010   /// RegisterMCSubtargetInfo - Helper template for registering a target
1011   /// subtarget info implementation.  This invokes the static "Create" method
1012   /// on the class to actually do the construction.  Usage:
1013   ///
1014   /// extern "C" void LLVMInitializeFooTarget() {
1015   ///   extern Target TheFooTarget;
1016   ///   RegisterMCSubtargetInfo<FooMCSubtargetInfo> X(TheFooTarget);
1017   /// }
1018   template<class MCSubtargetInfoImpl>
1019   struct RegisterMCSubtargetInfo {
1020     RegisterMCSubtargetInfo(Target &T) {
1021       TargetRegistry::RegisterMCSubtargetInfo(T, &Allocator);
1022     }
1023   private:
1024     static MCSubtargetInfo *Allocator(StringRef /*TT*/, StringRef /*CPU*/,
1025                                       StringRef /*FS*/) {
1026       return new MCSubtargetInfoImpl();
1027     }
1028   };
1029
1030   /// RegisterMCSubtargetInfoFn - Helper template for registering a target
1031   /// subtarget info implementation.  This invokes the specified function to
1032   /// do the construction.  Usage:
1033   ///
1034   /// extern "C" void LLVMInitializeFooTarget() {
1035   ///   extern Target TheFooTarget;
1036   ///   RegisterMCSubtargetInfoFn X(TheFooTarget, TheFunction);
1037   /// }
1038   struct RegisterMCSubtargetInfoFn {
1039     RegisterMCSubtargetInfoFn(Target &T, Target::MCSubtargetInfoCtorFnTy Fn) {
1040       TargetRegistry::RegisterMCSubtargetInfo(T, Fn);
1041     }
1042   };
1043
1044   /// RegisterTargetMachine - Helper template for registering a target machine
1045   /// implementation, for use in the target machine initialization
1046   /// function. Usage:
1047   ///
1048   /// extern "C" void LLVMInitializeFooTarget() {
1049   ///   extern Target TheFooTarget;
1050   ///   RegisterTargetMachine<FooTargetMachine> X(TheFooTarget);
1051   /// }
1052   template<class TargetMachineImpl>
1053   struct RegisterTargetMachine {
1054     RegisterTargetMachine(Target &T) {
1055       TargetRegistry::RegisterTargetMachine(T, &Allocator);
1056     }
1057
1058   private:
1059     static TargetMachine *Allocator(const Target &T, StringRef TT,
1060                                     StringRef CPU, StringRef FS,
1061                                     const TargetOptions &Options,
1062                                     Reloc::Model RM,
1063                                     CodeModel::Model CM,
1064                                     CodeGenOpt::Level OL) {
1065       return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL);
1066     }
1067   };
1068
1069   /// RegisterMCAsmBackend - Helper template for registering a target specific
1070   /// assembler backend. Usage:
1071   ///
1072   /// extern "C" void LLVMInitializeFooMCAsmBackend() {
1073   ///   extern Target TheFooTarget;
1074   ///   RegisterMCAsmBackend<FooAsmLexer> X(TheFooTarget);
1075   /// }
1076   template<class MCAsmBackendImpl>
1077   struct RegisterMCAsmBackend {
1078     RegisterMCAsmBackend(Target &T) {
1079       TargetRegistry::RegisterMCAsmBackend(T, &Allocator);
1080     }
1081
1082   private:
1083     static MCAsmBackend *Allocator(const Target &T,
1084                                    const MCRegisterInfo &MRI,
1085                                    StringRef Triple, StringRef CPU) {
1086       return new MCAsmBackendImpl(T, MRI, Triple, CPU);
1087     }
1088   };
1089
1090   /// RegisterMCAsmParser - Helper template for registering a target specific
1091   /// assembly parser, for use in the target machine initialization
1092   /// function. Usage:
1093   ///
1094   /// extern "C" void LLVMInitializeFooMCAsmParser() {
1095   ///   extern Target TheFooTarget;
1096   ///   RegisterMCAsmParser<FooAsmParser> X(TheFooTarget);
1097   /// }
1098   template<class MCAsmParserImpl>
1099   struct RegisterMCAsmParser {
1100     RegisterMCAsmParser(Target &T) {
1101       TargetRegistry::RegisterMCAsmParser(T, &Allocator);
1102     }
1103
1104   private:
1105     static MCTargetAsmParser *Allocator(MCSubtargetInfo &STI, MCAsmParser &P,
1106                                         const MCInstrInfo &MII,
1107                                         const MCTargetOptions &Options) {
1108       return new MCAsmParserImpl(STI, P, MII, Options);
1109     }
1110   };
1111
1112   /// RegisterAsmPrinter - Helper template for registering a target specific
1113   /// assembly printer, for use in the target machine initialization
1114   /// function. Usage:
1115   ///
1116   /// extern "C" void LLVMInitializeFooAsmPrinter() {
1117   ///   extern Target TheFooTarget;
1118   ///   RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
1119   /// }
1120   template<class AsmPrinterImpl>
1121   struct RegisterAsmPrinter {
1122     RegisterAsmPrinter(Target &T) {
1123       TargetRegistry::RegisterAsmPrinter(T, &Allocator);
1124     }
1125
1126   private:
1127     static AsmPrinter *Allocator(TargetMachine &TM,
1128                                  std::unique_ptr<MCStreamer> &&Streamer) {
1129       return new AsmPrinterImpl(TM, std::move(Streamer));
1130     }
1131   };
1132
1133   /// RegisterMCCodeEmitter - Helper template for registering a target specific
1134   /// machine code emitter, for use in the target initialization
1135   /// function. Usage:
1136   ///
1137   /// extern "C" void LLVMInitializeFooMCCodeEmitter() {
1138   ///   extern Target TheFooTarget;
1139   ///   RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
1140   /// }
1141   template<class MCCodeEmitterImpl>
1142   struct RegisterMCCodeEmitter {
1143     RegisterMCCodeEmitter(Target &T) {
1144       TargetRegistry::RegisterMCCodeEmitter(T, &Allocator);
1145     }
1146
1147   private:
1148     static MCCodeEmitter *Allocator(const MCInstrInfo & /*II*/,
1149                                     const MCRegisterInfo & /*MRI*/,
1150                                     MCContext & /*Ctx*/) {
1151       return new MCCodeEmitterImpl();
1152     }
1153   };
1154
1155 }
1156
1157 #endif