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