aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-08-15 07:07:12 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-08-15 07:07:12 +0000
commitb3d36293c2b7d5f4b53f3f907f97264309205c23 (patch)
tree9e3c0c04e35dd73864cced2cb17c5fb77e973f80
parentc0b2a2018ad194de6a9cf46a2a5936319787f1b1 (diff)
llvmc: remove dynamic plugins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111094 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile2
-rw-r--r--Makefile.rules74
-rw-r--r--autoconf/configure.ac31
-rw-r--r--include/llvm/CompilerDriver/AutoGenerated.h40
-rw-r--r--include/llvm/CompilerDriver/Common.td6
-rw-r--r--include/llvm/CompilerDriver/ForceLinkage.h122
-rw-r--r--include/llvm/CompilerDriver/ForceLinkageMacros.h29
-rw-r--r--include/llvm/CompilerDriver/Main.h21
-rw-r--r--include/llvm/CompilerDriver/Main.inc14
-rw-r--r--include/llvm/CompilerDriver/Plugin.h81
-rw-r--r--lib/CompilerDriver/Main.cpp13
-rw-r--r--lib/CompilerDriver/Makefile31
-rw-r--r--lib/CompilerDriver/Plugin.cpp83
-rw-r--r--tools/llvmc/CMakeLists.txt2
-rw-r--r--tools/llvmc/Makefile5
-rw-r--r--tools/llvmc/plugins/Base/Makefile15
-rw-r--r--tools/llvmc/plugins/Base/PluginMain.cpp1
-rw-r--r--tools/llvmc/plugins/Clang/Makefile15
-rw-r--r--tools/llvmc/plugins/Clang/PluginMain.cpp1
-rw-r--r--tools/llvmc/plugins/Makefile18
-rw-r--r--tools/llvmc/src/AutoGenerated.td17
-rw-r--r--tools/llvmc/src/Base.td.in (renamed from tools/llvmc/plugins/Base/Base.td.in)1
-rw-r--r--tools/llvmc/src/Clang.td (renamed from tools/llvmc/plugins/Clang/Clang.td)40
-rw-r--r--tools/llvmc/src/Hooks.cpp (renamed from tools/llvmc/plugins/Base/Hooks.cpp)0
-rw-r--r--tools/llvmc/src/Main.cpp (renamed from tools/llvmc/driver/Main.cpp)4
-rw-r--r--tools/llvmc/src/Makefile (renamed from tools/llvmc/driver/Makefile)3
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp148
27 files changed, 163 insertions, 654 deletions
diff --git a/Makefile b/Makefile
index d810b5f681..ae650b7f2d 100644
--- a/Makefile
+++ b/Makefile
@@ -170,7 +170,7 @@ FilesToConfig := \
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)
diff --git a/Makefile.rules b/Makefile.rules
index 056a0ea3ef..2e14094b3a 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -196,57 +196,15 @@ install-local:: all-local
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 @@ ifdef TARGET
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 @@ clean-local::
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
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 7211fe1972..8a42d32666 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -858,35 +858,6 @@ AC_ARG_ENABLE(libffi,AS_HELP_STRING(
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 @@ dnl Configure the RPM spec file for LLVM
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])
diff --git a/include/llvm/CompilerDriver/AutoGenerated.h b/include/llvm/CompilerDriver/AutoGenerated.h
new file mode 100644
index 0000000000..7b926c622c
--- /dev/null
+++ b/include/llvm/CompilerDriver/AutoGenerated.h
@@ -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
diff --git a/include/llvm/CompilerDriver/Common.td b/include/llvm/CompilerDriver/Common.td
index 6527ab5d4f..d378bb74d2 100644
--- a/include/llvm/CompilerDriver/Common.td
+++ b/include/llvm/CompilerDriver/Common.td
@@ -40,7 +40,6 @@ def prefix_list_option;
// Possible option properties.
-def extern;
def help;
def hidden;
def init;
@@ -101,11 +100,6 @@ def dec_weight;
// 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;
diff --git a/include/llvm/CompilerDriver/ForceLinkage.h b/include/llvm/CompilerDriver/ForceLinkage.h
deleted file mode 100644
index 830c04e2d3..0000000000
--- a/include/llvm/CompilerDriver/ForceLinkage.h
+++ /dev/null
@@ -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
diff --git a/include/llvm/CompilerDriver/ForceLinkageMacros.h b/include/llvm/CompilerDriver/ForceLinkageMacros.h
deleted file mode 100644
index 8862b00823..0000000000
--- a/include/llvm/CompilerDriver/ForceLinkageMacros.h
+++ /dev/null
@@ -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
diff --git a/include/llvm/CompilerDriver/Main.h b/include/llvm/CompilerDriver/Main.h
new file mode 100644
index 0000000000..d136a5d2fa
--- /dev/null
+++ b/include/llvm/CompilerDriver/Main.h
@@ -0,0 +1,21 @@
+//===--- Main.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// Entry point for the driver executable.
+//
+//===----------------------------------------------------------------------===//
+
+#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
diff --git a/include/llvm/CompilerDriver/Main.inc b/include/llvm/CompilerDriver/Main.inc
index 71bb8cb3bf..41640437de 100644
--- a/include/llvm/CompilerDriver/Main.inc
+++ b/include/llvm/CompilerDriver/Main.inc
@@ -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);
}
diff --git a/include/llvm/CompilerDriver/Plugin.h b/include/llvm/CompilerDriver/Plugin.h
deleted file mode 100644
index 75fd9162df..0000000000
--- a/include/llvm/CompilerDriver/Plugin.h
+++ /dev/null
@@ -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
diff --git a/lib/CompilerDriver/Main.cpp b/lib/CompilerDriver/Main.cpp
index 898f16d515..0a6613aa77 100644
--- a/lib/CompilerDriver/Main.cpp
+++ b/lib/CompilerDriver/Main.cpp
@@ -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 @@ namespace {
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 @@ void AppendToGlobalTimeLog(const std::string& cmd, double time) {
*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 @@ int Main(int argc, char** argv) {
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) {
diff --git a/lib/CompilerDriver/Makefile b/lib/CompilerDriver/Makefile
index b829f5261c..69c3707780 100644
--- a/lib/CompilerDriver/Makefile
+++ b/lib/CompilerDriver/Makefile
@@ -12,34 +12,7 @@ LEVEL = ../..
# 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
diff --git a/lib/CompilerDriver/Plugin.cpp b/lib/CompilerDriver/Plugin.cpp
deleted file mode 100644
index d520d4f05c..0000000000
--- a/lib/CompilerDriver/Plugin.cpp
+++ /dev/null
@@ -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;
- }
-
-}
diff --git a/tools/llvmc/CMakeLists.txt b/tools/llvmc/CMakeLists.txt
index bebaaebca8..10ad5d8200 100644
--- a/tools/llvmc/CMakeLists.txt
+++ b/tools/llvmc/CMakeLists.txt
@@ -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"
diff --git a/tools/llvmc/Makefile b/tools/llvmc/Makefile
index df91728ea3..9bcb96c954 100644
--- a/tools/llvmc/Makefile
+++ b/tools/llvmc/Makefile
@@ -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
diff --git a/tools/llvmc/plugins/Base/Makefile b/tools/llvmc/plugins/Base/Makefile
deleted file mode 100644
index ebc4335054..0000000000
--- a/tools/llvmc/plugins/Base/Makefile
+++ /dev/null
@@ -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
diff --git a/tools/llvmc/plugins/Base/PluginMain.cpp b/tools/llvmc/plugins/Base/PluginMain.cpp
deleted file mode 100644
index add8acb4a5..0000000000
--- a/tools/llvmc/plugins/Base/PluginMain.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"
diff --git a/tools/llvmc/plugins/Clang/Makefile b/tools/llvmc/plugins/Clang/Makefile
deleted file mode 100644
index 5e5b88a44b..0000000000
--- a/tools/llvmc/plugins/Clang/Makefile
+++ /dev/null
@@ -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
diff --git a/tools/llvmc/plugins/Clang/PluginMain.cpp b/tools/llvmc/plugins/Clang/PluginMain.cpp
deleted file mode 100644
index add8acb4a5..0000000000
--- a/tools/llvmc/plugins/Clang/PluginMain.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"
diff --git a/tools/llvmc/plugins/Makefile b/tools/llvmc/plugins/Makefile
deleted file mode 100644
index 37dac6f0ac..0000000000
--- a/tools/llvmc/plugins/Makefile
+++ /dev/null
@@ -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
diff --git a/tools/llvmc/src/AutoGenerated.td b/tools/llvmc/src/AutoGenerated.td
new file mode 100644
index 0000000000..8507b1ff22
--- /dev/null
+++ b/tools/llvmc/src/AutoGenerated.td
@@ -0,0 +1,17 @@