[llvm-commits] [llvm] r111094 - in /llvm/trunk: ./ autoconf/ include/llvm/CompilerDriver/ lib/CompilerDriver/ tools/llvmc/ tools/llvmc/driver/ tools/llvmc/plugins/ tools/llvmc/plugins/Base/ tools/llvmc/plugins/Clang/ tools/llvmc/src/ utils/TableGen/

Mikhail Glushenkov foldr at codedgers.com
Sun Aug 15 00:07:13 PDT 2010


Author: foldr
Date: Sun Aug 15 02:07:12 2010
New Revision: 111094

URL: http://llvm.org/viewvc/llvm-project?rev=111094&view=rev
Log:
llvmc: remove dynamic plugins.

Added:
    llvm/trunk/include/llvm/CompilerDriver/AutoGenerated.h
    llvm/trunk/include/llvm/CompilerDriver/Main.h
      - copied, changed from r111083, llvm/trunk/tools/llvmc/driver/Main.cpp
    llvm/trunk/tools/llvmc/src/
    llvm/trunk/tools/llvmc/src/AutoGenerated.td
      - copied, changed from r111083, llvm/trunk/tools/llvmc/driver/Main.cpp
    llvm/trunk/tools/llvmc/src/Base.td.in
      - copied, changed from r111083, llvm/trunk/tools/llvmc/plugins/Base/Base.td.in
    llvm/trunk/tools/llvmc/src/Clang.td
      - copied, changed from r111083, llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
    llvm/trunk/tools/llvmc/src/Hooks.cpp
      - copied, changed from r111083, llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp
    llvm/trunk/tools/llvmc/src/Main.cpp
      - copied, changed from r111083, llvm/trunk/tools/llvmc/driver/Main.cpp
    llvm/trunk/tools/llvmc/src/Makefile
      - copied, changed from r111083, llvm/trunk/tools/llvmc/driver/Makefile
Removed:
    llvm/trunk/include/llvm/CompilerDriver/ForceLinkage.h
    llvm/trunk/include/llvm/CompilerDriver/ForceLinkageMacros.h
    llvm/trunk/include/llvm/CompilerDriver/Plugin.h
    llvm/trunk/lib/CompilerDriver/Plugin.cpp
    llvm/trunk/tools/llvmc/driver/Main.cpp
    llvm/trunk/tools/llvmc/driver/Makefile
    llvm/trunk/tools/llvmc/plugins/Base/Base.td.in
    llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp
    llvm/trunk/tools/llvmc/plugins/Base/Makefile
    llvm/trunk/tools/llvmc/plugins/Base/PluginMain.cpp
    llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
    llvm/trunk/tools/llvmc/plugins/Clang/Makefile
    llvm/trunk/tools/llvmc/plugins/Clang/PluginMain.cpp
    llvm/trunk/tools/llvmc/plugins/Makefile
Modified:
    llvm/trunk/Makefile
    llvm/trunk/Makefile.rules
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/include/llvm/CompilerDriver/Common.td
    llvm/trunk/include/llvm/CompilerDriver/Main.inc
    llvm/trunk/lib/CompilerDriver/Main.cpp
    llvm/trunk/lib/CompilerDriver/Makefile
    llvm/trunk/tools/llvmc/CMakeLists.txt
    llvm/trunk/tools/llvmc/Makefile
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp

Modified: llvm/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/Makefile (original)
+++ llvm/trunk/Makefile Sun Aug 15 02:07:12 2010
@@ -170,7 +170,7 @@
   include/llvm/Config/AsmParsers.def \
   include/llvm/Config/Disassemblers.def \
   include/llvm/System/DataTypes.h \
-  tools/llvmc/plugins/Base/Base.td
+  tools/llvmc/src/Base.td
 FilesToConfigPATH  := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
 
 all-local:: $(FilesToConfigPATH)

Modified: llvm/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Sun Aug 15 02:07:12 2010
@@ -196,57 +196,15 @@
 install-bytecode:: install-bytecode-local
 
 ###############################################################################
-# LLVMC: Provide rules for compiling llvmc plugins
+# LLVMC: Provide rules for compiling llvmc-based driver
 ###############################################################################
 
-ifdef LLVMC_PLUGIN
-
-LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN))
-CPP.Flags += -DLLVMC_PLUGIN_NAME=$(LLVMC_PLUGIN)
-
-ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
-  LD.Flags += -lCompilerDriver
-endif
-
-# Build a dynamic library if the user runs `make` directly from the plugin
-# directory.
-ifndef LLVMC_BUILTIN_PLUGIN
-  LOADABLE_MODULE = 1
-endif
-
-# TableGen stuff...
-ifneq ($(BUILT_SOURCES),)
-  LLVMC_BUILD_AUTOGENERATED_INC=1
-endif
-
-endif # LLVMC_PLUGIN
-
 ifdef LLVMC_BASED_DRIVER
 
 TOOLNAME = $(LLVMC_BASED_DRIVER)
 
-ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
-  LD.Flags += -lCompilerDriver
-else
-  LLVMLIBS = CompilerDriver.a
-  LINK_COMPONENTS = support system
-endif
-
-# Preprocessor magic that generates references to static variables in built-in
-# plugins.
-ifneq ($(LLVMC_BUILTIN_PLUGINS),)
-
-USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
-
-LLVMC_BUILTIN_PLUGINS.pre := \
-  $(patsubst %,-DLLVMC_BUILTIN_PLUGIN_%=, \
-    1 2 3 4 5 6 7 8 9 10)
-
-CPP.Flags += \
-  $(filter-out $(LLVMC_BUILTIN_PLUGINS.pre) $(LLVMC_BUILTIN_PLUGINS), \
-    $(join $(LLVMC_BUILTIN_PLUGINS.pre), $(LLVMC_BUILTIN_PLUGINS)))
-
-endif
+LLVMLIBS = CompilerDriver.a
+LINK_COMPONENTS = support system
 
 endif # LLVMC_BASED_DRIVER
 
@@ -1601,7 +1559,7 @@
 TABLEGEN_INC_FILES_COMMON = 1
 endif
 
-ifdef LLVMC_BUILD_AUTOGENERATED_INC
+ifdef LLVMC_BASED_DRIVER
 TABLEGEN_INC_FILES_COMMON = 1
 endif
 
@@ -1725,20 +1683,26 @@
 
 endif # TARGET
 
