summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--autoconf/configure.ac3
-rwxr-xr-xconfigure4
-rw-r--r--test/LLVMC/Alias.td24
-rw-r--r--test/LLVMC/AppendCmdHook.td29
-rw-r--r--test/LLVMC/C++/dash-x.cpp10
-rw-r--r--test/LLVMC/C++/dg.exp5
-rw-r--r--test/LLVMC/C++/filelist.cpp3
-rw-r--r--test/LLVMC/C++/hello.cpp9
-rw-r--r--test/LLVMC/C++/just-compile.cpp10
-rw-r--r--test/LLVMC/C++/together.cpp10
-rw-r--r--test/LLVMC/C++/unknown_suffix.unk9
-rw-r--r--test/LLVMC/C/dg.exp5
-rw-r--r--test/LLVMC/C/emit-llvm-opt.c9
-rw-r--r--test/LLVMC/C/emit-llvm.c8
-rw-r--r--test/LLVMC/C/hello.c13
-rw-r--r--test/LLVMC/C/include.c10
-rw-r--r--test/LLVMC/C/opt-test.c13
-rw-r--r--test/LLVMC/C/sink.c13
-rw-r--r--test/LLVMC/C/wall.c13
-rw-r--r--test/LLVMC/EmptyCompilationGraph.td8
-rw-r--r--test/LLVMC/EnvParentheses.td18
-rw-r--r--test/LLVMC/ForwardAs.td21
-rw-r--r--test/LLVMC/ForwardTransformedValue.td27
-rw-r--r--test/LLVMC/ForwardValue.td24
-rw-r--r--test/LLVMC/HookWithArguments.td20
-rw-r--r--test/LLVMC/HookWithInFile.td16
-rw-r--r--test/LLVMC/Init.td25
-rw-r--r--test/LLVMC/LanguageMap.td29
-rw-r--r--test/LLVMC/MultiValuedOption.td24
-rw-r--r--test/LLVMC/MultipleCompilationGraphs.td10
-rw-r--r--test/LLVMC/MultipleOutputLanguages.td27
-rw-r--r--test/LLVMC/NoActions.td16
-rw-r--r--test/LLVMC/NoCompilationGraph.td6
-rw-r--r--test/LLVMC/ObjC++/dg.exp5
-rw-r--r--test/LLVMC/ObjC++/hello.mm8
-rw-r--r--test/LLVMC/ObjC/dg.exp5
-rw-r--r--test/LLVMC/ObjC/hello.m12
-rw-r--r--test/LLVMC/OneOrMore.td25
-rw-r--r--test/LLVMC/OptionPreprocessor.td67
-rw-r--r--test/LLVMC/OutputSuffixHook.td24
-rw-r--r--test/LLVMC/TestWarnings.td8
-rw-r--r--test/LLVMC/dg.exp3
-rw-r--r--test/LLVMC/test_data/false.c10
-rw-r--r--test/LLVMC/test_data/false.cpp16
-rw-r--r--test/LLVMC/test_data/false2.cpp5
-rw-r--r--test/LLVMC/test_data/together.c5
-rw-r--r--tools/Makefile2
-rw-r--r--tools/llvmc/CMakeLists.txt8
-rw-r--r--tools/llvmc/Makefile18
-rw-r--r--tools/llvmc/doc/LLVMC-Reference.rst747
-rw-r--r--tools/llvmc/doc/LLVMC-Tutorial.rst127
-rw-r--r--tools/llvmc/doc/Makefile33
-rw-r--r--tools/llvmc/doc/img/lines.gifbin91 -> 0 bytes
-rw-r--r--tools/llvmc/examples/CMakeLists.txt4
-rw-r--r--tools/llvmc/examples/Hello/CMakeLists.txt4
-rw-r--r--tools/llvmc/examples/Hello/Hello.cpp29
-rw-r--r--tools/llvmc/examples/Hello/Makefile14
-rw-r--r--tools/llvmc/examples/Makefile14
-rw-r--r--tools/llvmc/examples/Simple/CMakeLists.txt10
-rw-r--r--tools/llvmc/examples/Simple/Makefile15
-rw-r--r--tools/llvmc/examples/Simple/Simple.cpp2
-rw-r--r--tools/llvmc/examples/Simple/Simple.td41
-rw-r--r--tools/llvmc/examples/Skeleton/AutoGenerated.td7
-rw-r--r--tools/llvmc/examples/Skeleton/CMakeLists.txt11
-rw-r--r--tools/llvmc/examples/Skeleton/Hooks.cpp12
-rw-r--r--tools/llvmc/examples/Skeleton/Main.cpp15
-rw-r--r--tools/llvmc/examples/Skeleton/Makefile20
-rw-r--r--tools/llvmc/examples/Skeleton/README6
-rw-r--r--tools/llvmc/examples/mcc16/CMakeLists.txt11
-rw-r--r--tools/llvmc/examples/mcc16/Hooks.cpp112
-rw-r--r--tools/llvmc/examples/mcc16/Main.cpp57
-rw-r--r--tools/llvmc/examples/mcc16/Makefile15
-rw-r--r--tools/llvmc/examples/mcc16/PIC16.td234
-rw-r--r--tools/llvmc/examples/mcc16/README75
-rw-r--r--tools/llvmc/src/AutoGenerated.td17
-rw-r--r--tools/llvmc/src/Base.td.in461
-rw-r--r--tools/llvmc/src/CMakeLists.txt19
-rw-r--r--tools/llvmc/src/Clang.td87
-rw-r--r--tools/llvmc/src/Hooks.cpp193
-rw-r--r--tools/llvmc/src/Main.cpp16
-rw-r--r--tools/llvmc/src/Makefile14
82 files changed, 2 insertions, 3115 deletions
diff --git a/Makefile b/Makefile
index 88e63e9c02..610deba36b 100644
--- a/Makefile
+++ b/Makefile
@@ -187,8 +187,7 @@ FilesToConfig := \
include/llvm/Config/AsmPrinters.def \
include/llvm/Config/AsmParsers.def \
include/llvm/Config/Disassemblers.def \
- include/llvm/Support/DataTypes.h \
- tools/llvmc/src/Base.td
+ include/llvm/Support/DataTypes.h
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
all-local:: $(FilesToConfigPATH)
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 0883ed516d..027d020959 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1756,9 +1756,6 @@ if test -f ${srcdir}/tools/clang/README.txt; then
AC_CONFIG_FILES([tools/clang/docs/doxygen.cfg])
fi
-dnl Configure llvmc's Base plugin
-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/configure b/configure
index 4bbc446ab3..6fd7d999bc 100755
--- a/configure
+++ b/configure
@@ -21605,9 +21605,6 @@ if test -f ${srcdir}/tools/clang/README.txt; then
fi
-ac_config_files="$ac_config_files tools/llvmc/src/Base.td"
-
-
ac_config_files="$ac_config_files tools/llvm-config/llvm-config.in"
@@ -22227,7 +22224,6 @@ do
"llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;;
"docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;;
"tools/clang/docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES tools/clang/docs/doxygen.cfg" ;;
- "tools/llvmc/src/Base.td") CONFIG_FILES="$CONFIG_FILES tools/llvmc/src/Base.td" ;;
"tools/llvm-config/llvm-config.in") CONFIG_FILES="$CONFIG_FILES tools/llvm-config/llvm-config.in" ;;
"setup") CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;;
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
diff --git a/test/LLVMC/Alias.td b/test/LLVMC/Alias.td
deleted file mode 100644
index 5d37889304..0000000000
--- a/test/LLVMC/Alias.td
+++ /dev/null
@@ -1,24 +0,0 @@
-// Test alias generation.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[
-
-(switch_option "dummy1", (help "none")),
-// CHECK: cl::alias Alias_dummy2
-(alias_option "dummy2", "dummy1")
-]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy_lang"),
-(out_language "dummy_lang"),
-(actions (case
- (switch_on "dummy1"), (forward "dummy1")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/AppendCmdHook.td b/test/LLVMC/AppendCmdHook.td
deleted file mode 100644
index c85f002e6e..0000000000
--- a/test/LLVMC/AppendCmdHook.td
+++ /dev/null
@@ -1,29 +0,0 @@
-// Check that hooks can be invoked from 'append_cmd'.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-// CHECK: std::string MyHook()
-
-def OptList : OptionList<[
-(switch_option "dummy1", (help "none")),
-(switch_option "dummy2", (help "none"))
-]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy_lang"),
-(out_language "dummy_lang"),
-(actions (case
- // CHECK: , "-arg1"));
- // CHECK: , "-arg2"));
- (switch_on "dummy1"), (append_cmd "-arg1 -arg2"),
- // CHECK: , "-arg3"));
- // CHECK: hooks::MyHook()
- (switch_on "dummy2"), (append_cmd "-arg3 $CALL(MyHook)")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/C++/dash-x.cpp b/test/LLVMC/C++/dash-x.cpp
deleted file mode 100644
index 7d4cf19fa4..0000000000
--- a/test/LLVMC/C++/dash-x.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Test that we can compile .c files as C++ and vice versa
-// RUN: llvmc %s -x c++ %p/../test_data/false.c -x c %p/../test_data/false.cpp -x lisp -x whatnot -x none %p/../test_data/false2.cpp -o %t
-// RUN: %abs_tmp | grep hello
-// XFAIL: vg
-
-extern int test_main();
-
-int main() {
- test_main();
-}
diff --git a/test/LLVMC/C++/dg.exp b/test/LLVMC/C++/dg.exp
deleted file mode 100644
index 209345540c..0000000000
--- a/test/LLVMC/C++/dg.exp
+++ /dev/null
@@ -1,5 +0,0 @@
-load_lib llvm.exp
-
-if [ llvm_gcc_supports c++ ] then {
- RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{unk,ll,c,cpp}]]
-}
diff --git a/test/LLVMC/C++/filelist.cpp b/test/LLVMC/C++/filelist.cpp
deleted file mode 100644
index 6f5f6f7ae8..0000000000
--- a/test/LLVMC/C++/filelist.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// Test that the -filelist option works correctly with -linker=c++.
-// RUN: llvmc --dry-run -filelist DUMMY -linker c++ |& grep llvm-g++
-// XFAIL: vg
diff --git a/test/LLVMC/C++/hello.cpp b/test/LLVMC/C++/hello.cpp
deleted file mode 100644
index 8f38306e9e..0000000000
--- a/test/LLVMC/C++/hello.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// Test that we can compile C++ code.
-// RUN: llvmc %s -o %t
-// RUN: %abs_tmp | grep hello
-// XFAIL: vg
-#include <iostream>
-
-int main() {
- std::cout << "hello" << '\n';
-}
diff --git a/test/LLVMC/C++/just-compile.cpp b/test/LLVMC/C++/just-compile.cpp
deleted file mode 100644
index 771c9822da..0000000000
--- a/test/LLVMC/C++/just-compile.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Test that the -c flag works.
-// RUN: llvmc -c %s -o %t.o
-// RUN: llvmc --linker=c++ %t.o -o %t
-// RUN: %abs_tmp | grep hello
-// XFAIL: vg
-#include <iostream>
-
-int main() {
- std::cout << "hello" << '\n';
-}
diff --git a/test/LLVMC/C++/together.cpp b/test/LLVMC/C++/together.cpp
deleted file mode 100644
index 925215a4db..0000000000
--- a/test/LLVMC/C++/together.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Check that we can compile files of different types together.
-// RUN: llvmc %s %p/../test_data/together.c -o %t
-// RUN: %abs_tmp | grep hello
-// XFAIL: vg
-
-extern "C" void test();
-
-int main() {
- test();
-}
diff --git a/test/LLVMC/C++/unknown_suffix.unk b/test/LLVMC/C++/unknown_suffix.unk
deleted file mode 100644
index bf4aea2862..0000000000
--- a/test/LLVMC/C++/unknown_suffix.unk
+++ /dev/null
@@ -1,9 +0,0 @@
-// Test that the -x option works for files with unknown suffixes.
-// RUN: llvmc -x c++ %s -o %t
-// RUN: %abs_tmp | grep hello
-// XFAIL: vg
-#include <iostream>
-
-int main() {
- std::cout << "hello" << '\n';
-}
diff --git a/test/LLVMC/C/dg.exp b/test/LLVMC/C/dg.exp
deleted file mode 100644
index a9be28a63c..0000000000
--- a/test/LLVMC/C/dg.exp
+++ /dev/null
@@ -1,5 +0,0 @@
-load_lib llvm.exp
-
-if [ llvm_gcc_supports c ] then {
- RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
-}
diff --git a/test/LLVMC/C/emit-llvm-opt.c b/test/LLVMC/C/emit-llvm-opt.c
deleted file mode 100644
index 50710cf9db..0000000000
--- a/test/LLVMC/C/emit-llvm-opt.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// Check that -emit-llvm [-S] works with -opt.
-
-// RUN: llvmc -c -opt -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1
-// RUN: llvmc -c -opt -emit-llvm -S -o - %s | grep "@f0()" | count 1
-// RUN: llvmc --dry-run -c -opt -emit-llvm %s |& grep "^opt"
-// XFAIL: vg_leak
-
-int f0(void) {
-}
diff --git a/test/LLVMC/C/emit-llvm.c b/test/LLVMC/C/emit-llvm.c
deleted file mode 100644
index 56a1e30b2e..0000000000
--- a/test/LLVMC/C/emit-llvm.c
+++ /dev/null
@@ -1,8 +0,0 @@
-// Check that -emit-llvm [-S] works correctly.
-
-// RUN: llvmc -c -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1
-// RUN: llvmc -c -emit-llvm -S -o - %s | grep "@f0()" | count 1
-// XFAIL: vg_leak
-
-int f0(void) {
-}
diff --git a/test/LLVMC/C/hello.c b/test/LLVMC/C/hello.c
deleted file mode 100644
index 29ad39fd2c..0000000000
--- a/test/LLVMC/C/hello.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Check that we can compile helloworld
- * RUN: llvmc %s -o %t
- * RUN: %abs_tmp | grep hello
- * XFAIL: vg_leak
- */
-
-#include <stdio.h>
-
-int main() {
- printf("hello\n");
- return 0;
-}
diff --git a/test/LLVMC/C/include.c b/test/LLVMC/C/include.c
deleted file mode 100644
index 9c9530bfb4..0000000000
--- a/test/LLVMC/C/include.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Check that the 'include' options work.
- * RUN: echo "int x;\n" > %t1.inc
- * RUN: llvmc -include %t1.inc -fsyntax-only %s
- * XFAIL: vg_leak
- */
-
-int f0(void) {
- return x;
-}
diff --git a/test/LLVMC/C/opt-test.c b/test/LLVMC/C/opt-test.c
deleted file mode 100644
index 7924def203..0000000000
--- a/test/LLVMC/C/opt-test.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Check that the -opt switch works.
- * RUN: llvmc %s -opt -o %t
- * RUN: %abs_tmp | grep hello
- * XFAIL: vg_leak
- */
-
-#include <stdio.h>
-
-int main() {
- printf("hello\n");
- return 0;
-}
diff --git a/test/LLVMC/C/sink.c b/test/LLVMC/C/sink.c
deleted file mode 100644
index c4f9beba8c..0000000000
--- a/test/LLVMC/C/sink.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Check that the 'sink' options work.
- * RUN: llvmc -v -Wall %s -o %t |& grep "Wall"
- * RUN: %abs_tmp | grep hello
- * XFAIL: vg_leak
- */
-
-#include <stdio.h>
-
-int main() {
- printf("hello\n");
- return 0;
-}
diff --git a/test/LLVMC/C/wall.c b/test/LLVMC/C/wall.c
deleted file mode 100644
index 36813ba0f8..0000000000
--- a/test/LLVMC/C/wall.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Check that -Wall works as intended
- * RUN: llvmc -Wall %s -o %t
- * RUN: %abs_tmp | grep hello
- * XFAIL: vg_leak
- */
-
-#include <stdio.h>
-
-int main() {
- printf("hello\n");
- return 0;
-}
diff --git a/test/LLVMC/EmptyCompilationGraph.td b/test/LLVMC/EmptyCompilationGraph.td
deleted file mode 100644
index a52b8a8c19..0000000000
--- a/test/LLVMC/EmptyCompilationGraph.td
+++ /dev/null
@@ -1,8 +0,0 @@
-// Check that the compilation graph can be empty.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def Graph : CompilationGraph<[]>;
diff --git a/test/LLVMC/EnvParentheses.td b/test/LLVMC/EnvParentheses.td
deleted file mode 100644
index ce0cb82460..0000000000
--- a/test/LLVMC/EnvParentheses.td
+++ /dev/null
@@ -1,18 +0,0 @@
-// Check the fix for PR4157.
-// http://llvm.org/bugs/show_bug.cgi?id=4157
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: not grep {FOO")));} %t
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def dummy_tool : Tool<[
-(command "gcc $ENV(FOO)/bar"),
-(in_language "dummy"),
-(out_language "dummy")
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
-
-def Graph : CompilationGraph<[]>;
diff --git a/test/LLVMC/ForwardAs.td b/test/LLVMC/ForwardAs.td
deleted file mode 100644
index 99b240e30f..0000000000
--- a/test/LLVMC/ForwardAs.td
+++ /dev/null
@@ -1,21 +0,0 @@
-// Check the fix for PR4159.
-// http://llvm.org/bugs/show_bug.cgi?id=4159
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[(parameter_option "dummy", (help "dummmy"))]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy"),
-(actions (case
- // CHECK: "unique_name"));
- (not_empty "dummy"), (forward_as "dummy", "unique_name")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/ForwardTransformedValue.td b/test/LLVMC/ForwardTransformedValue.td
deleted file mode 100644
index 9184ede361..0000000000
--- a/test/LLVMC/ForwardTransformedValue.td
+++ /dev/null
@@ -1,27 +0,0 @@
-// Check that forward_transformed_value works.
-// The dummy tool and graph are required to silence warnings.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[(parameter_option "a", (help "dummy")),
- (prefix_list_option "b", (help "dummy"))]>;
-
-// CHECK: std::string HookA
-// CHECK: std::string HookB
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy"),
-(actions (case
- // CHECK: HookA(autogenerated::Parameter_a
- (not_empty "a"), (forward_transformed_value "a", "HookA"),
- // CHECK: HookB(autogenerated::List_b
- (not_empty "b"), (forward_transformed_value "b", "HookB")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/ForwardValue.td b/test/LLVMC/ForwardValue.td
deleted file mode 100644
index a42a3f06ec..0000000000
--- a/test/LLVMC/ForwardValue.td
+++ /dev/null
@@ -1,24 +0,0 @@
-// Check that forward_value works.
-// The dummy tool and graph are required to silence warnings.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[(parameter_option "a", (help "dummy")),
- (prefix_list_option "b", (help "dummy"))]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy"),
-(actions (case
- // CHECK: , autogenerated::Parameter_a));
- (not_empty "a"), (forward_value "a"),
- // CHECK: B = autogenerated::List_b.begin()
- (not_empty "b"), (forward_value "b")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/HookWithArguments.td b/test/LLVMC/HookWithArguments.td
deleted file mode 100644
index bbba2e9845..0000000000
--- a/test/LLVMC/HookWithArguments.td
+++ /dev/null
@@ -1,20 +0,0 @@
-// Check that hooks with arguments work.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-// CHECK: Hook(const char* Arg0, const char* Arg1, const char* Arg2);
-// CHECK: "/path"
-// CHECK: std::getenv("VARIABLE")
-// CHECK: "/2path"
-
-def dummy_tool : Tool<[
-(command "$CALL(Hook, 'Arg1', 'Arg2', 'Arg3 Arg3Cont')/path arg1 $ENV(VARIABLE)/2path arg2"),
-(in_language "dummy"),
-(out_language "dummy")
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/HookWithInFile.td b/test/LLVMC/HookWithInFile.td
deleted file mode 100644
index ed08b5321c..0000000000
--- a/test/LLVMC/HookWithInFile.td
+++ /dev/null
@@ -1,16 +0,0 @@
-// Check that a hook can be given $INFILE as an argument.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def dummy_tool : Tool<[
-// CHECK: Hook(inFile.c_str())
-(command "$CALL(Hook, '$INFILE')/path"),
-(in_language "dummy"),
-(out_language "dummy")
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/Init.td b/test/LLVMC/Init.td
deleted file mode 100644
index c384679702..0000000000
--- a/test/LLVMC/Init.td
+++ /dev/null
@@ -1,25 +0,0 @@
-// Check that (init true/false) and (init "str") work.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[
-// CHECK: cl::init(true)
-(switch_option "dummy1", (help "none"), (init true)),
-// CHECK: cl::init("some-string")
-(parameter_option "dummy2", (help "none"), (init "some-string"))
-]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy_lang"),
-(out_language "dummy_lang"),
-(actions (case
- (switch_on "dummy1"), (forward "dummy1"),
- (not_empty "dummy2"), (forward "dummy2")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/LanguageMap.td b/test/LLVMC/LanguageMap.td
deleted file mode 100644
index a0502142e6..0000000000
--- a/test/LLVMC/LanguageMap.td
+++ /dev/null
@@ -1,29 +0,0 @@
-// Check that LanguageMap is processed properly.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[
-(switch_option "dummy1", (help "none"))
-]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy_lang"),
-(out_language "dummy_lang"),
-(actions (case
- (switch_on "dummy1"), (forward "dummy1")))
-]>;
-
-def lang_map : LanguageMap<[
- // CHECK: langMap["dummy"] = "dummy_lang"
- // CHECK: langMap["DUM"] = "dummy_lang"
- (lang_to_suffixes "dummy_lang", ["dummy", "DUM"]),
- // CHECK: langMap["DUM2"] = "dummy_lang_2"
- (lang_to_suffixes "dummy_lang_2", "DUM2")
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/MultiValuedOption.td b/test/LLVMC/MultiValuedOption.td
deleted file mode 100644
index 08c753380d..0000000000
--- a/test/LLVMC/MultiValuedOption.td
+++ /dev/null
@@ -1,24 +0,0 @@
-// Check that multivalued options work.
-// The dummy tool and graph are required to silence warnings.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[
- // CHECK: cl::multi_val(2)
- (prefix_list_option "foo", (multi_val 2)),
- (parameter_list_option "baz", (multi_val 2))]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy"),
-(actions (case
- (not_empty "foo"), (forward_as "foo", "bar"),
- (not_empty "baz"), (forward "baz")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/MultipleCompilationGraphs.td b/test/LLVMC/MultipleCompilationGraphs.td
deleted file mode 100644
index b3746c03b6..0000000000
--- a/test/LLVMC/MultipleCompilationGraphs.td
+++ /dev/null
@@ -1,10 +0,0 @@
-// Check that multiple compilation graphs are allowed.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def Graph1 : CompilationGraph<[]>;
-def Graph2 : CompilationGraph<[]>;
-def Graph3 : CompilationGraph<[]>;
diff --git a/test/LLVMC/MultipleOutputLanguages.td b/test/LLVMC/MultipleOutputLanguages.td
deleted file mode 100644
index ae0c92eefc..0000000000
--- a/test/LLVMC/MultipleOutputLanguages.td
+++ /dev/null
@@ -1,27 +0,0 @@
-// Check that multiple output languages work.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def dummy_tool : Tool<[
- (command "dummy_cmd"),
- (in_language "dummy_lang"),
- (out_language "another_dummy_lang", "yet_another_dummy_lang")
-]>;
-
-def another_dummy_tool : Tool<[
- (command "another_dummy_cmd"),
- (in_language "another_dummy_lang", "some_other_dummy_lang"),
- (out_language "executable"),
- (join)
-]>;
-
-// CHECK: new SimpleEdge("dummy_tool")
-// CHECK: new SimpleEdge("another_dummy_tool")
-def DummyGraph : CompilationGraph<[
- (edge "root", "dummy_tool"),
- (edge "dummy_tool", "another_dummy_tool")
-]>;
diff --git a/test/LLVMC/NoActions.td b/test/LLVMC/NoActions.td
deleted file mode 100644
index 34b4440663..0000000000
--- a/test/LLVMC/NoActions.td
+++ /dev/null
@@ -1,16 +0,0 @@
-// Check that tools without associated actions are accepted.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-// CHECK: class dummy_tool : public Tool {
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy")
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/NoCompilationGraph.td b/test/LLVMC/NoCompilationGraph.td
deleted file mode 100644
index 4182882c45..0000000000
--- a/test/LLVMC/NoCompilationGraph.td
+++ /dev/null
@@ -1,6 +0,0 @@
-// Check that the compilation graph is not required.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
diff --git a/test/LLVMC/ObjC++/dg.exp b/test/LLVMC/ObjC++/dg.exp
deleted file mode 100644
index 41c3db2af0..0000000000
--- a/test/LLVMC/ObjC++/dg.exp
+++ /dev/null
@@ -1,5 +0,0 @@
-load_lib llvm.exp
-
-if [ llvm_gcc_supports obj-c++ ] then {
- RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{mm}]]
-}
diff --git a/test/LLVMC/ObjC++/hello.mm b/test/LLVMC/ObjC++/hello.mm
deleted file mode 100644
index 2125dc76b7..0000000000
--- a/test/LLVMC/ObjC++/hello.mm
+++ /dev/null
@@ -1,8 +0,0 @@
-// Test that we can compile Objective-C++ code.
-// RUN: llvmc %s -o %t
-// RUN: %abs_tmp | grep hello
-#include <iostream>
-
-int main() {
- std::cout << "hello" << '\n';
-}
diff --git a/test/LLVMC/ObjC/dg.exp b/test/LLVMC/ObjC/dg.exp
deleted file mode 100644
index 18f73a7978..0000000000
--- a/test/LLVMC/ObjC/dg.exp
+++ /dev/null
@@ -1,5 +0,0 @@
-load_lib llvm.exp
-
-if [ llvm_gcc_supports objc ] then {
- RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{m}]]
-}
diff --git a/test/LLVMC/ObjC/hello.m b/test/LLVMC/ObjC/hello.m
deleted file mode 100644
index b2d903f8d5..0000000000
--- a/test/LLVMC/ObjC/hello.m
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Check that we can compile helloworld
- * RUN: llvmc %s -o %t
- * RUN: %abs_tmp | grep hello
- */
-
-#include <stdio.h>
-
-int main() {
- printf("hello\n");
- return 0;
-}
diff --git a/test/LLVMC/OneOrMore.td b/test/LLVMC/OneOrMore.td
deleted file mode 100644
index 54fa62d1ff..0000000000
--- a/test/LLVMC/OneOrMore.td
+++ /dev/null
@@ -1,25 +0,0 @@
-// Check that (one_or_more) and (zero_or_one) properties work.
-// The dummy tool and graph are required to silence warnings.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[
- // CHECK: cl::OneOrMore
- (prefix_list_option "foo", (one_or_more)),
- // CHECK: cl::Optional
- (parameter_list_option "baz", (optional))]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy"),
-(actions (case
- (not_empty "foo"), (forward_as "foo", "bar"),
- (not_empty "baz"), (forward "baz")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/OptionPreprocessor.td b/test/LLVMC/OptionPreprocessor.td
deleted file mode 100644
index 5fdc35a187..0000000000
--- a/test/LLVMC/OptionPreprocessor.td
+++ /dev/null
@@ -1,67 +0,0 @@
-// Test for the OptionPreprocessor and related functionality.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[
-(switch_option "foo", (help "dummy")),
-(switch_option "bar", (help "dummy")),
-(switch_option "baz", (help "dummy")),
-(parameter_option "foo_p", (help "dummy")),
-(parameter_option "bar_p", (help "dummy")),
-(parameter_option "baz_p", (help "dummy")),
-(parameter_list_option "foo_l", (help "dummy"))
-]>;
-
-def Preprocess : OptionPreprocessor<
-(case
- // CHECK: W1
- // CHECK: foo = false;
- // CHECK: foo_p = "";
- // CHECK: foo_l.clear();
- (and (switch_on "foo"), (any_switch_on "bar", "baz")),
- [(warning "W1"), (unset_option "foo"),
- (unset_option "foo_p"), (unset_option "foo_l")],
- // CHECK: W2
- // CHECK: foo = true;
- // CHECK: bar = true;
- // CHECK: baz = false;
- // CHECK: foo_p = "asdf";
- // CHECK: foo_l.clear();
- // CHECK: foo_l.push_back("qwert");
- // CHECK: foo_l.push_back("yuiop");
- // CHECK: foo_l.push_back("asdf");
- (and (switch_on "foo", "bar"), (any_empty "foo_p", "bar_p")),
- [(warning "W2"), (set_option "foo"),
- (set_option "bar", true),
- (set_option "baz", false),
- (set_option "foo_p", "asdf"),
- (set_option "foo_l", ["qwert", "yuiop", "asdf"])],
- // CHECK: W3
- // CHECK: foo = true;
- // CHECK: bar = true;
- // CHECK: baz = true;
- (and (empty "foo_p", "bar_p"), (any_not_empty "baz_p")),
- [(warning "W3"), (set_option "foo", "bar", "baz")])
->;
-
-// Shut up warnings...
-def dummy : Tool<
-[(in_language "dummy"),
- (out_language "dummy"),
- (output_suffix "d"),
- (command "dummy"),
- (actions (case (switch_on "foo"), (error),
- (switch_on "bar"), (error),
- (switch_on "baz"), (error),
- (not_empty "foo_p"), (error),
- (not_empty "bar_p"), (error),
- (not_empty "baz_p"), (error),
- (not_empty "foo_l"), (error)))
-]>;
-
-def Graph : CompilationGraph<[(edge "root", "dummy")]>;
-
diff --git a/test/LLVMC/OutputSuffixHook.td b/test/LLVMC/OutputSuffixHook.td
deleted file mode 100644
index 1f5ecd1237..0000000000
--- a/test/LLVMC/OutputSuffixHook.td
+++ /dev/null
@@ -1,24 +0,0 @@
-// Check that hooks can be invoked from 'output_suffix'.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-// CHECK: std::string MyHook()
-
-def OptList : OptionList<[
-(switch_option "dummy1", (help "none"))
-]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy_lang"),
-(out_language "dummy_lang"),
-(actions (case
- // CHECK: hooks::MyHook()
- (switch_on "dummy1"), (output_suffix "$CALL(MyHook)")))
-]>;
-
-def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
diff --git a/test/LLVMC/TestWarnings.td b/test/LLVMC/TestWarnings.td
deleted file mode 100644
index b0f57e97e0..0000000000
--- a/test/LLVMC/TestWarnings.td
+++ /dev/null
@@ -1,8 +0,0 @@
-// Check that warnings about unused options are really emitted.
-// This should fail because the output is printed on stderr.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s |& grep "option '-Wall' has no effect!"
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-def OptList : OptionList<[(switch_option "Wall", (help "dummy"))]>;
diff --git a/test/LLVMC/dg.exp b/test/LLVMC/dg.exp
deleted file mode 100644
index f7d275ad8c..0000000000
--- a/test/LLVMC/dg.exp
+++ /dev/null
@@ -1,3 +0,0 @@
-load_lib llvm.exp
-
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{td}]]
diff --git a/test/LLVMC/test_data/false.c b/test/LLVMC/test_data/false.c
deleted file mode 100644
index 3e4e8a7e92..0000000000
--- a/test/LLVMC/test_data/false.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <iostream>
-
-extern "C" void test();
-extern std::string test2();
-
-int test_main() {
- std::cout << "h";
- test();
- std::cout << test2() << '\n';
-}
diff --git a/test/LLVMC/test_data/false.cpp b/test/LLVMC/test_data/false.cpp
deleted file mode 100644
index 593fcd5805..0000000000
--- a/test/LLVMC/test_data/false.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdio.h>
-
-/* Make this invalid C++ */
-typedef struct {
- int i;
- char c;
-} a;
-
-static a b = { .i = 65, .c = 'r'};
-
-void test() {
- b.i = 9;
- fflush(stdout);
- printf("el");
-}
-
diff --git a/test/LLVMC/test_data/false2.cpp b/test/LLVMC/test_data/false2.cpp
deleted file mode 100644
index bba064c8e0..0000000000
--- a/test/LLVMC/test_data/false2.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <string>
-
-std::string test2() {
- return "lo";
-}
diff --git a/test/LLVMC/test_data/together.c b/test/LLVMC/test_data/together.c
deleted file mode 100644
index a828c47577..0000000000
--- a/test/LLVMC/test_data/together.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdio.h>
-
-void test() {
- printf("hello\n");
-}
diff --git a/tools/Makefile b/tools/Makefile
index 478519864e..abb6e85dd3 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -25,7 +25,7 @@ PARALLEL_DIRS := opt llvm-as llvm-dis \
llvm-ld llvm-prof llvm-link \
lli llvm-extract llvm-mc \
bugpoint llvm-bcanalyzer llvm-stub \
- llvmc llvm-diff macho-dump llvm-objdump \
+ llvm-diff macho-dump llvm-objdump \
llvm-rtdyld llvm-dwarfdump
# Let users override the set of tools to build from the command line.
diff --git a/tools/llvmc/CMakeLists.txt b/tools/llvmc/CMakeLists.txt
deleted file mode 100644
index ff7cbae483..0000000000
--- a/tools/llvmc/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-add_subdirectory(src)
-
-# TODO: support plugins and user-configured builds.
-# See ./doc/LLVMC-Reference.rst "Customizing LLVMC: the compilation graph"
-
-if( LLVM_INCLUDE_EXAMPLES )
- add_subdirectory(examples)
-endif()
diff --git a/tools/llvmc/Makefile b/tools/llvmc/Makefile
deleted file mode 100644
index 7c03e2a74f..0000000000
--- a/tools/llvmc/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-##===- tools/llvmc/Makefile --------------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../..
-
-DIRS = src
-
-ifeq ($(BUILD_EXAMPLES),1)
- OPTIONAL_DIRS += examples
-endif
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/doc/LLVMC-Reference.rst b/tools/llvmc/doc/LLVMC-Reference.rst
deleted file mode 100644
index 041aedf9e1..0000000000
--- a/tools/llvmc/doc/LLVMC-Reference.rst
+++ /dev/null
@@ -1,747 +0,0 @@
-===================================
-Customizing LLVMC: Reference Manual
-===================================
-..
- This file was automatically generated by rst2html.
- Please do not edit directly!
- The ReST source lives in the directory 'tools/llvmc/doc'.
-
-.. contents::
-
-.. raw:: html
-
- <div class="doc_author">
- <p>Written by <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a></p>
- </div>
-
-Introduction
-============
-
-LLVMC is a generic compiler driver, designed to be customizable and
-extensible. It plays the same role for LLVM as the ``gcc`` program does for
-GCC - LLVMC's job is essentially to transform a set of input files into a set of
-targets depending on configuration rules and user options. What makes LLVMC
-different is that these transformation rules are completely customizable - in
-fact, LLVMC knows nothing about the specifics of transformation (even the
-command-line options are mostly not hard-coded) and regards the transformation
-structure as an abstract graph. The structure of this graph is described in
-high-level TableGen code, from which an efficient C++ representation is
-automatically derived. This makes it possible to adapt LLVMC for other
-purposes - for example, as a build tool for game resources.
-
-Because LLVMC employs TableGen_ as its configuration language, you
-need to be familiar with it to customize LLVMC.
-
-.. _TableGen: http://llvm.org/docs/TableGenFundamentals.html
-
-
-Compiling with ``llvmc``
-========================
-
-LLVMC tries hard to be as compatible with ``gcc`` as possible,
-although there are some small differences. Most of the time, however,
-you shouldn't be able to notice them::
-
- $ # This works as expected:
- $ llvmc -O3 -Wall hello.cpp
- $ ./a.out
- hello
-
-One nice feature of LLVMC is that one doesn't have to distinguish between
-different compilers for different languages (think ``g++`` vs. ``gcc``) - the
-right toolchain is chosen automatically based on input language names (which
-are, in turn, determined from file extensions). If you want to force files
-ending with ".c" to compile as C++, use the ``-x`` option, just like you would
-do it with ``gcc``::
-
- $ # hello.c is really a C++ file
- $ llvmc -x c++ hello.c
- $ ./a.out
- hello
-
-On the other hand, when using LLVMC as a linker to combine several C++
-object files you should provide the ``--linker`` option since it's
-impossible for LLVMC to choose the right linker in that case::
-
- $ llvmc -c hello.cpp
- $ llvmc hello.o
- [A lot of link-time errors skipped]
- $ llvmc --linker=c++ hello.o
- $ ./a.out
- hello
-
-By default, LLVMC uses ``llvm-gcc`` to compile the source code. It is also
-possible to choose the ``clang`` compiler with the ``-clang`` option.
-
-
-Predefined options
-==================
-
-LLVMC has some built-in options that can't be overridden in the TableGen code:
-
-* ``-o FILE`` - Output file name.
-
-* ``-x LANGUAGE`` - Specify the language of the following input files
- until the next -x option.
-
-* ``-v`` - Enable verbose mode, i.e. print out all executed commands.
-
-* ``--save-temps`` - Write temporary files to the current directory and do not
- delete them on exit. This option can also take an argument: the
- ``--save-temps=obj`` switch will write files into the directory specified with
- the ``-o`` option. The ``--save-temps=cwd`` and ``--save-temps`` switches are
- both synonyms for the default behaviour.
-
-* ``--temp-dir DIRECTORY`` - Store temporary files in the given directory. This
- directory is deleted on exit unless ``--save-temps`` is specified. If
- ``--save-temps=obj`` is also specified, ``--temp-dir`` is given the
- precedence.
-
-* ``--check-graph`` - Check the compilation for common errors like mismatched
- output/input language names, multiple default edges and cycles. Exit with code
- zero if no errors were found, and return the number of found errors
- otherwise. Hidden option, useful for debugging.
-
-* ``--view-graph`` - Show a graphical representation of the compilation graph
- and exit. Requires that you have ``dot`` and ``gv`` programs installed. Hidden
- option, useful for debugging.
-
-* ``--write-graph`` - Write a ``compilation-graph.dot`` file in the current
- directory with the compilation graph description in Graphviz format (identical
- to the file used by the ``--view-graph`` option). The ``-o`` option can be
- used to set the output file name. Hidden option, useful for debugging.
-
-* ``--help``, ``--help-hidden``, ``--version`` - These options have
- their standard meaning.
-
-Compiling LLVMC-based drivers
-=============================
-
-It's easiest to start working on your own LLVMC driver by copying the skeleton
-project which lives under ``$LLVMC_DIR/examples/Skeleton``::
-
- $ cd $LLVMC_DIR/examples
- $ cp -r Skeleton MyDriver
- $ cd MyDriver
- $ ls
- AutoGenerated.td Hooks.cpp Main.cpp Makefile
-
-As you can see, our basic driver consists of only three files (not counting the
-build script). ``AutoGenerated.td`` contains TableGen description of the
-compilation graph; its format is documented in the following
-sections. ``Hooks.cpp`` is an empty file that should be used for hook
-definitions (see `below`__). ``Main.cpp`` is just a helper used to compile the
-auto-generated C++ code produced from TableGen source.
-
-__ hooks_
-
-The first thing that you should do is to change the ``LLVMC_BASED_DRIVER``
-variable in the ``Makefile``::
-
- LLVMC_BASED_DRIVER=MyDriver
-
-It can also be a good idea to put your TableGen code into a file with a less
-generic name::
-
- $ touch MyDriver.td
- $ vim AutoGenerated.td
- [...]
- include "MyDriver.td"
-
-If you have more than one TableGen source file, they all should be included from
-``AutoGenerated.td``, since this file is used by the build system to generate
-C++ code.
-
-To build your driver, just ``cd`` to its source directory and run ``make``. The
-resulting executable will be put into ``$LLVM_OBJ_DIR/$(BuildMode)/bin``.
-
-If you're compiling LLVM with different source and object directories, then you
-must perform the following additional steps before running ``make``::
-
- # LLVMC_SRC_DIR = $LLVM_SRC_DIR/tools/llvmc/
- # LLVMC_OBJ_DIR = $LLVM_OBJ_DIR/tools/llvmc/
- $ mkdir $LLVMC_OBJ_DIR/examples/MyDriver/
- $ cp $LLVMC_SRC_DIR/examples/MyDriver/Makefile \
- $LLVMC_OBJ_DIR/examples/MyDriver/
- $ cd $LLVMC_OBJ_DIR/examples/MyDriver
- $ make
-
-
-Customizing LLVMC: the compilation graph
-========================================
-
-Each TableGen configuration file should include the common definitions::
-
- include "llvm/CompilerDriver/Common.td"
-
-Internally, LLVMC stores information about possible source transformations in
-form of a graph. Nodes in this graph represent tools, and edges between two
-nodes represent a transformation path. A special "root" node is used to mark
-entry points for the transformations. LLVMC also assigns a weight to each edge
-(more on this later) to choose between several alternative edges.
-
-The definition of the compilation graph (see file ``llvmc/src/Base.td`` for an
-example) is just a list of edges::
-
- def CompilationGraph : CompilationGraph<[
- Edge<"root", "llvm_gcc_c">,
- Edge<"root", "llvm_gcc_assembler">,
- ...
-
- Edge<"llvm_gcc_c", "llc">,
- Edge<"llvm_gcc_cpp", "llc">,
- ...
-
- 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_assembler", "llvm_gcc_cpp_linker",
- (case (input_languages_contain "c++"), (inc_weight),
- (or (parameter_equals "linker", "g++"),
- (parameter_equals "linker", "c++")), (inc_weight))>,
- ...
-
- ]>;
-
-As you can see, the edges can be either default or optional, where optional
-edges are differentiated by an additional ``case`` expression used to calculate
-the weight of this edge. Notice also that we refer to tools via their names (as
-strings). This makes it possible to add edges to an existing compilation graph
-without having to know about all tool definitions used in the graph.
-
-The default edges are assigned a weight of 1, and optional edges get a weight of
-0 + 2*N where N is the number of tests that evaluated to true in the ``case``
-expression. It is also possible to provide an integer parameter to
-``inc_weight`` and ``dec_weight`` - in this case, the weight is increased (or
-decreased) by the provided value instead of the default 2. Default weight of an
-optional edge can be changed by using the ``default`` clause of the ``case``
-construct.
-
-When passing an input file through the graph, LLVMC picks the edge with the
-maximum weight. To avoid ambiguity, there should be only one default edge
-between two nodes (with the exception of the root node, which gets a special
-treatment - there you are allowed to specify one default edge *per language*).
-
-When multiple compilation graphs are defined, they are merged together. Multiple
-edges with the same end nodes are not allowed (i.e. the graph is not a
-multigraph), and will lead to a compile-time error.
-
-To get a visual representation of the compilation graph (useful for debugging),
-run ``llvmc --view-graph``. You will need ``dot`` and ``gsview`` installed for
-this to work properly.
-
-Describing options
-==================
-
-Command-line options supported by the driver are defined by using an
-``OptionList``::
-
- def Options : OptionList<[
- (switch_option "E", (help "Help string")),
- (alias_option "quiet", "q")
- ...
- ]>;
-
-As you can see, the option list is just a list of DAGs, where each DAG is an
-option description consisting of the option name and some properties. More than
-one option list can be defined (they are all merged together in the end), which
-can be handy if one wants to separate option groups syntactically.
-
-* Possible option types:
-
- - ``switch_option`` - a simple boolean switch without arguments, for example
- ``-O2`` or ``-time``. At most one occurrence is allowed by default.
-
- - ``parameter_option`` - option that takes one argument, for example
- ``-std=c99``. It is also allowed to use spaces instead of the equality
- sign: ``-std c99``. At most one occurrence is allowed.
-
- - ``parameter_list_option`` - same as the above, but more than one option
- occurrence is allowed.
-
- - ``prefix_option`` - same as the parameter_option, but the option name and
- argument do not have to be separated. Example: ``-ofile``. This can be also
- specified as ``-o file``; however, ``-o=file`` will be parsed incorrectly
- (``=file`` will be interpreted as option value). At most one occurrence is
- allowed.
-
- - ``prefix_list_option`` - same as the above, but more than one occurrence of
- the option is allowed; example: ``-lm -lpthread``.
-
- - ``alias_option`` - a special option type for creating aliases. Unlike other
- option types, aliases are not allowed to have any properties besides the
- aliased option name.
- Usage example: ``(alias_option "preprocess", "E")``
-
- - ``switch_list_option`` - like ``switch_option`` with the ``zero_or_more``
- property, but remembers how many times the switch was turned on. Useful
- mostly for forwarding. Example: when ``-foo`` is a switch option (with the
- ``zero_or_more`` property), the command ``driver -foo -foo`` is forwarded
- as ``some-tool -foo``, but when ``-foo`` is a switch list, the same command
- is forwarded as ``some-tool -foo -foo``.
-
-
-* Possible option properties:
-
- - ``help`` - help string associated with this option. Used for ``--help``
- output.
-
- - ``required`` - this option must be specified exactly once (or, in case of
- the list options without the ``multi_val`` property, at least
- once). Incompatible with ``optional`` and ``one_or_more``.
-
- - ``optional`` - the option can be specified either zero times or exactly
- once. The default for switch options. Useful only for list options in
- conjunction with ``multi_val``. Incompatible with ``required``,
- ``zero_or_more`` and ``one_or_more``.
-
- - ``one_or_more`` - the option must be specified at least once. Can be useful
- to allow switch options be both obligatory and be specified multiple
- times. For list options is useful only in conjunction with ``multi_val``;
- for ordinary it is synonymous with ``required``. Incompatible with
- ``required``, ``optional`` and ``zero_or_more``.
-
- - ``zero_or_more`` - the option can be specified zero or more times. Useful
- to allow a single switch option to be specified more than
- once. Incompatible with ``required``, ``optional`` and ``one_or_more``.
-
- - ``hidden`` - the description of this option will not appear in
- the ``--help`` output (but will appear in the ``--help-hidden``
- output).
-
- - ``really_hidden`` - the option will not be mentioned in any help
- output.
-
- - ``comma_separated`` - Indicates that any commas specified for an option's
- value should be used to split the value up into multiple values for the
- option. This property is valid only for list options. In conjunction with
- ``forward_value`` can be used to implement option forwarding in style of
- gcc's ``-Wa,``.
-
- - ``multi_val n`` - this option takes *n* arguments (can be useful in some
- special cases). Usage example: ``(parameter_list_option "foo", (multi_val
- 3))``; the command-line syntax is '-foo a b c'. Only list options can have
- this attribute; you can, however, use the ``one_or_more``, ``optional``
- and ``required`` properties.
-
- - ``init`` - this option has a default value, either a string (if it is a
- parameter), or a boolean (if it is a switch; as in C++, boolean constants
- are called ``true`` and ``false``). List options can't have ``init``
- attribute.
- Usage examples: ``(switch_option "foo", (init true))``; ``(prefix_option
- "bar", (init "baz"))``.
-
-.. _case:
-
-Conditional evaluation
-======================
-
-The 'case' construct is the main means by which programmability is achieved in
-LLVMC. It can be used to calculate edge weights, program actions and modify the
-shell commands to be executed. The 'case' expression is designed after the
-similarly-named construct in functional languages and takes the form ``(case
-(test_1), statement_1, (test_2), statement_2, ... (test_N), statement_N)``. The
-statements are evaluated only if the corresponding tests evaluate to true.
-
-Examples::
-
- // Edge weight calculation
-
- // Increases edge weight by 5 if "-A" is provided on the
- // command-line, and by 5 more if "-B" is also provided.
- (case
- (switch_on "A"), (inc_weight 5),
- (switch_on "B"), (inc_weight 5))
-
-
- // Tool command line specification
-
- // Evaluates to "cmdline1" if the option "-A" is provided on the
- // command line; to "cmdline2" if "-B" is provided;
- // otherwise to "cmdline3".
-
- (case
- (switch_on "A"), "cmdline1",
- (switch_on "B"), "cmdline2",
- (default), "cmdline3")
-
-Note the slight difference in 'case' expression handling in contexts of edge
-weights and command line specification - in the second example the value of the
-``"B"`` switch is never checked when switch ``"A"`` is enabled, and the whole
-expression always evaluates to ``"cmdline1"`` in that case.
-
-Case expressions can also be nested, i.e. the following is legal::
-
- (case (switch_on "E"), (case (switch_on "o"), ..., (default), ...)
- (default), ...)
-
-You should, however, try to avoid doing that because it hurts readability. It is
-usually better to split tool descriptions and/or use TableGen inheritance
-instead.
-
-* Possible tests are:
-
- - ``switch_on`` - Returns true if a given command-line switch is provided by
- the user. Can be given multiple arguments, in that case ``(switch_on "foo",
- "bar", "baz")`` is equivalent to ``(and (switch_on "foo"), (switch_on
- "bar"), (switch_on "baz"))``.
- Example: ``(switch_on "opt")``.
-
- - ``any_switch_on`` - Given a number of switch options, returns true if any of
- the switches is turned on.
- Example: ``(any_switch_on "foo", "bar", "baz")`` is equivalent to ``(or
- (switch_on "foo"), (switch_on "bar"), (switch_on "baz"))``.
-
- - ``parameter_equals`` - Returns true if a command-line parameter (first
- argument) equals a given value (second argument).
- Example: ``(parameter_equals "W", "all")``.
-
- - ``element_in_list`` - Returns true if a command-line parameter list (first
- argument) contains a given value (second argument).
- Example: ``(element_in_list "l", "pthread")``.
-
- - ``input_languages_contain`` - Returns true if a given language
- belongs to the current input language set.
- Example: ``(input_languages_contain "c++")``.
-
- - ``in_language`` - Evaluates to true if the input file language is equal to
- the argument. At the moment works only with ``command`` and ``actions`` (on
- non-join nodes).
- Example: ``(in_language "c++")``.
-
- - ``not_empty`` - Returns true if a given option (which should be either a
- parameter or a parameter list) is set by the user. Like ``switch_on``, can
- be also given multiple arguments.
- Examples: ``(not_empty "o")``, ``(not_empty "o", "l")``.
-
- - ``any_not_empty`` - Returns true if ``not_empty`` returns true for any of
- the provided options.
- Example: ``(any_not_empty "foo", "bar", "baz")`` is equivalent to ``(or
- (not_empty "foo"), (not_empty "bar"), (not_empty "baz"))``.
-
- - ``empty`` - The opposite of ``not_empty``. Equivalent to ``(not (not_empty
- X))``. Can be given multiple arguments.
-
- - ``any_not_empty`` - Returns true if ``not_empty`` returns true for any of
- the provided options.
- Example: ``(any_empty "foo", "bar", "baz")`` is equivalent to ``(or
- (not_empty "foo"), (not_empty "bar"), (not_empty "baz"))``.
-
- - ``single_input_file`` - Returns true if there was only one input file
- provided on the command-line. Used without arguments:
- ``(single_input_file)``.
-
- - ``multiple_input_files`` - Equivalent to ``(not (single_input_file))`` (the
- case of zero input files is considered an error).
-
- - ``default`` - Always evaluates to true. Should always be the last
- test in the ``case`` expression.
-
- - ``and`` - A standard logical combinator that returns true iff all of
- its arguments return true. Used like this: ``(and (test1), (test2),
- ... (testN))``. Nesting of ``and`` and ``or`` is allowed, but not
- encouraged.
-
- - ``or`` - A logical combinator that returns true iff any of its arguments
- return true.
- Example: ``(or (test1), (test2), ... (testN))``.
-
- - ``not`` - Standard unary logical combinator that negates its
- argument.
- Example: ``(not (or (test1), (test2), ... (testN)))``.
-
-
-Writing a tool description
-==========================
-
-As was said earlier, nodes in the compilation graph represent tools, which are
-described separately. A tool definition looks like this (taken from the
-``llvmc/src/Base.td`` file)::
-
- def llvm_gcc_cpp : Tool<[
- (in_language "c++"),
- (out_language "llvm-assembler"),
- (output_suffix "bc"),
- (command "llvm-g++ -c -emit-llvm"),
- (sink)
- ]>;
-
-This defines a new tool called ``llvm_gcc_cpp``, which is an alias for
-``llvm-g++``. As you can see, a tool definition is just a list of properties;
-most of them should be self-explanatory. The ``sink`` property means that this
-tool should be passed all command-line options that aren't mentioned in the
-option list.
-
-The complete list of all currently implemented tool properties follows.
-
-* Possible tool properties:
-
- - ``in_language`` - input language name. Can be given multiple arguments, in
- case the tool supports multiple input languages. Used for typechecking and
- mapping file extensions to tools.
-
- - ``out_language`` - output language name. Multiple output languages are
- allowed. Used for typechecking the compilation graph.
-
- - ``output_suffix`` - output file suffix. Can also be changed dynamically, see
- documentation on `actions`__.
-
-__ actions_
-
- - ``command`` - the actual command used to run the tool. You can use output
- redirection with ``>``, hook invocations (``$CALL``), environment variables
- (via ``$ENV``) and the ``case`` construct.
-
- - ``join`` - this tool is a "join node" in the graph, i.e. it gets a list of
- input files and joins them together. Used for linkers.
-
- - ``sink`` - all command-line options that are not handled by other tools are
- passed to this tool.
-
- - ``actions`` - A single big ``case`` expression that specifies how this tool
- reacts on command-line options (described in more detail `below`__).
-
-__ actions_
-
- - ``out_file_option``, ``in_file_option`` - Options appended to the
- ``command`` string to designate output and input files. Default values are
- ``"-o"`` and ``""``, respectively.
-
-.. _actions:
-
-Actions
--------
-
-A tool often needs to react to command-line options, and this is precisely what
-the ``actions`` property is for. The next example illustrates this feature::
-
- def llvm_gcc_linker : Tool<[
- (in_language "object-code"),
- (out_language "executable"),
- (output_suffix "out"),
- (command "llvm-gcc"),
- (join),
- (actions (case (not_empty "L"), (forward "L"),
- (not_empty "l"), (forward "l"),
- (not_empty "dummy"),
- [(append_cmd "-dummy1"), (append_cmd "-dummy2")])
- ]>;
-
-The ``actions`` tool property is implemented on top of the omnipresent ``case``
-expression. It associates one or more different *actions* with given
-conditions - in the example, the actions are ``forward``, which forwards a given
-option unchanged, and ``append_cmd``, which appends a given string to the tool
-execution command. Multiple actions can be associated with a single condition by
-using a list of actions (used in the example to append some dummy options). The
-same ``case`` construct can also be used in the ``cmd_line`` property to modify
-the tool command line.
-
-The "join" property used in the example means that this tool behaves like a
-linker.
-
-The list of all possible actions follows.
-
-* Possible actions:
-
- - ``append_cmd`` - Append a string to the tool invocation command.
- Example: ``(case (switch_on "pthread"), (append_cmd "-lpthread"))``.
-
- - ``error`` - Exit with error.
- Example: ``(error "Mixing -c and -S is not allowed!")``.
-
- - ``warning`` - Print a warning.
- Example: ``(warning "Specifying both -O1 and -O2 is meaningless!")``.
-
- - ``forward`` - Forward the option unchanged.
- Example: ``(forward "Wall")``.
-
- - ``forward_as`` - Change the option's name, but forward the argument
- unchanged.
- Example: ``(forward_as "O0", "--disable-optimization")``.
-
- - ``forward_value`` - Forward only option's value. Cannot be used with switch
- options (since they don't have values), but works fine with lists.
- Example: ``(forward_value "Wa,")``.
-
- - ``forward_transformed_value`` - As above, but applies a hook to the
- option's value before forwarding (see `below`__). When
- ``forward_transformed_value`` is applied to a list
- option, the hook must have signature
- ``std::string hooks::HookName (const std::vector<std::string>&)``.
- Example: ``(forward_transformed_value "m", "ConvertToMAttr")``.
-
- __ hooks_
-
- - ``output_suffix`` - Modify the output suffix of this tool.
- Example: ``(output_suffix "i")``.
-
- - ``stop_compilation`` - Stop compilation after this tool processes its
- input. Used without arguments.
- Example: ``(stop_compilation)``.
-
-
-Language map
-============
-
-If you are adding support for a new language to LLVMC, you'll need to modify the
-language map, which defines mappings from file extensions to language names. It
-is used to choose the proper toolchain(s) for a given input file set. Language
-map definition looks like this::
-
- def LanguageMap : LanguageMap<
- [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
- LangToSuffixes<"c", ["c"]>,
- ...
- ]>;
-
-For example, without those definitions the following command wouldn't work::
-
- $ llvmc hello.cpp
- llvmc: Unknown suffix: cpp
-
-The language map entries are needed only for the tools that are linked from the
-root node. A tool can have multiple output languages.
-
-Option preprocessor
-===================
-
-It is sometimes useful to run error-checking code before processing the
-compilation graph. For example, if optimization options "-O1" and "-O2" are
-implemented as switches, we might want to output a warning if the user invokes
-the driver with both of these options enabled.
-
-The ``OptionPreprocessor`` feature is reserved specially for these
-occasions. Example (adapted from ``llvm/src/Base.td.in``)::
-
-
- 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"),
- (and (switch_on "O1"), (switch_on "O0")),
- (unset_option "O0"))
- >;
-
-Here, ``OptionPreprocessor`` is used to unset all spurious ``-O`` options so
-that they are not forwarded to the compiler. If no optimization options are
-specified, ``-O2`` is enabled.
-
-``OptionPreprocessor`` is basically a single big ``case`` expression, which is
-evaluated only once right after the driver is started. The only allowed actions
-in ``OptionPreprocessor`` are ``error``, ``warning``, and two special actions:
-``unset_option`` and ``set_option``. As their names suggest, they can be used to
-set or unset a given option. To set an option with ``set_option``, use the
-two-argument form: ``(set_option "parameter", VALUE)``. Here, ``VALUE`` can be
-either a string, a string list, or a boolean constant.
-
-For convenience, ``set_option`` and ``unset_option`` also work with multiple
-arguments. That is, instead of ``[(unset_option "A"), (unset_option "B")]`` you
-can use ``(unset_option "A", "B")``. Obviously, ``(set_option "A", "B")`` is
-only valid if both ``A`` and ``B`` are switches.
-
-
-More advanced topics
-====================
-
-.. _hooks:
-
-Hooks and environment variables
--------------------------------
-
-Normally, LLVMC searches for programs in the system ``PATH``. Sometimes, this is
-not sufficient: for example, we may want to specify tool paths or names in the
-configuration file. This can be achieved via the hooks mechanism. To write your
-own hooks, add their definitions to the ``Hooks.cpp`` or drop a ``.cpp`` file
-into your driver directory. Hooks should live in the ``hooks`` namespace and
-have the signature ``std::string hooks::MyHookName ([const char* Arg0 [ const
-char* Arg2 [, ...]]])``. They can be used from the ``command`` tool property::
-
- (command "$CALL(MyHook)/path/to/file -o $CALL(AnotherHook)")
-
-To pass arguments to hooks, use the following syntax::
-
- (command "$CALL(MyHook, 'Arg1', 'Arg2', 'Arg # 3')/path/to/file -o1 -o2")
-
-It is also possible to use environment variables in the same manner::
-
- (command "$ENV(VAR1)/path/to/file -o $ENV(VAR2)")
-
-To change the command line string based on user-provided options use
-the ``case`` expression (documented `above`__)::
-
- (command
- (case
- (switch_on "E"),
- "llvm-g++ -E -x c $INFILE -o $OUTFILE",
- (default),
- "llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm"))
-
-__ case_
-
-Debugging
----------
-
-When writing LLVMC-based drivers, it can be useful to get a visual view of the
-resulting compilation graph. This can be achieved via the command line option
-``--view-graph`` (which assumes that Graphviz_ and Ghostview_ are
-installed). There is also a ``--write-graph`` option that creates a Graphviz
-source file (``compilation-graph.dot``) in the current directory.
-
-Another useful ``llvmc`` option is ``--check-graph``. It checks the compilation
-graph for common errors like mismatched output/input language names, multiple
-default edges and cycles. When invoked with ``--check-graph``, ``llvmc`` doesn't
-perform any compilation tasks and returns the number of encountered errors as
-its status code. In the future, these checks will be performed at compile-time
-and this option will disappear.
-
-.. _Graphviz: http://www.graphviz.org/
-.. _Ghostview: http://pages.cs.wisc.edu/~ghost/
-
-Conditioning on the executable name
------------------------------------
-
-For now, the executable name (the value passed to the driver in ``argv[0]``) is
-accessible only in the C++ code (i.e. hooks). Use the following code::
-
- namespace llvmc {
- extern const char* ProgramName;
- }
-
- namespace hooks {
-
- std::string MyHook() {
- //...
- if (strcmp(ProgramName, "mydriver") == 0) {
- //...
-
- }
-
- } // end namespace hooks
-
-In general, you're encouraged not to make the behaviour dependent on the
-executable file name, and use command-line switches instead. See for example how
-the ``llvmc`` program behaves when it needs to choose the correct linker options
-(think ``g++`` vs. ``gcc``).
-
-.. raw:: html
-
- <hr />
- <address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer">
- <img src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
- alt="Valid CSS" /></a>
- <a href="http://validator.w3.org/check?uri=referer">
- <img src="http://www.w3.org/Icons/valid-xhtml10-blue"
- alt="Valid XHTML 1.0 Transitional"/></a>
-
- <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a><br />
- <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br />
-
- Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $
- </address>
diff --git a/tools/llvmc/doc/LLVMC-Tutorial.rst b/tools/llvmc/doc/LLVMC-Tutorial.rst
deleted file mode 100644
index fc4c12408c..0000000000
--- a/tools/llvmc/doc/LLVMC-Tutorial.rst
+++ /dev/null
@@ -1,127 +0,0 @@
-======================
-Tutorial - Using LLVMC
-======================
-..
- This file was automatically generated by rst2html.
- Please do not edit directly!
- The ReST source lives in the directory 'tools/llvmc/doc'.
-
-.. contents::
-
-.. raw:: html
-
- <div class="doc_author">
- <p>Written by <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a></p>
- </div>
-
-Introduction
-============
-
-LLVMC is a generic compiler driver, which plays the same role for LLVM as the
-``gcc`` program does for GCC - the difference being that LLVMC is designed to be
-more adaptable and easier to customize. Most of LLVMC functionality is
-implemented via high-level TableGen code, from which a corresponding C++ source
-file is automatically generated. This tutorial describes the basic usage and
-configuration of LLVMC.
-
-
-Using the ``llvmc`` program
-===========================
-
-In general, ``llvmc`` tries to be command-line compatible with ``gcc`` as much
-as possible, so most of the familiar options work::
-
- $ llvmc -O3 -Wall hello.cpp
- $ ./a.out
- hello
-
-This will invoke ``llvm-g++`` under the hood (you can see which commands are
-executed by using the ``-v`` option). For further help on command-line LLVMC
-usage, refer to the ``llvmc --help`` output.
-
-
-Using LLVMC to generate toolchain drivers
-=========================================
-
-LLVMC-based drivers are written mostly using TableGen_, so you need to be
-familiar with it to get anything done.
-
-.. _TableGen: http://llvm.org/docs/TableGenFundamentals.html
-
-Start by compiling ``example/Simple``, which is a primitive wrapper for
-``gcc``::
-
- $ cd $LLVM_OBJ_DIR/tools/examples/Simple
- $ make
- $ cat > hello.c
- #include <stdio.h>
- int main() { printf("Hello\n"); }
- $ $LLVM_BIN_DIR/Simple -v hello.c
- gcc hello.c -o hello.out
- $ ./hello.out
- Hello
-
-We have thus produced a simple driver called, appropriately, ``Simple``, from
-the input TableGen file ``Simple.td``. The ``llvmc`` program itself is generated
-using a similar process (see ``llvmc/src``). Contents of the file ``Simple.td``
-look like this::
-
- // Include common definitions
- include "llvm/CompilerDriver/Common.td"
-
- // Tool descriptions
- def gcc : Tool<
- [(in_language "c"),
- (out_language "executable"),
- (output_suffix "out"),
- (command "gcc"),
- (sink),
-
- // -o is what is used by default, out_file_option here is included for
- // instructive purposes.
- (out_file_option "-o")
- ]>;
-
- // Language map
- def LanguageMap : LanguageMap<[(lang_to_suffixes "c", "c")]>;
-
- // Compilation graph
- def CompilationGraph : CompilationGraph<[(edge "root", "gcc")]>;
-
-As you can see, this file consists of three parts: tool descriptions, language
-map, and the compilation graph definition.
-
-At the heart of LLVMC is the idea of a compilation graph: vertices in this graph
-are tools, and edges represent a transformation path between two tools (for
-example, assembly source produced by the compiler can be transformed into
-executable code by an assembler). The compilation graph is basically a list of
-edges; a special node named ``root`` is used to mark graph entry points.
-
-Tool descriptions are represented as property lists: most properties in the
-example above should be self-explanatory; the ``sink`` property means that all
-options lacking an explicit description should be forwarded to this tool.
-
-The ``LanguageMap`` associates a language name with a list of suffixes and is
-used for deciding which toolchain corresponds to a given input file.
-
-To learn more about writing your own drivers with LLVMC, refer to the reference
-manual and examples in the ``examples`` directory. Of a particular interest is
-the ``Skeleton`` example, which can serve as a template for your LLVMC-based
-drivers.
-
-.. raw:: html
-
- <hr />
- <address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer">
- <img src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
- alt="Valid CSS" /></a>
- <a href="http://validator.w3.org/check?uri=referer">
- <img src="http://www.w3.org/Icons/valid-xhtml10-blue"
- alt="Valid XHTML 1.0 Transitional"/></a>
-
- <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a><br />
- <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br />
-
- Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $
- </address>
diff --git a/tools/llvmc/doc/Makefile b/tools/llvmc/doc/Makefile
deleted file mode 100644
index ef98767e7b..0000000000
--- a/tools/llvmc/doc/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-##===- tools/llvmc/doc/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 (,$(strip $(wildcard $(LEVEL)/Makefile.config)))
-include $(LEVEL)/Makefile.config
-else
-CP=cp
-RM=rm
-endif
-
-DOC_DIR=../../../docs
-RST2HTML=rst2html --stylesheet=llvm.css --link-stylesheet
-
-all : LLVMC-Reference.html LLVMC-Tutorial.html
- $(CP) LLVMC-Reference.html $(DOC_DIR)/CompilerDriver.html
- $(CP) LLVMC-Tutorial.html $(DOC_DIR)/CompilerDriverTutorial.html
-
-LLVMC-Tutorial.html : LLVMC-Tutorial.rst
- $(RST2HTML) $< $@
-
-LLVMC-Reference.html : LLVMC-Reference.rst
- $(RST2HTML) $< $@
-
-clean :
- $(RM) LLVMC-Tutorial.html LLVMC-Reference.html
diff --git a/tools/llvmc/doc/img/lines.gif b/tools/llvmc/doc/img/lines.gif
deleted file mode 100644
index 88f491edc3..0000000000
--- a/tools/llvmc/doc/img/lines.gif
+++ /dev/null
Binary files differ
diff --git a/tools/llvmc/examples/CMakeLists.txt b/tools/llvmc/examples/CMakeLists.txt
deleted file mode 100644
index 2ad8aa4dc4..0000000000
--- a/tools/llvmc/examples/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_subdirectory(Hello)
-add_subdirectory(Simple)
-add_subdirectory(mcc16)
-add_subdirectory(Skeleton)
diff --git a/tools/llvmc/examples/Hello/CMakeLists.txt b/tools/llvmc/examples/Hello/CMakeLists.txt
deleted file mode 100644
index 5679924bdb..0000000000
--- a/tools/llvmc/examples/Hello/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-set(LLVM_USED_LIBS CompilerDriver)
-set(LLVM_LINK_COMPONENTS support)
-
-add_llvm_example(Hello Hello.cpp)
diff --git a/tools/llvmc/examples/Hello/Hello.cpp b/tools/llvmc/examples/Hello/Hello.cpp
deleted file mode 100644
index 71f04fdd49..0000000000
--- a/tools/llvmc/examples/Hello/Hello.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Shows how to write llvmc-based drivers without using TableGen.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/AutoGenerated.h"
-#include "llvm/CompilerDriver/Main.inc"
-
-#include "llvm/Support/raw_ostream.h"
-
-namespace llvmc {
-namespace autogenerated {
-
-int PreprocessOptions () { return 0; }
-
-int PopulateLanguageMap (LanguageMap&) { llvm::outs() << "Hello!\n"; return 0; }
-
-int PopulateCompilationGraph (CompilationGraph&) { return 0; }
-
-}
-}
diff --git a/tools/llvmc/examples/Hello/Makefile b/tools/llvmc/examples/Hello/Makefile
deleted file mode 100644
index c281be655d..0000000000
--- a/tools/llvmc/examples/Hello/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-##===- tools/llvmc/examples/Hello/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 = Hello
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/examples/Makefile b/tools/llvmc/examples/Makefile
deleted file mode 100644
index 8468e93104..0000000000
--- a/tools/llvmc/examples/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-##===- tools/llvmc/examples/Makefile -----------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL=../../..
-
-PARALLEL_DIRS := Hello Simple mcc16 Skeleton
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/examples/Simple/CMakeLists.txt b/tools/llvmc/examples/Simple/CMakeLists.txt
deleted file mode 100644
index 8a401ea42a..0000000000
--- a/tools/llvmc/examples/Simple/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-set(LLVM_TARGET_DEFINITIONS Simple.td)
-
-tablegen(Simple.inc -gen-llvmc)
-
-set(LLVM_USED_LIBS CompilerDriver)
-set(LLVM_LINK_COMPONENTS support)
-
-add_llvm_example(Simple
- Simple.cpp
- )
diff --git a/tools/llvmc/examples/Simple/Makefile b/tools/llvmc/examples/Simple/Makefile
deleted file mode 100644
index c10387c4f5..0000000000
--- a/tools/llvmc/examples/Simple/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-##===- llvmc/examples/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_BASED_DRIVER = Simple
-BUILT_SOURCES = Simple.inc
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/examples/Simple/Simple.cpp b/tools/llvmc/examples/Simple/Simple.cpp
deleted file mode 100644
index 8ac73130f9..0000000000
--- a/tools/llvmc/examples/Simple/Simple.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "llvm/CompilerDriver/Main.inc"
-#include "Simple.inc"
diff --git a/tools/llvmc/examples/Simple/Simple.td b/tools/llvmc/examples/Simple/Simple.td
deleted file mode 100644
index b47483b5d3..0000000000
--- a/tools/llvmc/examples/Simple/Simple.td
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- Simple.td - A simple LLVMC-based driver ----------------------------===//
-//
-// 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.
-//
-// To compile, use this command:
-//
-// $ cd $LLVM_OBJ_DIR/tools/llvmc
-// $ make BUILD_EXAMPLES=1
-//
-// Run as:
-//
-// $ $LLVM_OBJ_DIR/$(BuildMode)/bin/Simple
-//
-// For instructions on how to build your own LLVMC-based driver, see
-// the 'examples/Skeleton' directory.
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-def gcc : Tool<
-[(in_language "c"),
- (out_language "executable"),
- (output_suffix "out"),
- (command "gcc"),
- (sink),
-
- // -o is what is used by default, out_file_option here is included for
- // instructive purposes.
- (out_file_option "-o")
-]>;
-
-def LanguageMap : LanguageMap<[(lang_to_suffixes "c", "c")]>;
-
-def CompilationGraph : CompilationGraph<[(edge "root", "gcc")]>;
diff --git a/tools/llvmc/examples/Skeleton/AutoGenerated.td b/tools/llvmc/examples/Skeleton/AutoGenerated.td
deleted file mode 100644
index 97483ce928..0000000000
--- a/tools/llvmc/examples/Skeleton/AutoGenerated.td
+++ /dev/null
@@ -1,7 +0,0 @@
-//===- AutoGenerated.td ------------------------------------*- tablegen -*-===//
-//
-// Write the TableGen description of your llvmc-based driver here.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
diff --git a/tools/llvmc/examples/Skeleton/CMakeLists.txt b/tools/llvmc/examples/Skeleton/CMakeLists.txt
deleted file mode 100644
index e1296ca814..0000000000
--- a/tools/llvmc/examples/Skeleton/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-set(LLVM_TARGET_DEFINITIONS AutoGenerated.td)
-
-tablegen(AutoGenerated.inc -gen-llvmc)
-
-set(LLVM_USED_LIBS CompilerDriver)
-set(LLVM_LINK_COMPONENTS support)
-
-add_llvm_example(llvmc-skeleton
- Hooks.cpp
- Main.cpp
- )
diff --git a/tools/llvmc/examples/Skeleton/Hooks.cpp b/tools/llvmc/examples/Skeleton/Hooks.cpp
deleted file mode 100644
index ddd38f6e70..0000000000
--- a/tools/llvmc/examples/Skeleton/Hooks.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-//===--- Hooks.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.
-//
-//===----------------------------------------------------------------------===//
-//
-// Hook definitions should go here.
-//
-//===----------------------------------------------------------------------===//
diff --git a/tools/llvmc/examples/Skeleton/Main.cpp b/tools/llvmc/examples/Skeleton/Main.cpp
deleted file mode 100644
index 24c7768f93..0000000000
--- a/tools/llvmc/examples/Skeleton/Main.cpp
+++ /dev/null
@@ -1,15 +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 and AutoGenerated.inc.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/Main.inc"
-#include "AutoGenerated.inc"
diff --git a/tools/llvmc/examples/Skeleton/Makefile b/tools/llvmc/examples/Skeleton/Makefile
deleted file mode 100644
index 41ca8235e2..0000000000
--- a/tools/llvmc/examples/Skeleton/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-##===- llvmc/examples/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 $(LEVEL)/Makefile.common refers to
-# $LLVM_OBJ_DIR/Makefile.common or $YOUR_LLVM_BASED_PROJECT/Makefile.common.
-export LEVEL = ../../../..
-
-# Change this to the name of your LLVMC-based driver.
-LLVMC_BASED_DRIVER = llvmc-skeleton
-
-# Change this to the name of .inc file built from your .td file.
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/examples/Skeleton/README b/tools/llvmc/examples/Skeleton/README
deleted file mode 100644
index 282ee15d35..0000000000
--- a/tools/llvmc/examples/Skeleton/README
+++ /dev/null
@@ -1,6 +0,0 @@
-
-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/AutoGenerated.td`.
-
-The build system assumes that your project is based on LLVM.
diff --git a/tools/llvmc/examples/mcc16/CMakeLists.txt b/tools/llvmc/examples/mcc16/CMakeLists.txt
deleted file mode 100644
index f9eeb03d41..0000000000
--- a/tools/llvmc/examples/mcc16/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-set(LLVM_TARGET_DEFINITIONS PIC16.td)
-
-tablegen(PIC16.inc -gen-llvmc)
-
-set(LLVM_USED_LIBS CompilerDriver)
-set(LLVM_LINK_COMPONENTS support)
-
-add_llvm_example(mcc16
- Hooks.cpp
- Main.cpp
- )
diff --git a/tools/llvmc/examples/mcc16/Hooks.cpp b/tools/llvmc/examples/mcc16/Hooks.cpp
deleted file mode 100644
index bbb8438bc3..0000000000
--- a/tools/llvmc/examples/mcc16/Hooks.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "llvm/Support/Path.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/raw_ostream.h"
-
-#include <string>
-#include <locale>
-
-namespace llvmc {
- extern const char *ProgramName;
-
- namespace autogenerated {
- extern llvm::cl::opt<std::string> Parameter_p;
- }
-}
-
-using namespace llvm;
-using namespace llvmc;
-
-// Returns the platform specific directory separator via #ifdefs.
-// FIXME: This currently work on linux and windows only. It does not
-// work on other unices.
-static std::string GetDirSeparator() {
-#if __linux__ || __APPLE__
- return "/";
-#else
- return "\\";
-#endif
-}
-
-namespace hooks {
-// Get preprocessor define for the part.
-// It is __partname format in lower case.
-std::string
-GetLowerCasePartDefine(void) {
- std::locale loc;
- std::string Partname;
- if (autogenerated::Parameter_p.empty()) {
- Partname = "16f1xxx";
- } else {
- Partname = autogenerated::Parameter_p;
- }
-
- std::string LowerCase;
- for (unsigned i = 0; i < Partname.size(); i++) {
- LowerCase.push_back(std::tolower(Partname[i], loc));
- }
-
- return "__" + LowerCase;
-}
-
-std::string
-GetUpperCasePartDefine(void) {
- std::locale loc;
- std::string Partname;
- if (autogenerated::Parameter_p.empty()) {
- Partname = "16f1xxx";
- } else {
- Partname = autogenerated::Parameter_p;
- }
-
- std::string UpperCase;
- for (unsigned i = 0; i < Partname.size(); i++) {
- UpperCase.push_back(std::toupper(Partname[i], loc));
- }
-
- return "__" + UpperCase;
-}
-
-// Get the dir where c16 executables reside.
-std::string GetBinDir() {
- // Construct a Path object from the program name.
- void *P = (void*) (intptr_t) GetBinDir;
- sys::Path ProgramFullPath
- = sys::Path::GetMainExecutable(llvmc::ProgramName, P);
-
- // Get the dir name for the program. It's last component should be 'bin'.
- std::string BinDir = ProgramFullPath.getDirname();
-
- // llvm::errs() << "BinDir: " << BinDir << '\n';
- return BinDir + GetDirSeparator();
-}
-
-// Get the Top-level Installation dir for c16.
-std::string GetInstallDir() {
- sys::Path BinDirPath = sys::Path(GetBinDir());
-
- // Go one more level up to get the install dir.
- std::string InstallDir = BinDirPath.getDirname();
-
- return InstallDir + GetDirSeparator();
-}
-
-// Get the dir where the c16 header files reside.
-std::string GetStdHeadersDir() {
- return GetInstallDir() + "include";
-}
-
-// Get the dir where the assembler header files reside.
-std::string GetStdAsmHeadersDir() {
- return GetInstallDir() + "inc";
-}
-
-// Get the dir where the linker scripts reside.
-std::string GetStdLinkerScriptsDir() {
- return GetInstallDir() + "lkr";
-}
-
-// Get the dir where startup code, intrinsics and lib reside.
-std::string GetStdLibsDir() {
- return GetInstallDir() + "lib";
-}
-}
diff --git a/tools/llvmc/examples/mcc16/Main.cpp b/tools/llvmc/examples/mcc16/Main.cpp
deleted file mode 100644
index 5d4992dd9c..0000000000
--- a/tools/llvmc/examples/mcc16/Main.cpp
+++ /dev/null
@@ -1,57 +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.
-//
-//===----------------------------------------------------------------------===//
-//
-// Usually this file just includes CompilerDriver/Main.inc, but here we apply
-// some trickery to make the built-in '-save-temps' option hidden and enable
-// '--temp-dir' by default.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/BuiltinOptions.h"
-#include "llvm/CompilerDriver/Main.h"
-
-#include "llvm/Support/Path.h"
-#include "llvm/Config/config.h"
-
-#include <iostream>
-
-#include "PIC16.inc"
-
-namespace {
-
-// Modify the PACKAGE_VERSION to use build number in top level configure file.
-void PIC16VersionPrinter(void) {
- std::cout << "MPLAB C16 1.0 " << PACKAGE_VERSION << "\n";
-}
-
-}
-
-int main(int argc, char** argv) {
-
- // HACK
- SaveTemps.setHiddenFlag(llvm::cl::Hidden);
- TempDirname.setHiddenFlag(llvm::cl::Hidden);
- Languages.setHiddenFlag(llvm::cl::Hidden);
- DryRun.setHiddenFlag(llvm::cl::Hidden);
-
- llvm::cl::SetVersionPrinter(PIC16VersionPrinter);
-
- // Ask for a standard temp dir, but just cache its basename., and delete it.
- llvm::sys::Path tempDir;
- tempDir = llvm::sys::Path::GetTemporaryDirectory();
- TempDirname = tempDir.getBasename();
- tempDir.eraseFromDisk(true);
-
- // We are creating a temp dir in current dir, with the cached name.
- // But before that remove if one already exists with that name..
- tempDir = TempDirname;
- tempDir.eraseFromDisk(true);
-
- return llvmc::Main(argc, argv);
-}
diff --git a/tools/llvmc/examples/mcc16/Makefile b/tools/llvmc/examples/mcc16/Makefile
deleted file mode 100644
index 4409cffb55..0000000000
--- a/tools/llvmc/examples/mcc16/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-##===- llvmc/examples/mcc16/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 = mcc16
-BUILT_SOURCES = PIC16.inc
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/llvmc/examples/mcc16/PIC16.td b/tools/llvmc/examples/mcc16/PIC16.td
deleted file mode 100644
index 6f0419675e..0000000000
--- a/tools/llvmc/examples/mcc16/PIC16.td
+++ /dev/null
@@ -1,234 +0,0 @@
-//===- PIC16.td - PIC16 toolchain driver -------------------*- tablegen -*-===//
-//
-// A basic driver for the PIC16 toolchain.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-// Options
-
-def OptionList : OptionList<[
- (switch_option "g",
- (help "Enable Debugging")),
- (switch_option "E",
- (help "Stop after preprocessing, do not compile")),
- (switch_option "S",
- (help "Stop after compilation, do not assemble")),
- (switch_option "bc",
- (help "Stop after b-code generation, do not compile")),
- (switch_option "c",
- (help "Stop after assemble, do not link")),
- (prefix_option "p",
- (help "Specify part name")),
- (prefix_list_option "I",
- (help "Add a directory to include path")),
- (prefix_list_option "L",
- (help "Add a directory to library path")),
- (prefix_list_option "K",
- (help "Add a directory to linker script search path")),
- (parameter_option "l",
- (help "Specify a library to link")),
- (parameter_option "k",
- (help "Specify a linker script")),
- (parameter_option "m",
- (help "Generate linker map file with the given name")),
- (prefix_list_option "D",
- (help "Define a macro")),
- (switch_option "X",
- (help "Do not invoke mp2hex to create an output hex file.")),
- (switch_option "O0",
- (help "Do not optimize")),
- (switch_option "O1",
- (help "Optimization Level 1.")),
- (switch_option "O2",
- (help "Optimization Level 2.")),
- (switch_option "O3",
- (help "Optimization Level 3.")),
- (switch_option "Od",
- (help "Perform Debug-safe Optimizations only.")),
- (switch_option "w",
- (help "Disable all warnings.")),
-// (switch_option "O1",
-// (help "Optimization level 1")),
-// (switch_option "O2",
-// (help "Optimization level 2. (Default)")),
-// (parameter_option "pre-RA-sched",
-// (help "Example of an option that is passed to llc")),
- (parameter_option "regalloc",
- (help "Register allocator to use (possible values: simple, linearscan, pbqp, local; default=linearscan)")),
- (prefix_list_option "Wa,", (comma_separated),
- (help "Pass options to assembler (Run 'gpasm -help' for assembler options)")),
- (prefix_list_option "Wl,", (comma_separated),
- (help "Pass options to linker (Run 'mplink -help' for linker options)"))
-// (prefix_list_option "Wllc,",
-// (help "Pass options to llc")),
-// (prefix_list_option "Wo,",
-// (help "Pass options to llvm-ld"))
-]>;
-
-// Tools
-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
- (and (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 ext_E)],
- (and (switch_on "E"), (empty "o")), (no_out_file),
- (switch_on "bc"),[(stop_compilation), (output_suffix "bc")],
- (switch_on "g"), (append_cmd "-g"),
- (switch_on "w"), (append_cmd "-w"),
- (switch_on "O1"), (append_cmd ""),
- (switch_on "O2"), (append_cmd ""),
- (switch_on "O3"), (append_cmd ""),
- (switch_on "Od"), (append_cmd ""),
- (not_empty "D"), (forward "D"),
- (not_empty "I"), (forward "I"),
- (switch_on "O0"), (append_cmd "-O0"),
- (default), (append_cmd "-O1")))
-// (sink)
-]>;
-
-def clang_cc : clang_based<"c", "$CALL(GetBinDir)clang -cc1 -I $CALL(GetStdHeadersDir) -D $CALL(GetLowerCasePartDefine) -D $CALL(GetUpperCasePartDefine) -triple=pic16- -emit-llvm-bc ", "i">;
-
-//def clang_cc : Tool<[
-// (in_language "c"),
-// (out_language "llvm-bitcode"),
-// (output_suffix "bc"),
-// (cmd_line "$CALL(GetBinDir)clang-cc -I $CALL(GetStdHeadersDir) -triple=pic16- -emit-llvm-bc "),
-// (cmd_line kkkkk
-// (actions (case
-// (switch_on "g"), (append_cmd "g"),
-// (not_empty "I"), (forward "I"))),
-// (sink)
-//]>;
-
-
-// pre-link-and-lto step.
-def llvm_ld : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command "$CALL(GetBinDir)llvm-ld -L $CALL(GetStdLibsDir) -disable-licm-promotion -l std"),
- (out_file_option "-b"),
- (actions (case
- (switch_on "O0"), (append_cmd "-disable-opt"),
- (switch_on "O1"), (append_cmd "-disable-opt"),
-// Whenever O3 is not specified on the command line, default i.e. disable-inlining will always be added.
- (switch_on "O2"), (append_cmd ""),
- (switch_on "O3"), (append_cmd ""),
- (default), (append_cmd "-disable-inlining"))),
- (join)
-]>;
-
-// optimize single file
-def llvm_ld_optimizer : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
-// FIXME: we are still not disabling licm-promotion.
-// -disable-licm-promotion and building stdn library causes c16-71 to fail.
- (command "$CALL(GetBinDir)llvm-ld "),
- (out_file_option "-b"),
- (actions (case
- (switch_on "O0"), (append_cmd "-disable-opt"),
- (switch_on "O1"), (append_cmd "-disable-opt"),
-// Whenever O3 is not specified on the command line, default i.e. disable-inlining will always be added.
- (switch_on "O2"), (append_cmd ""),
- (switch_on "O3"), (append_cmd ""),
- (default), (append_cmd "-disable-inlining")))
-]>;
-
-// optimizer step.
-def pic16passes : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "obc"),
- (command "$CALL(GetBinDir)opt -pic16cloner -pic16overlay -f"),
- (actions (case
- (switch_on "O0"), (append_cmd "-disable-opt")))
-]>;
-
-def llc : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "assembler"),
- (output_suffix "s"),
- (command "$CALL(GetBinDir)llc -march=pic16 -disable-jump-tables -pre-RA-sched=list-burr -f"),
- (actions (case
- (switch_on "S"), (stop_compilation),
-// (not_empty "Wllc,"), (unpack_values "Wllc,"),
-// (not_empty "pre-RA-sched"), (forward "pre-RA-sched")))
- (not_empty "regalloc"), (forward "regalloc"),
- (empty "regalloc"), (append_cmd "-regalloc=linearscan")))
-]>;
-
-def gpasm : Tool<[
- (in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (command "$CALL(GetBinDir)gpasm -z -r decimal -I $CALL(GetStdAsmHeadersDir) -C -c -w 2"),
- (actions (case
- (switch_on "c"), (stop_compilation),
- (switch_on "g"), (append_cmd "-g"),
- (not_empty "p"), (forward "p"),
- (empty "p"), (append_cmd "-p 16f1xxx"),
- (not_empty "Wa,"), (forward_value "Wa,")))
-]>;
-
-def mplink : Tool<[
- (in_language "object-code"),
- (out_language "executable"),
- (output_suffix "cof"),
- (command "$CALL(GetBinDir)mplink -e -k $CALL(GetStdLinkerScriptsDir) -l $CALL(GetStdLibsDir) intrinsics.lib stdn.lib"),
- (actions (case
- (not_empty "Wl,"), (forward_value "Wl,"),
- (switch_on "X"), (append_cmd "-x"),
- (not_empty "L"), (forward_as "L", "-l"),
- (not_empty "K"), (forward_as "K", "-k"),
- (not_empty "m"), (forward "m"),
- (not_empty "p"), [(forward "p"), (append_cmd "-c")],
- (empty "p"), (append_cmd "-p 16f1xxx -c"),
-// (not_empty "l"), [(unpack_values "l"),(append_cmd ".lib")])),
- (not_empty "k"), (forward "k"),
- (not_empty "l"), (forward "l"))),
- (join)
-]>;
-
-// Language map
-
-def LanguageMap : LanguageMap<[
- (lang_to_suffixes "c", "c"),
- (lang_to_suffixes "c-cpp-output", "i"),
- (lang_to_suffixes "assembler", "s"),
- (lang_to_suffixes "assembler-with-cpp", "S"),
- (lang_to_suffixes "llvm-assembler", "ll"),
- (lang_to_suffixes "llvm-bitcode", "bc"),
- (lang_to_suffixes "object-code", "o"),
- (lang_to_suffixes "executable", "cof")
-]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
- (edge "root", "clang_cc"),
- (edge "root", "llvm_ld"),
- (optional_edge "root", "llvm_ld_optimizer",
- (case (switch_on "S"), (inc_weight),
- (switch_on "c"), (inc_weight))),
- (edge "root", "gpasm"),
- (edge "root", "mplink"),
- (edge "clang_cc", "llvm_ld"),
- (optional_edge "clang_cc", "llvm_ld_optimizer",
- (case (switch_on "S"), (inc_weight),
- (switch_on "c"), (inc_weight))),
- (edge "llvm_ld", "pic16passes"),
- (edge "llvm_ld_optimizer", "pic16passes"),
- (edge "pic16passes", "llc"),
- (edge "llc", "gpasm"),
- (edge "gpasm", "mplink")
-]>;
diff --git a/tools/llvmc/examples/mcc16/README b/tools/llvmc/examples/mcc16/README
deleted file mode 100644
index 6d2b73d5d9..0000000000
--- a/tools/llvmc/examples/mcc16/README
+++ /dev/null
@@ -1,75 +0,0 @@
-This is a basic compiler driver for the PIC16 toolchain that shows how to create
-your own llvmc-based drivers. It is based on the examples/Skeleton template.
-
-The PIC16 toolchain looks like this:
-
-clang-cc (FE) -> llvm-ld (optimizer) -> llc (codegen) -> native-as -> native-ld
-
-Following features were requested by Sanjiv:
-
-From: Sanjiv Gupta <sanjiv.gupta <at> microchip.com>
-Subject: Re: llvmc for PIC16
-Newsgroups: gmane.comp.compilers.llvm.devel
-Date: 2009-06-05 06:51:14 GMT
-
-The salient features that we want to have in the driver are:
-1. llvm-ld will be used as "The Optimizer".
-2. If the user has specified to generate the final executable, then
-llvm-ld should run on all the .bc files generated by clang and create a
-single optimized .bc file for further tools.
-3. -Wo <options> - pass optimizations to the llvm-ld
-4. mcc16 -Wl <options> - pass options to native linker.
-5. mcc16 -Wa <options> - pass options to native assembler.
-
-Here are some example command lines and sample command invocations as to
-what should be done.
-
-$ mcc16 -S foo.c
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-
-$ mcc16 -S foo.c bar.c
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-// [clang-cc bar.c] -> bar.bc
-// [llvm-ld bar.bc] -> bar.opt.bc
-// [llc bar.opt.bc] -> bar.s
-
-** Use of -g causes llvm-ld to run with -disable-opt
-$ mcc16 -S -g foo.c
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld -disable-opt foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-
-** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc.
-$ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c
-// [clang-cc -I ../include foo.c] -> foo.bc
-// [llvm-ld -disable-opt foo.bc] -> foo.opt.bc
-// [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s
-
-** -Wo passes options to llvm-ld
-$ mcc16 -Wo=opt1,opt2 -S -I ../include -pre-RA-sched=list-burr foo.c
-// [clang-cc -I ../include foo.c] -> foo.bc
-// [llvm-ld -opt1 -opt2 foo.bc] -> foo.opt.bc
-// [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s
-
-** -Wa passes options to native as.
-$ mcc16 -c foo.c -Wa=opt1
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-// [native-as -opt1 foo.s] -> foo.o
-
-$ mcc16 -Wo=opt1 -Wl=opt2 -Wa=opt3 foo.c bar.c
-// [clang-cc foo.c] -> foo.bc
-// [clang-cc bar.c] -> bar.bc
-// [llvm-ld -opt1 foo.bc bar.bc] -> a.out.bc
-// [llc a.out.bc] -> a.out.s
-// [native-as -opt3 a.out.s] -> a.out.o
-// [native-ld -opt2 a.out.o] -> a.out
-
-Is this achievable by a tablegen based driver ?
-
-- Sanjiv
diff --git a/tools/llvmc/src/AutoGenerated.td b/tools/llvmc/src/AutoGenerated.td
deleted file mode 100644
index 8507b1ff22..0000000000
--- a/tools/llvmc/src/AutoGenerated.td
+++ /dev/null
@@ -1,17 +0,0 @@
-//===- 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 contains compilation graph description used by llvmc.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-include "Base.td"
-include "Clang.td"
diff --git a/tools/llvmc/src/Base.td.in b/tools/llvmc/src/Base.td.in
deleted file mode 100644
index 84e39e756e..0000000000
--- a/tools/llvmc/src/Base.td.in
+++ /dev/null
@@ -1,461 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// 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 "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)),
- (parameter_option "linker",
- (help "Choose linker (possible values: gcc, g++)")),
- (parameter_option "mtune",
- (help "Target a specific CPU type"), (forward_not_split)),
- (parameter_list_option "march",
- (help "Generate code for the specified machine type")),
- (parameter_option "mcpu",
- (help "A deprecated synonym for -mtune"), (hidden), (forward_not_split)),
- (parameter_option "mfpu",
- (help "Specify type of floating point unit"),
- (hidden), (forward_not_split)),
- (parameter_option "mabi",
- (help "Generate code for the specified ABI"), (hidden)),
- (parameter_option "mfloat-abi",
- (help "Specifies which floating-point ABI to use"), (hidden)),
- (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)),
- (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 "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))
-]>;
-
-def LinkerOptList : OptionList<[
- (prefix_list_option "L",
- (help "Add a directory to link path")),
- (prefix_list_option "l",
- (help "Search a library when linking")),
- (parameter_option "filelist", (hidden),
- (help "Link the files listed in file")),
- (switch_option "nostartfiles",
- (help "Do not use the standard system startup files when linking"),
- (hidden)),
- (switch_option "nodefaultlibs",
- (help "Do not use the standard system libraries when linking"), (hidden)),
- (switch_option "nostdlib",
- (help
- "Do not use the standard system startup files or libraries when linking"),
- (hidden)),
- (switch_option "pie",
- (help "Produce a position independent executable"), (hidden)),
- (switch_option "rdynamic",
- (help "Add all symbols to the dynamic export table"), (hidden)),
- (switch_option "s",
- (help "Strip all symbols"), (hidden)),
- (switch_option "static",
- (help "Do not link against shared libraries"), (hidden)),
- (switch_option "static-libgcc",
- (help "Use static libgcc"), (hidden)),
- (switch_option "shared",
- (help "Create a DLL instead of the regular executable")),
- (switch_option "shared-libgcc",
- (help "Use shared libgcc"), (hidden)),
- (parameter_option "T",
- (help "Read linker script"), (hidden)),
- (parameter_option "u",
- (help "Start with undefined reference to SYMBOL"), (hidden)),
- (switch_option "pthread",
- (help "Enable threads")),
-
- // 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)),
- (prefix_list_option "F",
- (help "Add a directory to framework search path")),
- (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)),
- (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, string in_lang, string E_ext, dag out_lang,
- string out_ext> : Tool<
-[(in_language in_lang),
- out_lang,
- (output_suffix out_ext),
- (command cmd),
- (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),
-
- // ('-emit-llvm') && !('opt') -> stop compilation
- (and (switch_on "emit-llvm"), (not (switch_on "opt"))),
- (stop_compilation),
- // ('-S' && '-emit-llvm') && !('opt') -> output .ll
- (and (switch_on "emit-llvm", "S"), (not (switch_on "opt"))),
- [(forward "S"), (output_suffix "ll")],
- // Usually just output .bc
- (not (switch_on "fsyntax-only")),
- [(append_cmd "-c"), (append_cmd "-emit-llvm")],
-
- // -fsyntax-only
- (switch_on "fsyntax-only"), [(forward "fsyntax-only"),
- (no_out_file), (stop_compilation)],
-
- // 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 "mcpu"), (forward "mcpu"),
- (not_empty "mtune"), (forward "mtune"),
- (not_empty "mfpu"), (forward "mfpu"),
- (not_empty "mabi"), (forward "mabi"),
- (not_empty "mfloat-abi"), (forward "mfloat-abi"),
- (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)
-]>;
-
-class llvm_gcc_comp_based <string cmd, string in_lang, string E_ext>
-: llvm_gcc_based<cmd, in_lang, E_ext,
- (out_language "llvm-bitcode", "object-code"), "bc">;
-
-class llvm_gcc_pch_based <string cmd, string in_lang, string E_ext>
-: llvm_gcc_based<cmd, in_lang, E_ext,
- (out_language "precompiled-header"), "gch">;
-
-def llvm_gcc_c : llvm_gcc_comp_based
- <"@LLVMGCCCOMMAND@ -x c", "c", "i">;
-def llvm_gcc_cpp : llvm_gcc_comp_based
- <"@LLVMGXXCOMMAND@ -x c++", "c++", "i">;
-def llvm_gcc_m : llvm_gcc_comp_based
- <"@LLVMGCCCOMMAND@ -x objective-c", "objective-c", "mi">;
-def llvm_gcc_mxx : llvm_gcc_comp_based
- <"@LLVMGCCCOMMAND@ -x objective-c++", "objective-c++", "mi">;
-
-def llvm_gcc_c_pch : llvm_gcc_pch_based
- <"@LLVMGCCCOMMAND@ -x c-header", "c-header", "i">;
-def llvm_gcc_cpp_pch : llvm_gcc_pch_based
- <"@LLVMGXXCOMMAND@ -x c++-header", "c++-header", "i">;
-def llvm_gcc_m_pch : llvm_gcc_pch_based
- <"@LLVMGCCCOMMAND@ -x objective-c-header", "objective-c-header", "mi">;
-def llvm_gcc_mxx_pch : llvm_gcc_pch_based
- <"@LLVMGCCCOMMAND@ -x objective-c++-header", "objective-c++-header", "mi">;
-
-def opt : Tool<
-[(in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "opt.bc"),
- (actions (case (switch_on "emit-llvm"), (stop_compilation),
- (switch_on "emit-llvm", "S"),
- [(append_cmd "-S"), (output_suffix "ll")],
- (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 (and (switch_on "emit-llvm"), (not (switch_on "opt"))),
- (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"),
- (not_empty "march"), (forward "march"),
- (not_empty "mcpu"), (forward "mcpu"),
- (not_empty "mtune"), (forward "mtune"),
- (not_empty "mabi"), (forward "mabi"),
- (not_empty "mfloat-abi"), (forward "mfloat-abi"),
- (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 -disable-cfi"),
- (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_transformed_value
- "march", "ConvertMArchToMAttr"),
- (not_empty "mcpu"), (forward_transformed_value "mcpu", "ConvertMCpu"),
- (and (not_empty "mtune"), (empty "mcpu")),
- (forward_as "mtune", "-mcpu"),
- (not_empty "mfpu"), (forward_transformed_value "mfpu", "ConvertMFpu"),
- (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, dag on_empty> : Tool<
-[(in_language "object-code", "static-library", "dynamic-library"),
- (out_language "executable"),
- (output_suffix "out"),
- (command cmd),
- (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"),
- (not_empty "march"), (forward "march"),
- (not_empty "mcpu"), (forward "mcpu"),
- (not_empty "mtune"), (forward "mtune"),
- (not_empty "mabi"), (forward "mabi"),
- (not_empty "mfloat-abi"), (forward "mfloat-abi"),
- (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 "nostartfiles"), (forward "nostartfiles"),
- (switch_on "nodefaultlibs"), (forward "nodefaultlibs"),
- (switch_on "nostdlib"), (forward "nostdlib"),
- (switch_on "pie"), (forward "pie"),
- (switch_on "rdynamic"), (forward "rdynamic"),
- (switch_on "s"), (forward "s"),
- (switch_on "static"), (forward "static"),
- (switch_on "static-libgcc"), (forward "static-libgcc"),
- (switch_on "shared"), (forward "shared"),
- (switch_on "shared-libgcc"), (forward "shared-libgcc"),
- (not_empty "T"), (forward "T"),
- (not_empty "u"), (forward "u"),
- (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<[
- (lang_to_suffixes "precompiled-header", ["gch", "pch"]),
- (lang_to_suffixes "c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]),
- (lang_to_suffixes "c++-header", "hpp"),
- (lang_to_suffixes "c", "c"),
- (lang_to_suffixes "c-header", "h"),
- (lang_to_suffixes "c-cpp-output", "i"),
- (lang_to_suffixes "objective-c-cpp-output", "mi"),
- (lang_to_suffixes "objective-c++", "mm"),
- (lang_to_suffixes "objective-c++-header", "hmm"),
- (lang_to_suffixes "objective-c", "m"),
- (lang_to_suffixes "objective-c-header", "hm"),
- (lang_to_suffixes "assembler", "s"),
- (lang_to_suffixes "assembler-with-cpp", "S"),
- (lang_to_suffixes "llvm-assembler", "ll"),
- (lang_to_suffixes "llvm-bitcode", "bc"),
- (lang_to_suffixes "object-code", ["o", "*empty*"]),
- (lang_to_suffixes "static-library", ["a", "lib"]),
- (lang_to_suffixes "dynamic-library", ["so", "dylib", "dll"]),
- (lang_to_suffixes "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"),
-
- (optional_edge "root", "llvm_as",
- (case (or (switch_on "emit-llvm"),
- (switch_on "opt")), (inc_weight))),
- (optional_edge "llvm_gcc_c", "opt",
- (case (switch_on "opt"), (inc_weight))),
- (optional_edge "llvm_gcc_cpp", "opt",
- (case (switch_on "opt"), (inc_weight))),
- (optional_edge "llvm_gcc_m", "opt",
- (case (switch_on "opt"), (inc_weight))),
- (optional_edge "llvm_gcc_mxx", "opt",
- (case (switch_on "opt"), (inc_weight))),
- (optional_edge "llvm_as", "opt",
- (case (switch_on "opt"), (inc_weight))),
- (edge "opt", "llc"),
-
- (edge "llc", "llvm_gcc_assembler"),
- (edge "llvm_gcc_assembler", "llvm_gcc_linker"),
- (optional_edge "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"),
- (optional_edge "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)))
-]>;
diff --git a/tools/llvmc/src/CMakeLists.txt b/tools/llvmc/src/CMakeLists.txt
deleted file mode 100644
index e6c8917748..0000000000
--- a/tools/llvmc/src/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-set(LLVMGCCCOMMAND llvm-gcc)
-set(LLVMGXXCOMMAND llvm-g++)
-
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/Base.td.in
- ${CMAKE_CURRENT_BINARY_DIR}/Base.td
- @ONLY)
-
-set(LLVM_TARGET_DEFINITIONS AutoGenerated.td)
-
-tablegen(AutoGenerated.inc -gen-llvmc)
-
-set(LLVM_USED_LIBS CompilerDriver)
-set(LLVM_LINK_COMPONENTS support)
-
-add_llvm_tool(llvmc
- Hooks.cpp
- Main.cpp
- )
diff --git a/tools/llvmc/src/Clang.td b/tools/llvmc/src/Clang.td
deleted file mode 100644
index e2d32e88ff..0000000000
--- a/tools/llvmc/src/Clang.td
+++ /dev/null
@@ -1,87 +0,0 @@
-//===- 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 Options : OptionList<[
-(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)
-]>;
-
-// Compilation graph
-
-def ClangCompilationGraph : CompilationGraph<[
- (optional_edge "root", "clang_c",
- (case (switch_on "clang"), (inc_weight))),
- (optional_edge "root", "clang_cpp",
- (case (switch_on "clang"), (inc_weight))),
- (optional_edge "root", "clang_objective_c",
- (case (switch_on "clang"), (inc_weight))),
- (optional_edge "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"),
- (optional_edge "llc", "as", (case (switch_on "clang"), (inc_weight))),
- (edge "as", "llvm_ld")
-]>;
diff --git a/tools/llvmc/src/Hooks.cpp b/tools/llvmc/src/Hooks.cpp
deleted file mode 100644
index ddad08a1b4..0000000000
--- a/tools/llvmc/src/Hooks.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-#include "llvm/ADT/StringMap.h"
-
-#include <string>
-#include <vector>
-
-namespace hooks {
-
-/// NUM_KEYS - Calculate the size of a const char* array.
-#define NUM_KEYS(Keys) sizeof(Keys) / sizeof(const char*)
-
-// See http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
-inline unsigned NextHighestPowerOf2 (unsigned i) {
- --i;
- i |= i >> 1;
- i |= i >> 2;
- i |= i >> 4;
- i |= i >> 8;
- i |= i >> 16;
- ++i;
- return i;
-}
-
-typedef std::vector<std::string> StrVec;
-typedef llvm::StringMap<const char*> ArgMap;
-
-/// AddPlusOrMinus - Convert 'no-foo' to '-foo' and 'foo' to '+foo'.
-void AddPlusOrMinus (const std::string& Arg, std::string& out) {
- if (Arg.find("no-") == 0 && Arg[3] != 0) {
- out += '-';
- out += Arg.c_str() + 3;
- }
- else {
- out += '+';
- out += Arg;
- }
-}
-
-// -march values that need to be special-cased.
-const char* MArchKeysARM[] = { "armv4t", "armv5t", "armv5te", "armv6",
- "armv6-m", "armv6t2", "armv7-a", "armv7-m" };
-const char* MArchValuesARM[] = { "v4t", "v5t", "v5te", "v6", "v6m", "v6t2",
- "v7a", "v7m" };
-const unsigned MArchNumKeysARM = NUM_KEYS(MArchKeysARM);
-const unsigned MArchMapSize = NextHighestPowerOf2(MArchNumKeysARM);
-
-// -march values that should be forwarded as -mcpu
-const char* MArchMCpuKeysARM[] = { "iwmmxt", "ep9312" };
-const char* MArchMCpuValuesARM[] = { "iwmmxt", "ep9312"};
-const unsigned MArchMCpuNumKeysARM = NUM_KEYS(MArchMCpuKeysARM);
-
-
-void FillInArgMap(ArgMap& Args, const char* Keys[],
- const char* Values[], unsigned NumKeys)
-{
- for (unsigned i = 0; i < NumKeys; ++i) {
- // Explicit cast to StringRef here is necessary to pick up the right
- // overload.
- Args.GetOrCreateValue(llvm::StringRef(Keys[i]), Values[i]);
- }
-}
-
-/// ConvertMArchToMAttr - Convert -march from the gcc dialect to
-/// something llc can understand.
-std::string ConvertMArchToMAttr(const StrVec& Opts) {
- static ArgMap MArchMap(MArchMapSize);
- static ArgMap MArchMCpuMap(MArchMapSize);
- static bool StaticDataInitialized = false;
-
- if (!StaticDataInitialized) {
- FillInArgMap(MArchMap, MArchKeysARM, MArchValuesARM, MArchNumKeysARM);
- FillInArgMap(MArchMCpuMap, MArchMCpuKeysARM,
- MArchMCpuValuesARM, MArchMCpuNumKeysARM);
- StaticDataInitialized = true;
- }
-
- std::string mattr("-mattr=");
- std::string mcpu("-mcpu=");
- bool mattrTouched = false;
- bool mcpuTouched = false;
-
- for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) {
- const std::string& Arg = *B;
-
- // Check if the argument should be forwarded to -mcpu instead of -mattr.
- {
- ArgMap::const_iterator I = MArchMCpuMap.find(Arg);
-
- if (I != MArchMCpuMap.end()) {
- mcpuTouched = true;
- mcpu += I->getValue();
- continue;
- }
- }
-
- if (mattrTouched)
- mattr += ",";
-
- // Check if the argument is a special case.
- {
- ArgMap::const_iterator I = MArchMap.find(Arg);
-
- if (I != MArchMap.end()) {
- mattrTouched = true;
- mattr += '+';
- mattr += I->getValue();
- continue;
- }
- }
-
- AddPlusOrMinus(Arg, mattr);
- }
-
- std::string out;
- if (mattrTouched)
- out += mattr;
- if (mcpuTouched)
- out += (mattrTouched ? " " : "") + mcpu;
-
- return out;
-}
-
-// -mcpu values that need to be special-cased.
-const char* MCpuKeysPPC[] = { "G3", "G4", "G5", "powerpc", "powerpc64"};
-const char* MCpuValuesPPC[] = { "g3", "g4", "g5", "ppc", "ppc64"};
-const unsigned MCpuNumKeysPPC = NUM_KEYS(MCpuKeysPPC);
-const unsigned MCpuMapSize = NextHighestPowerOf2(MCpuNumKeysPPC);
-
-/// ConvertMCpu - Convert -mcpu value from the gcc to the llc dialect.
-std::string ConvertMCpu(const char* Val) {
- static ArgMap MCpuMap(MCpuMapSize);
- static bool StaticDataInitialized = false;
-
- if (!StaticDataInitialized) {
- FillInArgMap(MCpuMap, MCpuKeysPPC, MCpuValuesPPC, MCpuNumKeysPPC);
- StaticDataInitialized = true;
- }
-
- std::string ret = "-mcpu=";
- ArgMap::const_iterator I = MCpuMap.find(Val);
- if (I != MCpuMap.end()) {
- return ret + I->getValue();
- }
- return ret + Val;
-}
-
-// -mfpu values that need to be special-cased.
-const char* MFpuKeysARM[] = { "vfp", "vfpv3",
- "vfpv3-fp16", "vfpv3-d16", "vfpv3-d16-fp16",
- "neon", "neon-fp16" };
-const char* MFpuValuesARM[] = { "vfp2", "vfp3",
- "+vfp3,+fp16", "+vfp3,+d16", "+vfp3,+d16,+fp16",
- "+neon", "+neon,+neonfp" };
-const unsigned MFpuNumKeysARM = NUM_KEYS(MFpuKeysARM);
-const unsigned MFpuMapSize = NextHighestPowerOf2(MFpuNumKeysARM);
-
-/// ConvertMFpu - Convert -mfpu value from the gcc to the llc dialect.
-std::string ConvertMFpu(const char* Val) {
- static ArgMap MFpuMap(MFpuMapSize);
- static bool StaticDataInitialized = false;
-
- if (!StaticDataInitialized) {
- FillInArgMap(MFpuMap, MFpuKeysARM, MFpuValuesARM, MFpuNumKeysARM);
- StaticDataInitialized = true;
- }
-
- std::string ret = "-mattr=";
- ArgMap::const_iterator I = MFpuMap.find(Val);
- if (I != MFpuMap.end()) {
- return ret + I->getValue();
- }
- return ret + '+' + Val;
-}
-
-/// ConvertToMAttr - Convert '-mfoo' and '-mno-bar' to '-mattr=+foo,-bar'.
-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 += ",";
-
- AddPlusOrMinus(Arg, out);
- }
-
- return out;
-}
-
-}
diff --git a/tools/llvmc/src/Main.cpp b/tools/llvmc/src/Main.cpp
deleted file mode 100644
index 9f9c71aa8c..0000000000
--- a/tools/llvmc/src/Main.cpp
+++ /dev/null
@@ -1,16 +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 AutoGenerated.inc and CompilerDriver/Main.inc.
-//
-//===----------------------------------------------------------------------===//
-
-#include "AutoGenerated.inc"
-
-#include "llvm/CompilerDriver/Main.inc"
diff --git a/tools/llvmc/src/Makefile b/tools/llvmc/src/Makefile
deleted file mode 100644
index f3f30911a4..0000000000
--- a/tools/llvmc/src/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-##===- tools/llvmc/src/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
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common