llvm.org GIT mirror llvm / 2388a58
Registry.h should not depend on CommandLine.h. Split Support/Registry.h into two files so that we have less to recompile every time CommandLine.h is changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62312 91177308-0d34-0410-b5e6-96231b3b80d8 Mikhail Glushenkov 11 years ago
9 changed file(s) with 66 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
1212
1313 #ifndef LLVM_SUPPORT_REGISTRY_H
1414 #define LLVM_SUPPORT_REGISTRY_H
15
16 #include "llvm/Support/CommandLine.h"
1715
1816 namespace llvm {
1917 /// A simple registry entry which provides only a name, description, and
203201 : Entry(Name, Desc, CtorFn), Node(Entry) {}
204202 };
205203
206
207 /// A command-line parser for a registry. Use like such:
208 ///
209 /// static cl::opt::entry, false,
210 /// Registry::Parser>
211 /// GCOpt("gc", cl::desc("Garbage collector to use."),
212 /// cl::value_desc());
213 ///
214 /// To make use of the value:
215 ///
216 /// Collector *TheCollector = GCOpt->instantiate();
217 ///
218 class Parser : public cl::parser, public listener{
219 typedef U traits;
220 typedef typename U::entry entry;
221
222 protected:
223 void registered(const entry &E) {
224 addLiteralOption(traits::nameof(E), &E, traits::descof(E));
225 }
226
227 public:
228 void initialize(cl::Option &O) {
229 listener::init();
230 cl::parser::initialize(O);
231 }
232 };
204 /// Registry::Parser now lives in llvm/Support/RegistryParser.h.
233205
234206 };
235207
0 //=== RegistryParser.h - Linker-supported plugin registries -----*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Defines a command-line parser for a registry.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_SUPPORT_REGISTRY_PARSER_H
14 #define LLVM_SUPPORT_REGISTRY_PARSER_H
15
16 #include "llvm/Support/CommandLine.h"
17 #include "llvm/Support/Registry.h"
18
19 namespace llvm {
20
21 /// A command-line parser for a registry. Use like such:
22 ///
23 /// static cl::opt::entry, false,
24 /// RegistryParser >
25 /// GCOpt("gc", cl::desc("Garbage collector to use."),
26 /// cl::value_desc());
27 ///
28 /// To make use of the value:
29 ///
30 /// Collector *TheCollector = GCOpt->instantiate();
31 ///
32 template >
33 class RegistryParser :
34 public cl::parser,
35 public Registry::listener {
36 typedef U traits;
37 typedef typename U::entry entry;
38 typedef typename Registry::listener listener;
39
40 protected:
41 void registered(const entry &E) {
42 addLiteralOption(traits::nameof(E), &E, traits::descof(E));
43 }
44
45 public:
46 void initialize(cl::Option &O) {
47 listener::init();
48 cl::parser::initialize(O);
49 }
50 };
51
52 }
53
54 #endif // LLVM_SUPPORT_REGISTRY_PARSER_H
1616 #ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H
1717 #define LLVM_TARGET_TARGETMACHINEREGISTRY_H
1818
19 #include "llvm/Module.h"
1920 #include "llvm/Support/Registry.h"
2021
2122 namespace llvm {
1414 #include "llvm/CodeGen/AsmPrinter.h"
1515 #include "llvm/CodeGen/GCMetadataPrinter.h"
1616 #include "llvm/Module.h"
17 #include "llvm/Support/Compiler.h"
1718 #include "llvm/Support/raw_ostream.h"
1819 #include "llvm/Target/TargetAsmInfo.h"
1920 #include "llvm/Target/TargetData.h"
1515
1616 #include "llvm/CodeGen/GCs.h"
1717 #include "llvm/CodeGen/GCStrategy.h"
18 #include "llvm/Support/Compiler.h"
1819
1920 using namespace llvm;
2021
4646 #include "llvm/Target/TargetMachine.h"
4747 #include "llvm/Target/TargetOptions.h"
4848 #include "llvm/Support/Compiler.h"
49 #include "llvm/Support/CommandLine.h"
4950 #include "llvm/Support/Debug.h"
5051 #include "llvm/Support/MathExtras.h"
5152 #include "llvm/Support/raw_ostream.h"
3030 #include "llvm/CodeGen/GCStrategy.h"
3131 #include "llvm/IntrinsicInst.h"
3232 #include "llvm/Module.h"
33 #include "llvm/Support/Compiler.h"
3334 #include "llvm/Support/IRBuilder.h"
3435
3536 using namespace llvm;
1414 #include "JIT.h"
1515 #include "llvm/Module.h"
1616 #include "llvm/ModuleProvider.h"
17 #include "llvm/Support/RegistryParser.h"
1718 #include "llvm/Support/Streams.h"
1819 #include "llvm/Target/SubtargetFeature.h"
1920 #include "llvm/Target/TargetMachine.h"
2122 using namespace llvm;
2223
2324 static cl::opt
24 TargetMachineRegistry::Parser>
25 RegistryParser >
2526 MArch("march", cl::desc("Architecture to generate assembly for:"));
2627
2728 static cl::opt
2626 #include "llvm/PassManager.h"
2727 #include "llvm/Pass.h"
2828 #include "llvm/Support/CommandLine.h"
29 #include "llvm/Support/FileUtilities.h"
2930 #include "llvm/Support/ManagedStatic.h"
3031 #include "llvm/Support/MemoryBuffer.h"
3132 #include "llvm/Support/PluginLoader.h"
32 #include "llvm/Support/FileUtilities.h"
33 #include "llvm/Support/RegistryParser.h"
3334 #include "llvm/Support/raw_ostream.h"
3435 #include "llvm/Analysis/Verifier.h"
3536 #include "llvm/System/Signals.h"
5960 TargetTriple("mtriple", cl::desc("Override target triple for module"));
6061
6162 static cl::opt
62 TargetMachineRegistry::Parser>
63 RegistryParser >
6364 MArch("march", cl::desc("Architecture to generate code for:"));
6465
6566 static cl::opt