1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Refactor Tools.td to remove repetition.

llvm-svn: 60100
This commit is contained in:
Mikhail Glushenkov 2008-11-26 10:56:56 +00:00
parent 7534e81f38
commit 3dd6b7e4e9

View File

@ -11,20 +11,20 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
def llvm_gcc_c : Tool< class llvm_gcc_based <string cmd_prefix, string in_lang> : Tool<
[(in_language "c"), [(in_language in_lang),
(out_language "llvm-bitcode"), (out_language "llvm-bitcode"),
(output_suffix "bc"), (output_suffix "bc"),
(cmd_line (case (cmd_line (case
(switch_on "E"), (switch_on "E"),
(case (not_empty "o"), (case (not_empty "o"),
"llvm-gcc -E -x c++ $INFILE -o $OUTFILE", !strconcat(cmd_prefix, " -E $INFILE -o $OUTFILE"),
(default), (default),
"llvm-gcc -E -x c++ $INFILE"), !strconcat(cmd_prefix, " -E $INFILE")),
(switch_on "fsyntax-only"), (switch_on "fsyntax-only"),
"llvm-gcc -fsyntax-only -x c $INFILE", !strconcat(cmd_prefix, " -fsyntax-only $INFILE"),
(default), (default),
"llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm")), !strconcat(cmd_prefix, " -c $INFILE -o $OUTFILE -emit-llvm"))),
(switch_option "emit-llvm", (stop_compilation), (switch_option "emit-llvm", (stop_compilation),
(help "Emit LLVM intermediate files instead of native object files")), (help "Emit LLVM intermediate files instead of native object files")),
(switch_option "E", (stop_compilation), (switch_option "E", (stop_compilation),
@ -36,68 +36,10 @@ def llvm_gcc_c : Tool<
(sink) (sink)
]>; ]>;
def llvm_gcc_cpp : Tool< def llvm_gcc_c : llvm_gcc_based<"llvm-gcc -x c", "c">;
[(in_language "c++"), def llvm_gcc_cpp : llvm_gcc_based<"llvm-g++ -x c++", "c++">;
(out_language "llvm-bitcode"), def llvm_gcc_m : llvm_gcc_based<"llvm-gcc -x objective-c", "objective-c">;
(output_suffix "bc"), def llvm_gcc_mxx : llvm_gcc_based<"llvm-gcc -x objective-c++", "objective-c++">;
(cmd_line (case
(switch_on "E"),
(case (not_empty "o"),
"llvm-g++ -E -x c++ $INFILE -o $OUTFILE",
(default),
"llvm-g++ -E -x c++ $INFILE"),
(switch_on "fsyntax-only"),
"llvm-g++ -fsyntax-only -x c++ $INFILE",
(default),
"llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
(switch_option "emit-llvm", (stop_compilation)),
(switch_option "E", (stop_compilation)),
(switch_option "fsyntax-only", (stop_compilation)),
(parameter_list_option "include", (forward)),
(sink)
]>;
def llvm_gcc_m : Tool<
[(in_language "objective-c"),
(out_language "llvm-bitcode"),
(output_suffix "bc"),
(cmd_line (case
(switch_on "E"),
(case (not_empty "o"),
"llvm-gcc -E -x objective-c $INFILE -o $OUTFILE",
(default),
"llvm-gcc -E -x objective-c $INFILE"),
(switch_on "fsyntax-only"),
"llvm-gcc -fsyntax-only -x objective-c $INFILE",
(default),
"llvm-gcc -c -x objective-c $INFILE -o $OUTFILE -emit-llvm")),
(switch_option "emit-llvm", (stop_compilation)),
(switch_option "E", (stop_compilation)),
(switch_option "fsyntax-only", (stop_compilation)),
(parameter_list_option "include", (forward)),
(sink)
]>;
def llvm_gcc_mxx : Tool<
[(in_language "objective-c++"),
(out_language "llvm-bitcode"),
(output_suffix "bc"),
(cmd_line (case
(switch_on "E"),
(case (not_empty "o"),
"llvm-gcc -E -x objective-c++ $INFILE -o $OUTFILE",
(default),
"llvm-gcc -E -x objective-c++ $INFILE"),
(switch_on "fsyntax-only"),
"llvm-gcc -fsyntax-only -x objective-c++ $INFILE",
(default),
"llvm-gcc -c -x objective-c++ $INFILE -o $OUTFILE -emit-llvm")),
(switch_option "emit-llvm", (stop_compilation)),
(switch_option "E", (stop_compilation)),
(switch_option "fsyntax-only", (stop_compilation)),
(parameter_list_option "include", (forward)),
(sink)
]>;
def opt : Tool< def opt : Tool<
[(in_language "llvm-bitcode"), [(in_language "llvm-bitcode"),