summaryrefslogtreecommitdiffstats
path: root/tools/llvmc/example/Simple
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:52:33 +0000
committered <ed@FreeBSD.org>2009-06-02 17:52:33 +0000
commit3277b69d734b9c90b44ebde4ede005717e2c3b2e (patch)
tree64ba909838c23261cace781ece27d106134ea451 /tools/llvmc/example/Simple
downloadFreeBSD-src-3277b69d734b9c90b44ebde4ede005717e2c3b2e.zip
FreeBSD-src-3277b69d734b9c90b44ebde4ede005717e2c3b2e.tar.gz
Import LLVM, at r72732.
Diffstat (limited to 'tools/llvmc/example/Simple')
-rw-r--r--tools/llvmc/example/Simple/Makefile15
-rw-r--r--tools/llvmc/example/Simple/PluginMain.cpp1
-rw-r--r--tools/llvmc/example/Simple/Simple.td37
3 files changed, 53 insertions, 0 deletions
diff --git a/tools/llvmc/example/Simple/Makefile b/tools/llvmc/example/Simple/Makefile
new file mode 100644
index 0000000..d7adb5d
--- /dev/null
+++ b/tools/llvmc/example/Simple/Makefile
@@ -0,0 +1,15 @@
+##===- tools/llvmc/plugins/Simple/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 = Simple
+BUILT_SOURCES = AutoGenerated.inc
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/example/Simple/PluginMain.cpp b/tools/llvmc/example/Simple/PluginMain.cpp
new file mode 100644
index 0000000..add8acb
--- /dev/null
+++ b/tools/llvmc/example/Simple/PluginMain.cpp
@@ -0,0 +1 @@
+#include "AutoGenerated.inc"
diff --git a/tools/llvmc/example/Simple/Simple.td b/tools/llvmc/example/Simple/Simple.td
new file mode 100644
index 0000000..87bc385
--- /dev/null
+++ b/tools/llvmc/example/Simple/Simple.td
@@ -0,0 +1,37 @@
+//===- Simple.td - A simple plugin for LLVMC ------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// A simple LLVMC-based gcc wrapper that shows how to write LLVMC plugins.
+//
+// To compile, use this command:
+//
+// $ cd $LLVMC_DIR/example/Simple
+// $ make
+//
+// Run as:
+//
+// $ llvmc -load $LLVM_DIR/Release/lib/plugin_llvmc_Simple.so
+//
+// For instructions on how to build your own LLVMC-based driver, see
+// the 'example/Skeleton' directory.
+//===----------------------------------------------------------------------===//
+
+include "llvm/CompilerDriver/Common.td"
+
+def gcc : Tool<
+[(in_language "c"),
+ (out_language "executable"),
+ (output_suffix "out"),
+ (cmd_line "gcc $INFILE -o $OUTFILE"),
+ (sink)
+]>;
+
+def LanguageMap : LanguageMap<[LangToSuffixes<"c", ["c"]>]>;
+
+def CompilationGraph : CompilationGraph<[Edge<"root", "gcc">]>;
OpenPOWER on IntegriCloud