-ifdef LLVMC_BUILD_AUTOGENERATED_INC
+ifdef LLVMC_BASED_DRIVER
+
+TDSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \
+		$(strip $(wildcard $(PROJ_OBJ_DIR)/*.td)))
 
-LLVMCPluginSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \
-	$(strip $(wildcard $(PROJ_OBJ_DIR)/*.td)))
+TDCommon := $(strip $(wildcard \
+		$(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))
 
-TDFiles := $(LLVMCPluginSrc) \
-	$(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))
+TDFiles := $(TDSrc) $(TDCommon)
 
-$(ObjDir)/AutoGenerated.inc.tmp: $(LLVMCPluginSrc) $(ObjDir)/.dir \
-				$(TBLGEN) $(TD_COMMON)
-	$(Echo) "Building LLVMC configuration library with tblgen"
+$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
+
+$(ObjDir)/%.inc.tmp: %.td $(ObjDir)/.dir
+	$(Echo) "Building LLVMC compilation graph description with tblgen"
 	$(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $<
 
-endif # LLVMC_BUILD_AUTOGENERATED_INC
+clean-local::
+	-$(Verb) $(RM) -f $(INCFiles)
+
+endif # LLVMC_BASED_DRIVER
 
 ###############################################################################
 # OTHER RULES: Other rules needed

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Sun Aug 15 02:07:12 2010
@@ -858,35 +858,6 @@
   esac],
   llvm_cv_enable_libffi=no)
 
-dnl Only Windows needs dynamic libCompilerDriver to support plugins.
-if test "$llvm_cv_os_type" = "Win32" ; then
-   llvmc_dynamic="yes"
-else
-   llvmc_dynamic="no"
-fi
-
-dnl --enable-llvmc-dynamic : should LLVMC link libCompilerDriver dynamically?
-AC_ARG_ENABLE(llvmc-dynamic,AS_HELP_STRING(
---enable-llvmc-dynamic,
-[Link LLVMC dynamically (default is NO, unless on Win32)]),,
-enableval=$llvmc_dynamic)
-if test ${enableval} = "yes" && test "$ENABLE_PIC" -eq 1 ; then
-   AC_SUBST(ENABLE_LLVMC_DYNAMIC,[[ENABLE_LLVMC_DYNAMIC=1]])
-else
-   AC_SUBST(ENABLE_LLVMC_DYNAMIC,[[]])
-fi
-
-dnl --enable-llvmc-dynamic-plugins : should LLVMC support dynamic plugins?
-AC_ARG_ENABLE(llvmc-dynamic-plugins,AS_HELP_STRING(
---enable-llvmc-dynamic-plugins,
-[Enable dynamic LLVMC plugins (default is YES)]),,
-enableval=yes)
-if test ${enableval} = "yes" ; then
-   AC_SUBST(ENABLE_LLVMC_DYNAMIC_PLUGINS,[[ENABLE_LLVMC_DYNAMIC_PLUGINS=1]])
-else
-   AC_SUBST(ENABLE_LLVMC_DYNAMIC_PLUGINS,[[]])
-fi
-
 dnl===-----------------------------------------------------------------------===
 dnl===
 dnl=== SECTION 4: Check for programs we need and that they are the right version
@@ -1601,7 +1572,7 @@
 AC_CONFIG_FILES([llvm.spec])
 
 dnl Configure llvmc's Base plugin
-AC_CONFIG_FILES([tools/llvmc/plugins/Base/Base.td])
+AC_CONFIG_FILES([tools/llvmc/src/Base.td])
 
 dnl Do the first stage of configuration for llvm-config.in.
 AC_CONFIG_FILES([tools/llvm-config/llvm-config.in])

Added: llvm/trunk/include/llvm/CompilerDriver/AutoGenerated.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/AutoGenerated.h?rev=111094&view=auto
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/AutoGenerated.h (added)
+++ llvm/trunk/include/llvm/CompilerDriver/AutoGenerated.h Sun Aug 15 02:07:12 2010
@@ -0,0 +1,40 @@
+//===--- AutoGenerated.h - The LLVM Compiler Driver -------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open
+// Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Interface to the autogenerated driver code.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_INCLUDE_COMPILER_DRIVER_AUTOGENERATED_H
+#define LLVM_INCLUDE_COMPILER_DRIVER_AUTOGENERATED_H
+
+namespace llvmc {
+  class LanguageMap;
+  class CompilationGraph;
+
+  namespace autogenerated {
+
+    int PreprocessOptions();
+    int PopulateLanguageMap(LanguageMap& langMap);
+    int PopulateCompilationGraph(CompilationGraph& graph);
+
+    inline int RunInitialization (LanguageMap& M, CompilationGraph& G) {
+      if (int ret = PreprocessOptions())
+        return ret;
+      if (int ret = PopulateLanguageMap(M))
+        return ret;
+      if (int ret = PopulateCompilationGraph(G))
+        return ret;
+
+      return 0;
+    }
+  }
+}
+
+#endif // LLVM_INCLUDE_COMPILER_DRIVER_AUTOGENERATED_H

Modified: llvm/trunk/include/llvm/CompilerDriver/Common.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Common.td?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Common.td (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Common.td Sun Aug 15 02:07:12 2010
@@ -40,7 +40,6 @@
 
 // Possible option properties.
 
-def extern;
 def help;
 def hidden;
 def init;
@@ -101,11 +100,6 @@
 // Empty DAG marker.
 def empty_dag_marker;
 
-// Used to specify plugin priority.
-class PluginPriority<int p> {
-      int priority = p;
-}
-
 // Option list - a single place to specify options.
 class OptionList<list<dag> l> {
       list<dag> options = l;

Removed: llvm/trunk/include/llvm/CompilerDriver/ForceLinkage.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/ForceLinkage.h?rev=111093&view=auto
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/ForceLinkage.h (original)
+++ llvm/trunk/include/llvm/CompilerDriver/ForceLinkage.h (removed)
@@ -1,122 +0,0 @@
-//===--- ForceLinkage.h - The LLVM Compiler Driver --------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  A bit of preprocessor magic to force references to static libraries. Needed
-//  because plugin initialization is done via static variables.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_H
-#define LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_H
-
-#include "llvm/CompilerDriver/ForceLinkageMacros.h"
-
-namespace llvmc {
-
-// Declare all ForceLinkage$(PluginName) functions.
-
-#ifdef LLVMC_BUILTIN_PLUGIN_1
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_1);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_2
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_2);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_3
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_3);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_4
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_4);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_5
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_5);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_6
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_6);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_7
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_7);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_8
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_8);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_9
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_9);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_10
-      LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_10);
-#endif
-
-namespace force_linkage {
-
-  struct LinkageForcer {
-
-    LinkageForcer() {
-
-// Call all ForceLinkage$(PluginName) functions.
-#ifdef LLVMC_BUILTIN_PLUGIN_1
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_1);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_2
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_2);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_3
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_3);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_4
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_4);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_5
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_5);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_6
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_6);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_7
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_7);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_8
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_8);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_9
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_9);
-#endif
-
-#ifdef LLVMC_BUILTIN_PLUGIN_10
-      LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_10);
-#endif
-
-    }
-  };
-} // End namespace force_linkage.
-
-// The only externally used bit.
-void ForceLinkage() {
-  force_linkage::LinkageForcer dummy;
-}
-
-} // End namespace llvmc.
-
-#endif // LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_H

Removed: llvm/trunk/include/llvm/CompilerDriver/ForceLinkageMacros.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/ForceLinkageMacros.h?rev=111093&view=auto
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/ForceLinkageMacros.h (original)
+++ llvm/trunk/include/llvm/CompilerDriver/ForceLinkageMacros.h (removed)
@@ -1,29 +0,0 @@
-//===--- ForceLinkageMacros.h - The LLVM Compiler Driver --------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Preprocessor magic that forces references to static libraries - common
-//  macros used by both driver and plugins.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_MACROS_H
-#define LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_MACROS_H
-
-#define LLVMC_FORCE_LINKAGE_PREFIX(PluginName) ForceLinkage ## PluginName
-
-#define LLVMC_FORCE_LINKAGE_FUN(PluginName) \
-  LLVMC_FORCE_LINKAGE_PREFIX(PluginName)
-
-#define LLVMC_FORCE_LINKAGE_DECL(PluginName) \
-  void LLVMC_FORCE_LINKAGE_FUN(PluginName) ()
-
-#define LLVMC_FORCE_LINKAGE_CALL(PluginName) \
-  LLVMC_FORCE_LINKAGE_FUN(PluginName) ()
-
-#endif // LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_MACROS_H

Copied: llvm/trunk/include/llvm/CompilerDriver/Main.h (from r111083, llvm/trunk/tools/llvmc/driver/Main.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Main.h?p2=llvm/trunk/include/llvm/CompilerDriver/Main.h&p1=llvm/trunk/tools/llvmc/driver/Main.cpp&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/driver/Main.cpp (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Main.h Sun Aug 15 02:07:12 2010
@@ -1,4 +1,4 @@
-//===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
+//===--- Main.h - The LLVM Compiler Driver ----------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  Just include CompilerDriver/Main.inc.
+//  Entry point for the driver executable.
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CompilerDriver/Main.inc"
+#ifndef LLVM_INCLUDE_COMPILER_DRIVER_MAIN_H
+#define LLVM_INCLUDE_COMPILER_DRIVER_MAIN_H
+
+namespace llvmc {
+  int Main(int argc, char** argv);
+}
+
+#endif // LLVM_INCLUDE_COMPILER_DRIVER_MAIN_H

Modified: llvm/trunk/include/llvm/CompilerDriver/Main.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Main.inc?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Main.inc (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Main.inc Sun Aug 15 02:07:12 2010
@@ -7,26 +7,16 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This tool provides a single point of access to the LLVM
-//  compilation tools.  It has many options. To discover the options
-//  supported please refer to the tools' manual page or run the tool
-//  with the -help option.
-//
-//  This file provides the default entry point for the driver executable.
+//  Default main() for the driver executable.
 //
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC
 #define LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC
 
-#include "llvm/CompilerDriver/ForceLinkage.h"
-
-namespace llvmc {
-  int Main(int argc, char** argv);
-}
+#include "llvm/CompilerDriver/Main.h"
 
 int main(int argc, char** argv) {
-  llvmc::ForceLinkage();
   return llvmc::Main(argc, argv);
 }
 

Removed: llvm/trunk/include/llvm/CompilerDriver/Plugin.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Plugin.h?rev=111093&view=auto
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Plugin.h (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Plugin.h (removed)
@@ -1,81 +0,0 @@
-//===--- Plugin.h - The LLVM Compiler Driver --------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Plugin support for llvmc.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_INCLUDE_COMPILER_DRIVER_PLUGIN_H
-#define LLVM_INCLUDE_COMPILER_DRIVER_PLUGIN_H
-
-#include "llvm/Support/Registry.h"
-
-namespace llvmc {
-
-  class LanguageMap;
-  class CompilationGraph;
-
-  /// BasePlugin - An abstract base class for all LLVMC plugins.
-  struct BasePlugin {
-
-    /// Priority - Plugin priority, useful for handling dependencies
-    /// between plugins. Plugins with lower priorities are loaded
-    /// first.
-    virtual int Priority() const { return 0; }
-
-    /// PreprocessOptions - The auto-generated function that performs various
-    /// consistency checks on options (like ensuring that -O2 and -O3 are not
-    /// used together).
-    virtual int PreprocessOptions() const = 0;
-
-    /// PopulateLanguageMap - The auto-generated function that fills in
-    /// the language map (map from file extensions to language names).
-    virtual int PopulateLanguageMap(LanguageMap&) const = 0;
-
-    /// PopulateCompilationGraph - The auto-generated function that
-    /// populates the compilation graph with nodes and edges.
-    virtual int PopulateCompilationGraph(CompilationGraph&) const = 0;
-
-    /// Needed to avoid a compiler warning.
-    virtual ~BasePlugin() {}
-  };
-
-  typedef llvm::Registry<BasePlugin> PluginRegistry;
-
-  template <class P>
-  struct RegisterPlugin
-    : public PluginRegistry::Add<P> {
-    typedef PluginRegistry::Add<P> Base;
-
-    RegisterPlugin(const char* Name = "Nameless",
-                   const char* Desc = "Auto-generated plugin")
-      : Base(Name, Desc) {}
-  };
-
-
-  /// PluginLoader - Helper class used by the main program for
-  /// lifetime management.
-  struct PluginLoader {
-    PluginLoader();
-    ~PluginLoader();
-
-    /// RunInitialization - Calls PreprocessOptions, PopulateLanguageMap and
-    /// PopulateCompilationGraph methods of all plugins. This populates the
-    /// global language map and the compilation graph.
-    int RunInitialization(LanguageMap& langMap, CompilationGraph& graph) const;
-
-  private:
-    // noncopyable
-    PluginLoader(const PluginLoader& other);
-    const PluginLoader& operator=(const PluginLoader& other);
-  };
-
-}
-
-#endif // LLVM_INCLUDE_COMPILER_DRIVER_PLUGIN_H

Modified: llvm/trunk/lib/CompilerDriver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Main.cpp?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Main.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Main.cpp Sun Aug 15 02:07:12 2010
@@ -11,10 +11,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/CompilerDriver/AutoGenerated.h"
 #include "llvm/CompilerDriver/BuiltinOptions.h"
 #include "llvm/CompilerDriver/CompilationGraph.h"
 #include "llvm/CompilerDriver/Error.h"
-#include "llvm/CompilerDriver/Plugin.h"
 
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Path.h"
@@ -62,7 +62,8 @@
     return 0;
   }
 
-  /// BuildTargets - A small wrapper for CompilationGraph::Build. Returns non-zero value
+  /// BuildTargets - A small wrapper for CompilationGraph::Build. Returns
+  /// non-zero value in case of error.
   int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) {
     int ret;
     sys::Path tempDir;
@@ -87,7 +88,7 @@
   *GlobalTimeLog << "# " << cmd << ' ' << time << '\n';
 }
 
-// Sometimes plugins want to condition on the value in argv[0].
+// Sometimes user code wants to access the argv[0] value.
 const char* ProgramName;
 
 int Main(int argc, char** argv) {
@@ -98,11 +99,11 @@
   ProgramName = argv[0];
 
   cl::ParseCommandLineOptions
-    (argc, argv, "LLVM Compiler Driver (Work In Progress)",
+    (argc, argv,
+     /* Overview = */ "LLVM Compiler Driver (Work In Progress)",
      /* ReadResponseFiles = */ false);
 
-  PluginLoader Plugins;
-  if (int ret = Plugins.RunInitialization(langMap, graph))
+  if (int ret = autogenerated::RunInitialization(langMap, graph))
     return ret;
 
   if (CheckGraph) {

Modified: llvm/trunk/lib/CompilerDriver/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Makefile?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Makefile (original)
+++ llvm/trunk/lib/CompilerDriver/Makefile Sun Aug 15 02:07:12 2010
@@ -12,34 +12,7 @@
 # We don't want this library to appear in `llvm-config --libs` output, so its
 # name doesn't start with "LLVM".
 
-ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
-  LIBRARYNAME = libCompilerDriver
-  LLVMLIBS = LLVMSupport.a LLVMSystem.a
-  LOADABLE_MODULE := 1
-else
-  LIBRARYNAME = CompilerDriver
-  LINK_COMPONENTS = support system
-endif
+LIBRARYNAME = CompilerDriver
+LINK_COMPONENTS = support system
 
 include $(LEVEL)/Makefile.common
-
-ifeq ($(ENABLE_LLVMC_DYNAMIC_PLUGINS), 1)
-    CPP.Flags += -DENABLE_LLVMC_DYNAMIC_PLUGINS
-endif
-
-# Copy libCompilerDriver to the bin dir so that llvmc can find it.
-ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
-
-FullLibName = $(LIBRARYNAME)$(SHLIBEXT)
-
-all-local:: $(ToolDir)/$(FullLibName)
-
-$(ToolDir)/$(FullLibName): $(LibDir)/$(FullLibName) $(ToolDir)/.dir
-	$(Echo) Copying $(BuildMode) Shared Library $(FullLibName) to $@
-	-$(Verb) $(CP) $< $@
-
-clean-local::
-	$(Echo) Removing $(BuildMode) Shared Library $(FullLibName) \
-	from $(ToolDir)
-	-$(Verb) $(RM) -f $(ToolDir)/$(FullLibName)
-endif

Removed: llvm/trunk/lib/CompilerDriver/Plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Plugin.cpp?rev=111093&view=auto
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Plugin.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Plugin.cpp (removed)
@@ -1,83 +0,0 @@
-//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Plugin support.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/Plugin.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/System/Mutex.h"
-#include <algorithm>
-#include <vector>
-
-namespace {
-
-  // Registry::Add<> does not do lifetime management (probably issues
-  // with static constructor/destructor ordering), so we have to
-  // implement it here.
-  //
-  // All this static registration/life-before-main model seems
-  // unnecessary convoluted to me.
-
-  static bool pluginListInitialized = false;
-  typedef std::vector<const llvmc::BasePlugin*> PluginList;
-  static PluginList Plugins;
-  static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > PluginMutex;
-
-  struct ByPriority {
-    bool operator()(const llvmc::BasePlugin* lhs,
-                    const llvmc::BasePlugin* rhs) {
-      return lhs->Priority() < rhs->Priority();
-    }
-  };
-}
-
-namespace llvmc {
-
-  PluginLoader::PluginLoader() {
-    llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
-    if (!pluginListInitialized) {
-      for (PluginRegistry::iterator B = PluginRegistry::begin(),
-             E = PluginRegistry::end(); B != E; ++B)
-        Plugins.push_back(B->instantiate());
-      std::sort(Plugins.begin(), Plugins.end(), ByPriority());
-    }
-    pluginListInitialized = true;
-  }
-
-  PluginLoader::~PluginLoader() {
-    llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
-    if (pluginListInitialized) {
-      for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
-           B != E; ++B)
-        delete (*B);
-    }
-    pluginListInitialized = false;
-  }
-
-  int PluginLoader::RunInitialization(LanguageMap& langMap,
-                                      CompilationGraph& graph) const
-  {
-    llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
-    for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
-         B != E; ++B) {
-      const BasePlugin* BP = *B;
-      if (int ret = BP->PreprocessOptions())
-        return ret;
-      if (int ret = BP->PopulateLanguageMap(langMap))
-        return ret;
-      if (int ret = BP->PopulateCompilationGraph(graph))
-        return ret;
-    }
-
-    return 0;
-  }
-
-}

