Add example/Skeleton.
authorMikhail Glushenkov <foldr@codedgers.com>
Tue, 3 Mar 2009 11:02:48 +0000 (11:02 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Tue, 3 Mar 2009 11:02:48 +0000 (11:02 +0000)
This is a template that can be used to build your own LLVMC-based drivers.
It can be also useful as a "bare-bones" LLVMC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65944 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvmc/Makefile
tools/llvmc/example/Skeleton/Makefile [new file with mode: 0644]
tools/llvmc/example/Skeleton/README [new file with mode: 0644]
tools/llvmc/example/Skeleton/driver/Main.cpp [new file with mode: 0644]
tools/llvmc/example/Skeleton/driver/Makefile [new file with mode: 0644]
tools/llvmc/example/Skeleton/plugins/Makefile [new file with mode: 0644]
tools/llvmc/example/Skeleton/plugins/Plugin/Makefile [new file with mode: 0644]
tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td [new file with mode: 0644]
tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp [new file with mode: 0644]

index 60961769d19754f956cd916433ee74fa929c7031..df91728ea360251779c0a2b34ae4790c727da6f7 100644 (file)
@@ -9,9 +9,6 @@
 
 LEVEL = ../..
 
-# The current plan is to make the user copy the skeleton project and change only
-# this file (and plugins/UserPlugin, of course).
-
 export LLVMC_BASED_DRIVER_NAME = llvmc
 export LLVMC_BUILTIN_PLUGINS = Base Clang
 
diff --git a/tools/llvmc/example/Skeleton/Makefile b/tools/llvmc/example/Skeleton/Makefile
new file mode 100644 (file)
index 0000000..2e4cbb9
--- /dev/null
@@ -0,0 +1,24 @@
+##===- llvmc/example/Skeleton/Makefile ---------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open
+# Source License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+# Change this so that $(BASE_LEVEL)/Makefile.common refers to
+# $LLVM_DIR/Makefile.common.
+export LLVMC_BASE_LEVEL = ../../../..
+
+# Change this to the name of your LLVMC-based driver.
+export LLVMC_BASED_DRIVER_NAME = llvmc-skeleton
+
+# List your plugin names here
+export LLVMC_BUILTIN_PLUGINS = # Plugin
+
+LEVEL = $(LLVMC_BASE_LEVEL)
+
+DIRS = plugins driver
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/example/Skeleton/README b/tools/llvmc/example/Skeleton/README
new file mode 100644 (file)
index 0000000..92216ae
--- /dev/null
@@ -0,0 +1,6 @@
+
+This is a template that can be used to create your own LLVMC-based drivers. Just
+copy the `Skeleton` directory to the location of your preference and edit
+`Skeleton/Makefile` and `Skeleton/plugins/Plugin`.
+
+The build system assumes that your project is based on LLVM.
diff --git a/tools/llvmc/example/Skeleton/driver/Main.cpp b/tools/llvmc/example/Skeleton/driver/Main.cpp
new file mode 100644 (file)
index 0000000..b1f5b67
--- /dev/null
@@ -0,0 +1,14 @@
+//===--- 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"
diff --git a/tools/llvmc/example/Skeleton/driver/Makefile b/tools/llvmc/example/Skeleton/driver/Makefile
new file mode 100644 (file)
index 0000000..bf6d7a5
--- /dev/null
@@ -0,0 +1,22 @@
+##===- llvmc/example/Skeleton/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_BASE_LEVEL)/..
+
+TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
+LLVMLIBS = CompilerDriver
+
+ifneq ($(LLVMC_BUILTIN_PLUGINS),)
+USEDLIBS += $(patsubst %,plugin_llvmc_%,$(LLVMC_BUILTIN_PLUGINS))
+endif
+
+LINK_COMPONENTS = support system
+REQUIRES_EH := 1
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/example/Skeleton/plugins/Makefile b/tools/llvmc/example/Skeleton/plugins/Makefile
new file mode 100644 (file)
index 0000000..fb07f23
--- /dev/null
@@ -0,0 +1,18 @@
+##===- llvmc/example/Skeleton/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 = $(LLVMC_BASE_LEVEL)/..
+
+ifneq ($(LLVMC_BUILTIN_PLUGINS),)
+DIRS = $(LLVMC_BUILTIN_PLUGINS)
+endif
+
+export LLVMC_BUILTIN_PLUGIN=1
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile b/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile
new file mode 100644 (file)
index 0000000..54f7221
--- /dev/null
@@ -0,0 +1,17 @@
+##===- llvmc/example/Skeleton/plugins/Plugin/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_BASE_LEVEL)/../..
+
+# Change this to the name of your plugin.
+LLVMC_PLUGIN = Plugin
+
+BUILT_SOURCES = AutoGenerated.inc
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td b/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td
new file mode 100644 (file)
index 0000000..febb9ad
--- /dev/null
@@ -0,0 +1,7 @@
+//===- Plugin.td - A skeleton plugin for LLVMC -------------*- tablegen -*-===//
+//
+// Write the code for your plugin here.
+//
+//===----------------------------------------------------------------------===//
+
+include "llvm/CompilerDriver/Common.td"
diff --git a/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp b/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp
new file mode 100644 (file)
index 0000000..add8acb
--- /dev/null
@@ -0,0 +1 @@
+#include "AutoGenerated.inc"