[llvm-commits] [llvm] r60764 - in /llvm/trunk: include/llvm/CompilerDriver/Tools.td tools/llvmc/plugins/Clang/Clang.td
Mikhail Glushenkov
foldr at codedgers.com
Tue Dec 9 06:40:18 PST 2008
Author: foldr
Date: Tue Dec 9 08:40:18 2008
New Revision: 60764
URL: http://llvm.org/viewvc/llvm-project?rev=60764&view=rev
Log:
Support -emit-llvm properly (with -S and -c).
Modified:
llvm/trunk/include/llvm/CompilerDriver/Tools.td
llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
Modified: llvm/trunk/include/llvm/CompilerDriver/Tools.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Tools.td?rev=60764&r1=60763&r2=60764&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Tools.td (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Tools.td Tue Dec 9 08:40:18 2008
@@ -13,7 +13,7 @@
def OptList : OptionList<[
(switch_option "emit-llvm",
- (help "Emit LLVM bitcode files instead of native object files")),
+ (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",
@@ -42,7 +42,7 @@
(help "Pass options to linker"))
]>;
-class llvm_gcc_based <string cmd_prefix, string in_lang> : Tool<
+class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool<
[(in_language in_lang),
(out_language "llvm-bitcode"),
(output_suffix "bc"),
@@ -54,23 +54,27 @@
!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"))),
(actions
(case
- (switch_on "emit-llvm"), (stop_compilation),
- (switch_on "E"), [(stop_compilation), (output_suffix "i")],
- (switch_on "S"), (stop_compilation),
+ (switch_on "E"), [(stop_compilation), (output_suffix E_ext)],
+ (and (switch_on "emit-llvm"), (switch_on "S")),
+ [(output_suffix "ll"), (stop_compilation)],
+ (and (switch_on "emit-llvm"), (switch_on "c")), (stop_compilation),
(switch_on "fsyntax-only"), (stop_compilation),
(not_empty "include"), (forward "include"),
(not_empty "I"), (forward "I"))),
(sink)
]>;
-def llvm_gcc_c : llvm_gcc_based<"llvm-gcc -x c", "c">;
-def llvm_gcc_cpp : llvm_gcc_based<"llvm-g++ -x c++", "c++">;
-def llvm_gcc_m : llvm_gcc_based<"llvm-gcc -x objective-c", "objective-c">;
-def llvm_gcc_mxx : llvm_gcc_based<"llvm-gcc -x objective-c++", "objective-c++">;
+def llvm_gcc_c : llvm_gcc_based<"llvm-gcc -x c", "c", "i">;
+def llvm_gcc_cpp : llvm_gcc_based<"llvm-g++ -x c++", "c++", "i">;
+def llvm_gcc_m : llvm_gcc_based<"llvm-gcc -x objective-c", "objective-c", "mi">;
+def llvm_gcc_mxx : llvm_gcc_based<"llvm-gcc -x objective-c++",
+ "objective-c++", "mi">;
def opt : Tool<
[(in_language "llvm-bitcode"),
Modified: llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Clang/Clang.td?rev=60764&r1=60763&r2=60764&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Clang/Clang.td (original)
+++ llvm/trunk/tools/llvmc/plugins/Clang/Clang.td Tue Dec 9 08:40:18 2008
@@ -1,15 +1,20 @@
// 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>;
def Options : OptionList<[
+// Extern options
(switch_option "E", (extern)),
+(switch_option "S", (extern)),
(switch_option "c", (extern)),
(switch_option "fsyntax-only", (extern)),
(switch_option "emit-llvm", (extern)),
@@ -20,6 +25,7 @@
(parameter_list_option "l", (extern)),
(prefix_list_option "Wa,", (extern)),
(prefix_list_option "Wl,", (extern)),
+
(switch_option "clang", (help "Use Clang instead of llvm-gcc"))
]>;
@@ -34,15 +40,17 @@
!strconcat(cmd, " -E $INFILE -o $OUTFILE"),
(default),
!strconcat(cmd, " -E $INFILE")),
- (switch_on "c"),
- !strconcat(cmd, " -fsyntax-only $INFILE"),
+ (and (switch_on "S"), (switch_on "emit-llvm")),
+ !strconcat(cmd, " -emit-llvm $INFILE -o $OUTFILE"),
(default),
!strconcat(cmd, " -emit-llvm-bc $INFILE -o $OUTFILE"))),
(actions (case (switch_on "E"),
[(stop_compilation), (output_suffix ext_E)],
- (switch_on "c"), (stop_compilation),
(switch_on "fsyntax-only"), (stop_compilation),
- (switch_on "emit-llvm"), (stop_compilation),
+ (and (switch_on "S"), (switch_on "emit-llvm")),
+ [(stop_compilation), (output_suffix "ll")],
+ (and (switch_on "c"), (switch_on "emit-llvm")),
+ (stop_compilation),
(not_empty "include"), (forward "include"),
(not_empty "I"), (forward "I"))),
(sink)
@@ -60,7 +68,8 @@
(out_language "object-code"),
(output_suffix "o"),
(cmd_line "as $INFILE -o $OUTFILE"),
- (actions (case (not_empty "Wa,"), (unpack_values "Wa,")))
+ (actions (case (not_empty "Wa,"), (unpack_values "Wa,"),
+ (switch_on "c"), (stop_compilation)))
]>;
// Default linker
More information about the llvm-commits
mailing list