Modified: llvm/trunk/tools/llvmc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/CMakeLists.txt?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvmc/CMakeLists.txt Sun Aug 15 02:07:12 2010
@@ -1,4 +1,4 @@
-# add_subdirectory(driver)
+# add_subdirectory(src)
 
 # TODO: support plugins and user-configured builds.
 # See ./doc/LLVMC-Reference.rst "Customizing LLVMC: the compilation graph"

Modified: llvm/trunk/tools/llvmc/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/Makefile?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/Makefile (original)
+++ llvm/trunk/tools/llvmc/Makefile Sun Aug 15 02:07:12 2010
@@ -9,9 +9,6 @@
 
 LEVEL = ../..
 
-export LLVMC_BASED_DRIVER_NAME = llvmc
-export LLVMC_BUILTIN_PLUGINS = Base Clang
-
-DIRS = plugins driver
+DIRS = src
 
 include $(LEVEL)/Makefile.common

Removed: llvm/trunk/tools/llvmc/driver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/driver/Main.cpp?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/driver/Main.cpp (original)
+++ llvm/trunk/tools/llvmc/driver/Main.cpp (removed)
@@ -1,14 +0,0 @@
-//===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Just include CompilerDriver/Main.inc.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/Main.inc"

Removed: llvm/trunk/tools/llvmc/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/driver/Makefile?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/driver/Makefile (original)
+++ llvm/trunk/tools/llvmc/driver/Makefile (removed)
@@ -1,13 +0,0 @@
-##===- tools/llvmc/driver/Makefile -------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../..
-LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
-
-include $(LEVEL)/Makefile.common

