[llvm-commits] [llvm] r62312 - in /llvm/trunk: include/llvm/Support/Registry.h include/llvm/Support/RegistryParser.h include/llvm/Target/TargetMachineRegistry.h lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp lib/CodeGen/OcamlGC.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/ShadowStackGC.cpp lib/ExecutionEngine/JIT/TargetSelect.cpp tools/llc/llc.cpp

Mikhail Glushenkov foldr at codedgers.com
Thu Jan 15 23:02:28 PST 2009


Author: foldr
Date: Fri Jan 16 01:02:28 2009
New Revision: 62312

URL: http://llvm.org/viewvc/llvm-project?rev=62312&view=rev
Log:
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.

Added:
    llvm/trunk/include/llvm/Support/RegistryParser.h
Modified:
    llvm/trunk/include/llvm/Support/Registry.h
    llvm/trunk/include/llvm/Target/TargetMachineRegistry.h
    llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
    llvm/trunk/lib/CodeGen/OcamlGC.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
    llvm/trunk/lib/CodeGen/ShadowStackGC.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp
    llvm/trunk/tools/llc/llc.cpp

Modified: llvm/trunk/include/llvm/Support/Registry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Registry.h?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Registry.h (original)
+++ llvm/trunk/include/llvm/Support/Registry.h Fri Jan 16 01:02:28 2009
@@ -14,8 +14,6 @@
 #ifndef LLVM_SUPPORT_REGISTRY_H
 #define LLVM_SUPPORT_REGISTRY_H
 
-#include "llvm/Support/CommandLine.h"
-
 namespace llvm {
   /// A simple registry entry which provides only a name, description, and
   /// no-argument constructor.
@@ -204,33 +202,7 @@
         : Entry(Name, Desc, CtorFn), Node(Entry) {}
     };
 
-
-    /// A command-line parser for a registry. Use like such:
-    ///
-    ///   static cl::opt<Registry<Collector>::entry, false,
-    ///                  Registry<Collector>::Parser>
-    ///   GCOpt("gc", cl::desc("Garbage collector to use."),
-    ///               cl::value_desc());
-    ///
-    /// To make use of the value:
-    ///
-    ///   Collector *TheCollector = GCOpt->instantiate();
-    ///
-    class Parser : public cl::parser<const typename U::entry*>, public listener{
-      typedef U traits;
-      typedef typename U::entry entry;
-
-    protected:
-      void registered(const entry &E) {
-        addLiteralOption(traits::nameof(E), &E, traits::descof(E));
-      }
-
-    public:
-      void initialize(cl::Option &O) {
-        listener::init();
-        cl::parser<const typename U::entry*>::initialize(O);
-      }
-    };
+    /// Registry::Parser now lives in llvm/Support/RegistryParser.h.
 
   };
 

Added: llvm/trunk/include/llvm/Support/RegistryParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/RegistryParser.h?rev=62312&view=auto

==============================================================================
--- llvm/trunk/include/llvm/Support/RegistryParser.h (added)
+++ llvm/trunk/include/llvm/Support/RegistryParser.h Fri Jan 16 01:02:28 2009
@@ -0,0 +1,55 @@
+//=== RegistryParser.h - Linker-supported plugin registries -----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines a command-line parser for a registry.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_REGISTRY_PARSER_H
+#define LLVM_SUPPORT_REGISTRY_PARSER_H
+
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Registry.h"
+
+namespace llvm {
+
+  /// A command-line parser for a registry. Use like such:
+  ///
+  ///   static cl::opt<Registry<Collector>::entry, false,
+  ///                  RegistryParser<Collector> >
+  ///   GCOpt("gc", cl::desc("Garbage collector to use."),
+  ///               cl::value_desc());
+  ///
+  /// To make use of the value:
+  ///
+  ///   Collector *TheCollector = GCOpt->instantiate();
+  ///
+  template <typename T, typename U = RegistryTraits<T> >
+  class RegistryParser :
+  public cl::parser<const typename U::entry*>,
+    public Registry<T, U>::listener {
+    typedef U traits;
+    typedef typename U::entry entry;
+    typedef typename Registry<T, U>::listener listener;
+
+  protected:
+    void registered(const entry &E) {
+      addLiteralOption(traits::nameof(E), &E, traits::descof(E));
+    }
+
+  public:
+    void initialize(cl::Option &O) {
+      listener::init();
+      cl::parser<const typename U::entry*>::initialize(O);
+    }
+  };
+
+}
+
+#endif // LLVM_SUPPORT_REGISTRY_PARSER_H

Modified: llvm/trunk/include/llvm/Target/TargetMachineRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachineRegistry.h?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachineRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachineRegistry.h Fri Jan 16 01:02:28 2009
@@ -17,6 +17,7 @@
 #ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H
 #define LLVM_TARGET_TARGETMACHINEREGISTRY_H
 
+#include "llvm/Module.h"
 #include "llvm/Support/Registry.h"
 
 namespace llvm {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp Fri Jan 16 01:02:28 2009
@@ -15,6 +15,7 @@
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/GCMetadataPrinter.h"
 #include "llvm/Module.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetData.h"

Modified: llvm/trunk/lib/CodeGen/OcamlGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/OcamlGC.cpp?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/OcamlGC.cpp (original)
+++ llvm/trunk/lib/CodeGen/OcamlGC.cpp Fri Jan 16 01:02:28 2009
@@ -16,6 +16,7 @@
 
 #include "llvm/CodeGen/GCs.h"
 #include "llvm/CodeGen/GCStrategy.h"
+#include "llvm/Support/Compiler.h"
 
 using namespace llvm;
 

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri Jan 16 01:02:28 2009
@@ -47,6 +47,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"

Modified: llvm/trunk/lib/CodeGen/ShadowStackGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGC.cpp?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original)
+++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Fri Jan 16 01:02:28 2009
@@ -31,6 +31,7 @@
 #include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/IntrinsicInst.h"
 #include "llvm/Module.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/IRBuilder.h"
 
 using namespace llvm;

Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Fri Jan 16 01:02:28 2009
@@ -15,6 +15,7 @@
 #include "JIT.h"
 #include "llvm/Module.h"
 #include "llvm/ModuleProvider.h"
+#include "llvm/Support/RegistryParser.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Target/SubtargetFeature.h"
 #include "llvm/Target/TargetMachine.h"
@@ -22,7 +23,7 @@
 using namespace llvm;
 
 static cl::opt<const TargetMachineRegistry::entry*, false,
-               TargetMachineRegistry::Parser>
+               RegistryParser<TargetMachine> >
 MArch("march", cl::desc("Architecture to generate assembly for:"));
 
 static cl::opt<std::string>

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=62312&r1=62311&r2=62312&view=diff

==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Fri Jan 16 01:02:28 2009
@@ -27,10 +27,11 @@
 #include "llvm/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PluginLoader.h"
-#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/RegistryParser.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/System/Signals.h"
@@ -60,7 +61,7 @@
 TargetTriple("mtriple", cl::desc("Override target triple for module"));
 
 static cl::opt<const TargetMachineRegistry::entry*, false,
-               TargetMachineRegistry::Parser>
+               RegistryParser<TargetMachine> >
 MArch("march", cl::desc("Architecture to generate code for:"));
 
 static cl::opt<std::string>





More information about the llvm-commits mailing list