aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-02-23 09:04:44 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-02-23 09:04:44 +0000
commita34f97ab22d55b38423d25663cc26408ac34a721 (patch)
tree0579d1e6e25177b71043e6d569185240e9281d1a /tools
parentc6e0dbf1ddb767e6587bbf340b8dc66a20b7cfea (diff)
downloadexternal_llvm-a34f97ab22d55b38423d25663cc26408ac34a721.zip
external_llvm-a34f97ab22d55b38423d25663cc26408ac34a721.tar.gz
external_llvm-a34f97ab22d55b38423d25663cc26408ac34a721.tar.bz2
Correct option forwarding: initial implementation.
Does not work, but the infrastructure changes are in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvmc/Makefile2
-rw-r--r--tools/llvmc/plugins/Base/Base.td.in40
-rw-r--r--tools/llvmc/plugins/Clang/Clang.td9
3 files changed, 20 insertions, 31 deletions
diff --git a/tools/llvmc/Makefile b/tools/llvmc/Makefile
index 8f99526..d915934 100644
--- a/tools/llvmc/Makefile
+++ b/tools/llvmc/Makefile
@@ -10,7 +10,7 @@
LEVEL = ../..
export LLVMC_BASED_DRIVER_NAME = llvmc
-export LLVMC_BUILTIN_PLUGINS = Base Clang
+export LLVMC_BUILTIN_PLUGINS = Base
REQUIRES_RTTI = 1
DIRS = plugins driver
diff --git a/tools/llvmc/plugins/Base/Base.td.in b/tools/llvmc/plugins/Base/Base.td.in
index 5f09664..9dea5c0 100644
--- a/tools/llvmc/plugins/Base/Base.td.in
+++ b/tools/llvmc/plugins/Base/Base.td.in
@@ -134,28 +134,26 @@ class llvm_gcc_based <string cmd_prefix, string in_lang,
string E_ext, string out_lang> : Tool<
[(in_language in_lang),
(out_language "llvm-bitcode"),
- (output_suffix out_lang),
- (cmd_line (case
- (switch_on "E"),
- (case (not_empty "o"),
- !strconcat(cmd_prefix, " -E $INFILE -o $OUTFILE"),
- (default),
- !strconcat(cmd_prefix, " -E $INFILE")),
- (switch_on "fsyntax-only"),
- !strconcat(cmd_prefix, " -fsyntax-only $INFILE"),
- (and (switch_on "S"), (switch_on "emit-llvm")),
- !strconcat(cmd_prefix, " -S $INFILE -o $OUTFILE -emit-llvm"),
- (default),
- !strconcat(cmd_prefix, " -c $INFILE -o $OUTFILE -emit-llvm"))),
+ (output_suffix "bc"),
+ (command cmd_prefix),
(actions
(case
- (and (multiple_input_files), (or (switch_on "S"), (switch_on "c"))),
+ (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"), [(stop_compilation), (output_suffix E_ext)],
+ (switch_on "E"),
+ [(forward "E"), (stop_compilation), (output_suffix E_ext)],
+ (and (switch_on "E"), (empty "o")), (no_out_file),
(switch_on ["emit-llvm", "S"]),
[(output_suffix "ll"), (stop_compilation)],
(switch_on ["emit-llvm", "c"]), (stop_compilation),
- (switch_on "fsyntax-only"), (stop_compilation),
+ (switch_on "fsyntax-only"), [(forward "fsyntax-only"),
+ (no_out_file), (stop_compilation)],
+ (switch_on ["S", "emit-llvm"]), [(forward "S"), (forward "emit-llvm")],
+ (not (or (switch_on ["S", "emit-llvm"]), (switch_on "fsyntax-only"))),
+ [(append_cmd "-c"), (append_cmd "-emit-llvm")],
+
+ // Forwards
(not_empty "include"), (forward "include"),
(not_empty "iquote"), (forward "iquote"),
(not_empty "save-temps"), (append_cmd "-save-temps"),
@@ -208,14 +206,14 @@ def opt : Tool<
(switch_on "O1"), (forward "O1"),
(switch_on "O2"), (forward "O2"),
(switch_on "O3"), (forward "O3"))),
- (cmd_line "opt -f $INFILE -o $OUTFILE")
+ (command "opt -f")
]>;
def llvm_as : Tool<
[(in_language "llvm-assembler"),
(out_language "llvm-bitcode"),
(output_suffix "bc"),
- (cmd_line "llvm-as $INFILE -o $OUTFILE"),
+ (command "llvm-as"),
(actions (case (switch_on "emit-llvm"), (stop_compilation)))
]>;
@@ -223,7 +221,7 @@ def llvm_gcc_assembler : Tool<
[(in_language "assembler"),
(out_language "object-code"),
(output_suffix "o"),
- (cmd_line "@LLVMGCCCOMMAND@ -c -x assembler $INFILE -o $OUTFILE"),
+ (command "@LLVMGCCCOMMAND@ -c -x assembler"),
(actions (case
(switch_on "c"), (stop_compilation),
(not_empty "arch"), (forward "arch"),
@@ -234,7 +232,7 @@ def llc : Tool<
[(in_language ["llvm-bitcode", "llvm-assembler"]),
(out_language "assembler"),
(output_suffix "s"),
- (cmd_line "llc -f $INFILE -o $OUTFILE"),
+ (command "llc -f"),
(actions (case
(switch_on "S"), (stop_compilation),
(switch_on "O0"), (forward "O0"),
@@ -256,7 +254,7 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool<
[(in_language "object-code"),
(out_language "executable"),
(output_suffix "out"),
- (cmd_line !strconcat(cmd_prefix, " $INFILE -o $OUTFILE")),
+ (command cmd_prefix),
(works_on_empty (case (not_empty "filelist"), true,
(default), false)),
(join),
diff --git a/tools/llvmc/plugins/Clang/Clang.td b/tools/llvmc/plugins/Clang/Clang.td
index ac8ac15..cea2b5d 100644
--- a/tools/llvmc/plugins/Clang/Clang.td
+++ b/tools/llvmc/plugins/Clang/Clang.td
@@ -1,12 +1,3 @@
-// A replacement for the Clang's ccc script.
-// Depends on the Base plugin.
-// To compile, use this command:
-//
-// cd $LLVMC2_DIR
-// make DRIVER_NAME=ccc2 BUILTIN_PLUGINS=Clang
-//
-// Or just use the default llvmc, which now has this plugin enabled.
-
include "llvm/CompilerDriver/Common.td"
def Priority : PluginPriority<1>;