Removed: llvm/trunk/tools/llvmc/plugins/Base/Base.td.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/Base.td.in?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Base.td.in (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/Base.td.in (removed)
@@ -1,377 +0,0 @@
-//===- Base.td - LLVMC toolchain descriptions --------------*- tablegen -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains compilation graph description used by llvmc.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-// Options
-
-def OptList : OptionList<[
- (switch_option "emit-llvm",
-    (help "Emit LLVM .ll files instead of native object files")),
- (switch_option "E",
-    (help "Stop after the preprocessing stage, do not run the compiler")),
- (switch_option "fsyntax-only",
-    (help "Stop after checking the input for syntax errors")),
- (switch_option "opt",
-    (help "Enable opt")),
- (switch_option "O0",
-    (help "Turn off optimization"), (zero_or_more)),
- (switch_option "O1",
-    (help "Optimization level 1"), (zero_or_more)),
- (switch_option "O2",
-    (help "Optimization level 2"), (zero_or_more)),
- (switch_option "O3",
-    (help "Optimization level 3"), (zero_or_more)),
- (switch_option "S",
-    (help "Stop after compilation, do not assemble")),
- (switch_option "c",
-    (help "Compile and assemble, but do not link")),
- (switch_option "pthread",
-    (help "Enable threads")),
- (switch_option "m32",
-    (help "Generate code for a 32-bit environment"), (hidden)),
- (switch_option "m64",
-    (help "Generate code for a 64-bit environment"), (hidden)),
- (switch_option "fPIC",
-    (help "Relocation model: PIC"), (hidden)),
- (switch_option "mdynamic-no-pic",
-    (help "Relocation model: dynamic-no-pic"), (hidden)),
- (switch_option "shared",
-     (help "Create a DLL instead of the regular executable")),
- (parameter_option "linker",
-    (help "Choose linker (possible values: gcc, g++)")),
- (parameter_option "mtune",
-    (help "Target a specific CPU type"), (hidden), (forward_not_split)),
-
- // TODO: Add a conditional compilation mechanism to make Darwin-only options
- // like '-arch' really Darwin-only.
-
- (parameter_option "arch",
-    (help "Compile for the specified target architecture"), (hidden)),
- (parameter_option "march",
-    (help "A synonym for -mtune"), (hidden), (forward_not_split)),
- (parameter_option "mcpu",
-    (help "A deprecated synonym for -mtune"), (hidden), (forward_not_split)),
- (switch_option "mfix-and-continue",
-    (help "Needed by gdb to load .o files dynamically"), (hidden)),
- (parameter_option "MF",
-    (help "Specify a file to write dependencies to"), (hidden)),
- (parameter_list_option "MT",
-    (help "Change the name of the rule emitted by dependency generation"),
-    (hidden)),
- (parameter_list_option "include",
-    (help "Include the named file prior to preprocessing")),
- (parameter_list_option "iquote",
-    (help "Search dir only for files requested with #inlcude \"file\""),
-    (hidden)),
- (parameter_list_option "framework",
-    (help "Specifies a framework to link against")),
- (parameter_list_option "weak_framework",
-    (help "Specifies a framework to weakly link against"), (hidden)),
- (parameter_option "filelist", (hidden),
-    (help "Link the files listed in file")),
- (prefix_list_option "F",
-    (help "Add a directory to framework search path")),
- (prefix_list_option "I",
-    (help "Add a directory to include path")),
- (prefix_list_option "D",
-    (help "Define a macro")),
- (parameter_list_option "Xpreprocessor", (hidden),
-    (help "Pass options to preprocessor")),
- (prefix_list_option "Wa,", (comma_separated),
-    (help "Pass options to assembler")),
- (parameter_list_option "Xassembler", (hidden),
-    (help "Pass options to assembler")),
- (prefix_list_option "Wllc,", (comma_separated),
-    (help "Pass options to llc")),
- (prefix_list_option "L",
-    (help "Add a directory to link path")),
- (prefix_list_option "l",
-    (help "Search a library when linking")),
- (prefix_list_option "Wl,",
-    (help "Pass options to linker")),
- (parameter_list_option "Xlinker", (hidden),
-    (help "Pass options to linker")),
- (prefix_list_option "Wo,", (comma_separated),
-    (help "Pass options to opt")),
- (prefix_list_option "m",
-     (help "Enable or disable various extensions (-mmmx, -msse, etc.)"),
-     (hidden)),
- (switch_option "dynamiclib", (hidden),
-     (help "Produce a dynamic library")),
- (switch_option "prebind", (hidden),
-     (help "Prebind all undefined symbols")),
- (switch_option "dead_strip", (hidden),
-     (help "Remove unreachable blocks of code")),
- (switch_option "single_module", (hidden),
-     (help "Build the library so it contains only one module")),
- (parameter_option "install_name", (hidden),
-     (help "File name the library will be installed in")),
- (parameter_option "compatibility_version", (hidden),
-     (help "Compatibility version number")),
- (parameter_option "current_version", (hidden),
-     (help "Current version number"))
-]>;
-
-// Option preprocessor.
-
-def Preprocess : OptionPreprocessor<
-(case (not (any_switch_on ["O0", "O1", "O2", "O3"])),
-           (set_option "O2"),
-      (and (switch_on "O3"), (any_switch_on ["O0", "O1", "O2"])),
-           (unset_option ["O0", "O1", "O2"]),
-      (and (switch_on "O2"), (any_switch_on ["O0", "O1"])),
-           (unset_option ["O0", "O1"]),
-      (switch_on ["O1", "O0"]),
-           (unset_option "O0"))
->;
-
-// Tools
-
-class llvm_gcc_based <string cmd_prefix, string in_lang,
-                      string E_ext, string out_lang> : Tool<
-[(in_language in_lang),
- (out_language "llvm-bitcode"),
- (output_suffix out_lang),
- (command cmd_prefix),
- (actions
-     (case
-         (and (not_empty "o"),
-              (multiple_input_files), (or (switch_on "S"), (switch_on "c"))),
-              (error "cannot specify -o with -c or -S with multiple files"),
-         (switch_on "E"),
-              [(forward "E"), (stop_compilation), (output_suffix E_ext)],
-         (and (switch_on "E"), (empty "o")), (no_out_file),
-         (switch_on ["emit-llvm", "S"]),
-              [(output_suffix "ll"), (stop_compilation)],
-         (switch_on ["emit-llvm", "c"]), (stop_compilation),
-         (switch_on "fsyntax-only"), [(forward "fsyntax-only"),
-                                      (no_out_file), (stop_compilation)],
-         (switch_on ["S", "emit-llvm"]), [(forward "S"), (forward "emit-llvm")],
-         (not (or (switch_on ["S", "emit-llvm"]), (switch_on "fsyntax-only"))),
-             [(append_cmd "-c"), (append_cmd "-emit-llvm")],
-
-         // Forwards
-         (not_empty "Xpreprocessor"), (forward "Xpreprocessor"),
-         (not_empty "include"), (forward "include"),
-         (not_empty "iquote"), (forward "iquote"),
-         (not_empty "save-temps"), (append_cmd "-save-temps"),
-         (not_empty "I"), (forward "I"),
-         (not_empty "F"), (forward "F"),
-         (not_empty "D"), (forward "D"),
-         (not_empty "arch"), (forward "arch"),
-         (not_empty "march"), (forward "march"),
-         (not_empty "mtune"), (forward "mtune"),
-         (not_empty "mcpu"), (forward "mcpu"),
-         (not_empty "m"), (forward "m"),
-         (switch_on "mfix-and-continue"), (forward "mfix-and-continue"),
-         (switch_on "m32"), (forward "m32"),
-         (switch_on "m64"), (forward "m64"),
-         (switch_on "O0"), (forward "O0"),
-         (switch_on "O1"), (forward "O1"),
-         (switch_on "O2"), (forward "O2"),
-         (switch_on "O3"), (forward "O3"),
-         (switch_on "fPIC"), (forward "fPIC"),
-         (switch_on "mdynamic-no-pic"), (forward "mdynamic-no-pic"),
-         (not_empty "MF"), (forward "MF"),
-         (not_empty "MT"), (forward "MT"))),
- (sink)
-]>;
-
-def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i", "bc">;
-def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i", "bc">;
-def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c",
-                                                  "objective-c", "mi", "bc">;
-def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
-                                  "objective-c++", "mi", "bc">;
-
-def llvm_gcc_c_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c-header",
-                                                      "c-header", "i", "gch">;
-def llvm_gcc_cpp_pch : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++-header",
-                                                        "c++-header",
-                                                        "i", "gch">;
-def llvm_gcc_m_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c-header",
-                                                      "objective-c-header",
-                                                      "mi", "gch">;
-def llvm_gcc_mxx_pch
-    : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++-header",
-                                       "objective-c++-header", "mi", "gch">;
-
-def opt : Tool<
-[(in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (actions (case (not_empty "Wo,"), (forward_value "Wo,"),
-                (switch_on "O1"), (forward "O1"),
-                (switch_on "O2"), (forward "O2"),
-                (switch_on "O3"), (forward "O3"))),
- (command "opt -f")
-]>;
-
-def llvm_as : Tool<
-[(in_language "llvm-assembler"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command "llvm-as"),
- (actions (case (switch_on "emit-llvm"), (stop_compilation)))
-]>;
-
-def llvm_gcc_assembler : Tool<
-[(in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (command "@LLVMGCCCOMMAND@ -c -x assembler"),
- (actions (case
-          (switch_on "c"), (stop_compilation),
-          (not_empty "arch"), (forward "arch"),
-          (not_empty "Xassembler"), (forward "Xassembler"),
-          (switch_on "m32"), (forward "m32"),
-          (switch_on "m64"), (forward "m64"),
-          (not_empty "Wa,"), (forward "Wa,")))
-]>;
-
-def llc : Tool<
-[(in_language ["llvm-bitcode", "llvm-assembler"]),
- (out_language "assembler"),
- (output_suffix "s"),
- (command "llc"),
- (actions (case
-          (switch_on "S"), (stop_compilation),
-          (switch_on "O0"), (forward "O0"),
-          (switch_on "O1"), (forward "O1"),
-          (switch_on "O2"), (forward "O2"),
-          (switch_on "O3"), (forward "O3"),
-          (switch_on "fPIC"), (append_cmd "-relocation-model=pic"),
-          (switch_on "mdynamic-no-pic"),
-                     (append_cmd "-relocation-model=dynamic-no-pic"),
-          (not_empty "march"), (forward_as "mtune", "-mcpu"),
-          (not_empty "mtune"), (forward_as "mtune", "-mcpu"),
-          (not_empty "mcpu"), (forward "mcpu"),
-          (not_empty "m"), (forward_transformed_value "m", "ConvertToMAttr"),
-          (not_empty "Wllc,"), (forward_value "Wllc,")))
-]>;
-
-// Base class for linkers
-class llvm_gcc_based_linker <string cmd_prefix, dag on_empty> : Tool<
-[(in_language ["object-code", "static-library"]),
- (out_language "executable"),
- (output_suffix "out"),
- (command cmd_prefix),
- (works_on_empty (case (and (not_empty "filelist"), on_empty), true,
-                       (default), false)),
- (join),
- (actions (case
-          (switch_on "pthread"), (append_cmd "-lpthread"),
-          (not_empty "L"), (forward "L"),
-          (not_empty "F"), (forward "F"),
-          (not_empty "arch"), (forward "arch"),
-          (not_empty "framework"), (forward "framework"),
-          (not_empty "weak_framework"), (forward "weak_framework"),
-          (not_empty "filelist"), (forward "filelist"),
-          (switch_on "m32"), (forward "m32"),
-          (switch_on "m64"), (forward "m64"),
-          (not_empty "l"), (forward "l"),
-          (not_empty "Xlinker"), (forward "Xlinker"),
-          (not_empty "Wl,"), (forward "Wl,"),
-          (switch_on "shared"), (forward "shared"),
-          (switch_on "dynamiclib"), (forward "dynamiclib"),
-          (switch_on "prebind"), (forward "prebind"),
-          (switch_on "dead_strip"), (forward "dead_strip"),
-          (switch_on "single_module"), (forward "single_module"),
-          (not_empty "compatibility_version"),
-                     (forward "compatibility_version"),
-          (not_empty "current_version"), (forward "current_version"),
-          (not_empty "install_name"), (forward "install_name")))
-]>;
-
-// Default linker
-def llvm_gcc_linker : llvm_gcc_based_linker<"@LLVMGCCCOMMAND@",
-    (not (or (parameter_equals "linker", "g++"),
-         (parameter_equals "linker", "c++")))>;
-// Alternative linker for C++
-def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@",
-    (or (parameter_equals "linker", "g++"),
-        (parameter_equals "linker", "c++"))>;
-
-// Language map
-
-def LanguageMap : LanguageMap<
-    [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
-     LangToSuffixes<"c++-header", ["hpp"]>,
-     LangToSuffixes<"c", ["c"]>,
-     LangToSuffixes<"c-header", ["h"]>,
-     LangToSuffixes<"c-cpp-output", ["i"]>,
-     LangToSuffixes<"objective-c-cpp-output", ["mi"]>,
-     LangToSuffixes<"objective-c++", ["mm"]>,
-     LangToSuffixes<"objective-c++-header", ["hmm"]>,
-     LangToSuffixes<"objective-c", ["m"]>,
-     LangToSuffixes<"objective-c-header", ["hm"]>,
-     LangToSuffixes<"assembler", ["s"]>,
-     LangToSuffixes<"assembler-with-cpp", ["S"]>,
-     LangToSuffixes<"llvm-assembler", ["ll"]>,
-     LangToSuffixes<"llvm-bitcode", ["bc"]>,
-     LangToSuffixes<"object-code", ["o", "*empty*"]>,
-     LangToSuffixes<"static-library", ["a", "lib"]>,
-     LangToSuffixes<"executable", ["out"]>
-     ]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
-    Edge<"root", "llvm_gcc_c">,
-    Edge<"root", "llvm_gcc_assembler">,
-    Edge<"root", "llvm_gcc_cpp">,
-    Edge<"root", "llvm_gcc_m">,
-    Edge<"root", "llvm_gcc_mxx">,
-    Edge<"root", "llc">,
-
-    Edge<"root", "llvm_gcc_c_pch">,
-    Edge<"root", "llvm_gcc_cpp_pch">,
-    Edge<"root", "llvm_gcc_m_pch">,
-    Edge<"root", "llvm_gcc_mxx_pch">,
-
-    Edge<"llvm_gcc_c", "llc">,
-    Edge<"llvm_gcc_cpp", "llc">,
-    Edge<"llvm_gcc_m", "llc">,
-    Edge<"llvm_gcc_mxx", "llc">,
-    Edge<"llvm_as", "llc">,
-
-    OptionalEdge<"root", "llvm_as",
-                         (case (switch_on "emit-llvm"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_c", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_cpp", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_m", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_mxx", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_as", "opt", (case (switch_on "opt"), (inc_weight))>,
-    Edge<"opt", "llc">,
-
-    Edge<"llc", "llvm_gcc_assembler">,
-    Edge<"llvm_gcc_assembler", "llvm_gcc_linker">,
-    OptionalEdge<"llvm_gcc_assembler", "llvm_gcc_cpp_linker",
-                 (case
-                     (or (input_languages_contain "c++"),
-                         (input_languages_contain "objective-c++")),
-                     (inc_weight),
-                     (or (parameter_equals "linker", "g++"),
-                         (parameter_equals "linker", "c++")), (inc_weight))>,
-
-
-    Edge<"root", "llvm_gcc_linker">,
-    OptionalEdge<"root", "llvm_gcc_cpp_linker",
-                 (case
-                     (or (input_languages_contain "c++"),
-                         (input_languages_contain "objective-c++")),
-                     (inc_weight),
-                     (or (parameter_equals "linker", "g++"),
-                         (parameter_equals "linker", "c++")), (inc_weight))>
-    ]>;

Removed: llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp (removed)
@@ -1,33 +0,0 @@
-#include <string>
-#include <vector>
-
-namespace hooks {
-typedef std::vector<std::string> StrVec;
-
-/// ConvertToMAttr - Convert -m* and -mno-* to -mattr=+*,-*
-std::string ConvertToMAttr(const StrVec& Opts) {
-  std::string out("-mattr=");
-
-  bool firstIter = true;
-  for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) {
-    const std::string& Arg = *B;
-
-    if (firstIter)
-      firstIter = false;
-    else
-      out += ",";
-
-    if (Arg.find("no-") == 0 && Arg[3] != 0) {
-      out += '-';
-      out += Arg.c_str() + 3;
-    }
-    else {
-      out += '+';
-      out += Arg;
-    }
-  }
-
-  return out;
-}
-
-}

Removed: llvm/trunk/tools/llvmc/plugins/Base/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/Makefile?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Makefile (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- tools/llvmc/plugins/Base/Makefile -------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-LLVMC_PLUGIN = Base
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/trunk/tools/llvmc/plugins/Base/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/PluginMain.cpp?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/PluginMain.cpp (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/PluginMain.cpp (removed)
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"

Removed: llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Clang/Clang.td?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Clang/Clang.td (original)
+++ llvm/trunk/tools/llvmc/plugins/Clang/Clang.td (removed)
@@ -1,101 +0,0 @@
-include "llvm/CompilerDriver/Common.td"
-
-def Priority : PluginPriority<1>;
-
-def Options : OptionList<[
-// Extern options
-(switch_option "E", (extern)),
-(switch_option "S", (extern)),
-(switch_option "c", (extern)),
-(switch_option "fsyntax-only", (extern)),
-(switch_option "emit-llvm", (extern)),
-(switch_option "pthread", (extern)),
-(parameter_list_option "I", (extern)),
-(parameter_list_option "include", (extern)),
-(parameter_list_option "L", (extern)),
-(parameter_list_option "l", (extern)),
-(prefix_list_option "Wa,", (extern)),
-(prefix_list_option "Wl,", (extern)),
-
-(switch_option "clang", (help "Use Clang instead of llvm-gcc"))
-]>;
-
-class clang_based<string language, string cmd, string ext_E> : Tool<
-[(in_language language),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command cmd),
- (actions (case (switch_on "E"),
-                    [(forward "E"), (stop_compilation), (output_suffix ext_E)],
-                (and (switch_on "E"), (empty "o")), (no_out_file),
-                (switch_on "fsyntax-only"), (stop_compilation),
-                (switch_on ["S", "emit-llvm"]),
-                           [(append_cmd "-emit-llvm"),
-                            (stop_compilation), (output_suffix "ll")],
-                (not (switch_on ["S", "emit-llvm"])),
-                     (append_cmd "-emit-llvm-bc"),
-                (switch_on ["c", "emit-llvm"]),
-                           (stop_compilation),
-                (not_empty "include"), (forward "include"),
-                (not_empty "I"), (forward "I"))),
- (sink)
-]>;
-
-def clang_c : clang_based<"c", "clang -x c", "i">;
-def clang_cpp : clang_based<"c++", "clang -x c++", "i">;
-def clang_objective_c : clang_based<"objective-c",
-    "clang -x objective-c", "mi">;
-def clang_objective_cpp : clang_based<"objective-c++",
-    "clang -x objective-c++", "mi">;
-
-def as : Tool<
-[(in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (command "as"),
- (actions (case (not_empty "Wa,"), (forward_value "Wa,"),
-                (switch_on "c"), (stop_compilation)))
-]>;
-
-// Default linker
-def llvm_ld : Tool<
-[(in_language "object-code"),
- (out_language "executable"),
- (output_suffix "out"),
- (command "llvm-ld -native -disable-internalize"),
- (actions (case
-          (switch_on "pthread"), (append_cmd "-lpthread"),
-          (not_empty "L"), (forward "L"),
-          (not_empty "l"), (forward "l"),
-          (not_empty "Wl,"), (forward_value "Wl,"))),
- (join)
-]>;
-
-// Language map
-
-def LanguageMap : LanguageMap<[
-    LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
-    LangToSuffixes<"c", ["c"]>,
-    LangToSuffixes<"objective-c", ["m"]>,
-    LangToSuffixes<"c-cpp-output", ["i"]>,
-    LangToSuffixes<"objective-c-cpp-output", ["mi"]>
-]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
-    OptionalEdge<"root", "clang_c",
-                         (case (switch_on "clang"), (inc_weight))>,
-    OptionalEdge<"root", "clang_cpp",
-                         (case (switch_on "clang"), (inc_weight))>,
-    OptionalEdge<"root", "clang_objective_c",
-                         (case (switch_on "clang"), (inc_weight))>,
-    OptionalEdge<"root", "clang_objective_cpp",
-                         (case (switch_on "clang"), (inc_weight))>,
-    Edge<"clang_c", "llc">,
-    Edge<"clang_cpp", "llc">,
-    Edge<"clang_objective_c", "llc">,
-    Edge<"clang_objective_cpp", "llc">,
-    OptionalEdge<"llc", "as", (case (switch_on "clang"), (inc_weight))>,
-    Edge<"as", "llvm_ld">
-]>;

Removed: llvm/trunk/tools/llvmc/plugins/Clang/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Clang/Makefile?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Clang/Makefile (original)
+++ llvm/trunk/tools/llvmc/plugins/Clang/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- tools/llvmc/plugins/Clang/Makefile ------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-LLVMC_PLUGIN = Clang
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/trunk/tools/llvmc/plugins/Clang/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Clang/PluginMain.cpp?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Clang/PluginMain.cpp (original)
+++ llvm/trunk/tools/llvmc/plugins/Clang/PluginMain.cpp (removed)
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"

Removed: llvm/trunk/tools/llvmc/plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Makefile?rev=111093&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Makefile (original)
+++ llvm/trunk/tools/llvmc/plugins/Makefile (removed)
@@ -1,18 +0,0 @@
-##===- tools/llvmc/plugins/Makefile ------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../..
-
-ifneq ($(LLVMC_BUILTIN_PLUGINS),)
-DIRS = $(LLVMC_BUILTIN_PLUGINS)
-endif
-
-export LLVMC_BUILTIN_PLUGIN=1
-
-include $(LEVEL)/Makefile.common

Copied: llvm/trunk/tools/llvmc/src/AutoGenerated.td (from r111083, llvm/trunk/tools/llvmc/driver/Main.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/AutoGenerated.td?p2=llvm/trunk/tools/llvmc/src/AutoGenerated.td&p1=llvm/trunk/tools/llvmc/driver/Main.cpp&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/driver/Main.cpp (original)
+++ llvm/trunk/tools/llvmc/src/AutoGenerated.td Sun Aug 15 02:07:12 2010
@@ -1,14 +1,17 @@
-//===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
+//===- AutoGenerated.td - LLVMC toolchain descriptions -----*- tablegen -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
-//  Just include CompilerDriver/Main.inc.
+// This file contains compilation graph description used by llvmc.
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CompilerDriver/Main.inc"
+include "llvm/CompilerDriver/Common.td"
+
+include "Base.td"
+include "Clang.td"

Copied: llvm/trunk/tools/llvmc/src/Base.td.in (from r111083, llvm/trunk/tools/llvmc/plugins/Base/Base.td.in)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Base.td.in?p2=llvm/trunk/tools/llvmc/src/Base.td.in&p1=llvm/trunk/tools/llvmc/plugins/Base/Base.td.in&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Base.td.in (original)
+++ llvm/trunk/tools/llvmc/src/Base.td.in Sun Aug 15 02:07:12 2010
@@ -11,7 +11,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-include "llvm/CompilerDriver/Common.td"
 
 // Options
 

Copied: llvm/trunk/tools/llvmc/src/Clang.td (from r111083, llvm/trunk/tools/llvmc/plugins/Clang/Clang.td)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Clang.td?p2=llvm/trunk/tools/llvmc/src/Clang.td&p1=llvm/trunk/tools/llvmc/plugins/Clang/Clang.td&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Clang/Clang.td (original)
+++ llvm/trunk/tools/llvmc/src/Clang.td Sun Aug 15 02:07:12 2010
@@ -1,22 +1,18 @@
-include "llvm/CompilerDriver/Common.td"
+//===- Clang.td - LLVMC toolchain descriptions -------------*- tablegen -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains compilation graph description used by llvmc.
+//
+//===----------------------------------------------------------------------===//
 
-def Priority : PluginPriority<1>;
 
 def Options : OptionList<[
-// Extern options
-(switch_option "E", (extern)),
-(switch_option "S", (extern)),
-(switch_option "c", (extern)),
-(switch_option "fsyntax-only", (extern)),
-(switch_option "emit-llvm", (extern)),
-(switch_option "pthread", (extern)),
-(parameter_list_option "I", (extern)),
-(parameter_list_option "include", (extern)),
-(parameter_list_option "L", (extern)),
-(parameter_list_option "l", (extern)),
-(prefix_list_option "Wa,", (extern)),
-(prefix_list_option "Wl,", (extern)),
-
 (switch_option "clang", (help "Use Clang instead of llvm-gcc"))
 ]>;
 
@@ -71,19 +67,9 @@
  (join)
 ]>;
 
-// Language map
-
-def LanguageMap : LanguageMap<[
-    LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
-    LangToSuffixes<"c", ["c"]>,
-    LangToSuffixes<"objective-c", ["m"]>,
-    LangToSuffixes<"c-cpp-output", ["i"]>,
-    LangToSuffixes<"objective-c-cpp-output", ["mi"]>
-]>;
-
 // Compilation graph
 
-def CompilationGraph : CompilationGraph<[
+def ClangCompilationGraph : CompilationGraph<[
     OptionalEdge<"root", "clang_c",
                          (case (switch_on "clang"), (inc_weight))>,
     OptionalEdge<"root", "clang_cpp",

Copied: llvm/trunk/tools/llvmc/src/Hooks.cpp (from r111083, llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Hooks.cpp?p2=llvm/trunk/tools/llvmc/src/Hooks.cpp&p1=llvm/trunk/tools/llvmc/plugins/Base/Hooks.cpp&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
    (empty)

Copied: llvm/trunk/tools/llvmc/src/Main.cpp (from r111083, llvm/trunk/tools/llvmc/driver/Main.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Main.cpp?p2=llvm/trunk/tools/llvmc/src/Main.cpp&p1=llvm/trunk/tools/llvmc/driver/Main.cpp&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/driver/Main.cpp (original)
+++ llvm/trunk/tools/llvmc/src/Main.cpp Sun Aug 15 02:07:12 2010
@@ -7,8 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  Just include CompilerDriver/Main.inc.
+//  Just include AutoGenerated.inc and CompilerDriver/Main.inc.
 //
 //===----------------------------------------------------------------------===//
 
+#include "AutoGenerated.inc"
+
 #include "llvm/CompilerDriver/Main.inc"

Copied: llvm/trunk/tools/llvmc/src/Makefile (from r111083, llvm/trunk/tools/llvmc/driver/Makefile)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Makefile?p2=llvm/trunk/tools/llvmc/src/Makefile&p1=llvm/trunk/tools/llvmc/driver/Makefile&r1=111083&r2=111094&rev=111094&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/driver/Makefile (original)
+++ llvm/trunk/tools/llvmc/src/Makefile Sun Aug 15 02:07:12 2010
@@ -8,6 +8,7 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../../..
-LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
+LLVMC_BASED_DRIVER = llvmc
+BUILT_SOURCES = AutoGenerated.inc
 
 include $(LEVEL)/Makefile.common

Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=111094&r1=111093&r2=111094&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Sun Aug 15 02:07:12 2010
@@ -234,10 +234,9 @@
 
 namespace OptionDescriptionFlags {
   enum OptionDescriptionFlags { Required = 0x1, Hidden = 0x2,
-                                ReallyHidden = 0x4, Extern = 0x8,
-                                OneOrMore = 0x10, Optional = 0x20,
-                                CommaSeparated = 0x40, ForwardNotSplit = 0x80,
-                                ZeroOrMore = 0x100 };
+                                ReallyHidden = 0x4, OneOrMore = 0x8,
+                                Optional = 0x10, CommaSeparated = 0x20,
+                                ForwardNotSplit = 0x40, ZeroOrMore = 0x80 };
 }
 
 /// OptionDescription - Represents data contained in a single
@@ -279,9 +278,6 @@
   bool isCommaSeparated() const;
   void setCommaSeparated();
 
-  bool isExtern() const;
-  void setExtern();
-
   bool isForwardNotSplit() const;
   void setForwardNotSplit();
 
@@ -372,13 +368,6 @@
   Flags |= OptionDescriptionFlags::ForwardNotSplit;
 }
 
-bool OptionDescription::isExtern() const {
-  return Flags & OptionDescriptionFlags::Extern;
-}
-void OptionDescription::setExtern() {
-  Flags |= OptionDescriptionFlags::Extern;
-}
-
 bool OptionDescription::isRequired() const {
   return Flags & OptionDescriptionFlags::Required;
 }
@@ -653,7 +642,6 @@
     : optDesc_(OD)
   {
     if (!staticMembersInitialized_) {
-      AddHandler("extern", &CollectOptionProperties::onExtern);
       AddHandler("help", &CollectOptionProperties::onHelp);
       AddHandler("hidden", &CollectOptionProperties::onHidden);
       AddHandler("init", &CollectOptionProperties::onInit);
@@ -682,11 +670,6 @@
   /// Option property handlers --
   /// Methods that handle option properties such as (help) or (hidden).
 
-  void onExtern (const DagInit& d) {
-    CheckNumberOfArguments(d, 0);
-    optDesc_.setExtern();
-  }
-
   void onHelp (const DagInit& d) {
     CheckNumberOfArguments(d, 1);
     optDesc_.Help = EscapeQuotes(InitPtrToString(d.getArg(0)));
@@ -799,16 +782,17 @@
 
     OptionDescription OD(Type, Name);
 
-    if (!OD.isExtern())
-      CheckNumberOfArguments(d, 2);
+
+    CheckNumberOfArguments(d, 2);
 
     if (OD.isAlias()) {
       // Aliases store the aliased option name in the 'Help' field.
       OD.Help = InitPtrToString(d.getArg(1));
     }
-    else if (!OD.isExtern()) {
+    else {
       processOptionProperties(d, OD);
     }
+
     OptDescs_.InsertDescription(OD);
   }
 
@@ -1043,22 +1027,6 @@
   }
 }
 
-/// CalculatePriority - Calculate the priority of this plugin.
-int CalculatePriority(RecordVector::const_iterator B,
-                      RecordVector::const_iterator E) {
-  int priority = 0;
-
-  if (B != E) {
-    priority  = static_cast<int>((*B)->getValueAsInt("priority"));
-
-    if (++B != E)
-      throw "More than one 'PluginPriority' instance found: "
-        "most probably an error!";
-  }
-
-  return priority;
-}
-
 /// NotInGraph - Helper function object for FilterNotInGraph.
 struct NotInGraph {
 private:
@@ -2382,8 +2350,7 @@
 /// EmitOptionDefinitions - Iterate over a list of option descriptions
 /// and emit registration code.
 void EmitOptionDefinitions (const OptionDescriptions& descs,
-                            bool HasSink, bool HasExterns,
-                            raw_ostream& O)
+                            bool HasSink, raw_ostream& O)
 {
   std::vector<OptionDescription> Aliases;
 
@@ -2397,17 +2364,9 @@
       continue;
     }
 
-    if (val.isExtern())
-      O << "extern ";
-
     O << val.GenTypeDeclaration() << ' '
       << val.GenVariableName();
 
-    if (val.isExtern()) {
-      O << ";\n";
-      continue;
-    }
-
     O << "(\"" << val.Name << "\"\n";
 
     if (val.Type == OptionType::Prefix || val.Type == OptionType::PrefixList)
@@ -2468,9 +2427,7 @@
 
   // Emit the sink option.
   if (HasSink)
-    O << (HasExterns ? "extern cl" : "cl")
-      << "::list<std::string> " << SinkOptionName
-      << (HasExterns ? ";\n" : "(cl::Sink);\n");
+    O << "cl" << "::list<std::string> " << SinkOptionName << "(cl::Sink);\n";
 
   O << '\n';
 }
@@ -2629,11 +2586,11 @@
 
 };
 
-/// EmitPreprocessOptions - Emit the PreprocessOptionsLocal() function.
+/// EmitPreprocessOptions - Emit the PreprocessOptions() function.
 void EmitPreprocessOptions (const RecordKeeper& Records,
                             const OptionDescriptions& OptDecs, raw_ostream& O)
 {
-  O << "int PreprocessOptionsLocal() {\n";
+  O << "int PreprocessOptions () {\n";
 
   const RecordVector& OptionPreprocessors =
     Records.getAllDerivedDefinitions("OptionPreprocessor");
@@ -2651,12 +2608,13 @@
   O << "}\n\n";
 }
 
-/// EmitPopulateLanguageMap - Emit the PopulateLanguageMapLocal() function.
+/// EmitPopulateLanguageMap - Emit the PopulateLanguageMap() function.
 void EmitPopulateLanguageMap (const RecordKeeper& Records, raw_ostream& O)
 {
-  O << "int PopulateLanguageMapLocal(LanguageMap& langMap) {\n";
+  O << "int PopulateLanguageMap (LanguageMap& langMap) {\n";
 
   // Get the relevant field out of RecordKeeper
+  // TODO: change this to getAllDerivedDefinitions.
   const Record* LangMapRecord = Records.getDef("LanguageMap");
 
   // It is allowed for a plugin to have no language map.
@@ -2758,13 +2716,12 @@
   }
 }
 
-/// EmitPopulateCompilationGraph - Emit the PopulateCompilationGraphLocal()
-/// function.
+/// EmitPopulateCompilationGraph - Emit the PopulateCompilationGraph() function.
 void EmitPopulateCompilationGraph (const RecordVector& EdgeVector,
                                    const ToolDescriptions& ToolDescs,
                                    raw_ostream& O)
 {
-  O << "int PopulateCompilationGraphLocal(CompilationGraph& G) {\n";
+  O << "int PopulateCompilationGraph (CompilationGraph& G) {\n";
 
   for (ToolDescriptions::const_iterator B = ToolDescs.begin(),
          E = ToolDescs.end(); B != E; ++B)
@@ -2974,30 +2931,12 @@
   O << "}\n\n";
 }
 
-/// EmitRegisterPlugin - Emit code to register this plugin.
-void EmitRegisterPlugin(int Priority, raw_ostream& O) {
-  O << "struct Plugin : public llvmc::BasePlugin {\n\n";
-  O.indent(Indent1) << "int Priority() const { return "
-                    << Priority << "; }\n\n";
-  O.indent(Indent1) << "int PreprocessOptions() const\n";
-  O.indent(Indent1) << "{ return PreprocessOptionsLocal(); }\n\n";
-  O.indent(Indent1) << "int PopulateLanguageMap(LanguageMap& langMap) const\n";
-  O.indent(Indent1) << "{ return PopulateLanguageMapLocal(langMap); }\n\n";
-  O.indent(Indent1)
-    << "int PopulateCompilationGraph(CompilationGraph& graph) const\n";
-  O.indent(Indent1) << "{ return PopulateCompilationGraphLocal(graph); }\n"
-                    << "};\n\n"
-                    << "static llvmc::RegisterPlugin<Plugin> RP;\n\n";
-}
-
 /// EmitIncludes - Emit necessary #include directives and some
 /// additional declarations.
 void EmitIncludes(raw_ostream& O) {
   O << "#include \"llvm/CompilerDriver/BuiltinOptions.h\"\n"
     << "#include \"llvm/CompilerDriver/CompilationGraph.h\"\n"
     << "#include \"llvm/CompilerDriver/Error.h\"\n"
-    << "#include \"llvm/CompilerDriver/ForceLinkageMacros.h\"\n"
-    << "#include \"llvm/CompilerDriver/Plugin.h\"\n"
     << "#include \"llvm/CompilerDriver/Tool.h\"\n\n"
 
     << "#include \"llvm/Support/CommandLine.h\"\n"
@@ -3022,10 +2961,8 @@
 struct PluginData {
   OptionDescriptions OptDescs;
   bool HasSink;
-  bool HasExterns;
   ToolDescriptions ToolDescs;
   RecordVector Edges;
-  int Priority;
 };
 
 /// HasSink - Go through the list of tool descriptions and check if
@@ -3039,19 +2976,8 @@
   return false;
 }
 
-/// HasExterns - Go through the list of option descriptions and check
-/// if there are any external options.
-bool HasExterns(const OptionDescriptions& OptDescs) {
- for (OptionDescriptions::const_iterator B = OptDescs.begin(),
-         E = OptDescs.end(); B != E; ++B)
-    if (B->second.isExtern())
-      return true;
-
-  return false;
-}
-
-/// CollectPluginData - Collect tool and option properties,
-/// compilation graph edges and plugin priority from the parse tree.
+/// CollectPluginData - Collect compilation graph edges, tool properties and
+/// option properties from the parse tree.
 void CollectPluginData (const RecordKeeper& Records, PluginData& Data) {
   // Collect option properties.
   const RecordVector& OptionLists =
@@ -3063,18 +2989,12 @@
   const RecordVector& Tools = Records.getAllDerivedDefinitions("Tool");
   CollectToolDescriptions(Tools.begin(), Tools.end(), Data.ToolDescs);
   Data.HasSink = HasSink(Data.ToolDescs);
-  Data.HasExterns = HasExterns(Data.OptDescs);
 
   // Collect compilation graph edges.
   const RecordVector& CompilationGraphs =
     Records.getAllDerivedDefinitions("CompilationGraph");
   FillInEdgeVector(CompilationGraphs.begin(), CompilationGraphs.end(),
                    Data.Edges);
-
-  // Calculate the priority of this plugin.
-  const RecordVector& Priorities =
-    Records.getAllDerivedDefinitions("PluginPriority");
-  Data.Priority = CalculatePriority(Priorities.begin(), Priorities.end());
 }
 
 /// CheckPluginData - Perform some sanity checks on the collected data.
@@ -3095,20 +3015,13 @@
   EmitIncludes(O);
 
   // Emit global option registration code.
-  EmitOptionDefinitions(Data.OptDescs, Data.HasSink, Data.HasExterns, O);
+  EmitOptionDefinitions(Data.OptDescs, Data.HasSink, O);
 
   // Emit hook declarations.
   EmitHookDeclarations(Data.ToolDescs, Data.OptDescs, O);
 
   O << "namespace {\n\n";
 
-  // Emit PreprocessOptionsLocal() function.
-  EmitPreprocessOptions(Records, Data.OptDescs, O);
-
-  // Emit PopulateLanguageMapLocal() function
-  // (language map maps from file extensions to language names).
-  EmitPopulateLanguageMap(Records, O);
-
   // Emit Tool classes.
   for (ToolDescriptions::const_iterator B = Data.ToolDescs.begin(),
          E = Data.ToolDescs.end(); B!=E; ++B)
@@ -3117,18 +3030,23 @@
   // Emit Edge# classes.
   EmitEdgeClasses(Data.Edges, Data.OptDescs, O);
 
-  // Emit PopulateCompilationGraphLocal() function.
-  EmitPopulateCompilationGraph(Data.Edges, Data.ToolDescs, O);
-
-  // Emit code for plugin registration.
-  EmitRegisterPlugin(Data.Priority, O);
-
   O << "} // End anonymous namespace.\n\n";
 
-  // Force linkage magic.
   O << "namespace llvmc {\n";
-  O << "LLVMC_FORCE_LINKAGE_DECL(LLVMC_PLUGIN_NAME) {}\n";
-  O << "}\n";
+  O << "namespace autogenerated {\n\n";
+
+  // Emit PreprocessOptions() function.
+  EmitPreprocessOptions(Records, Data.OptDescs, O);
+
+  // Emit PopulateLanguageMap() function
+  // (language map maps from file extensions to language names).
+  EmitPopulateLanguageMap(Records, O);
+
+  // Emit PopulateCompilationGraph() function.
+  EmitPopulateCompilationGraph(Data.Edges, Data.ToolDescs, O);
+
+  O << "} // End namespace autogenerated.\n";
+  O << "} // End namespace llvmc.\n\n";
 
   // EOF
 }





More information about the llvm-commits mailing list