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