aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-12-07 16:46:23 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-12-07 16:46:23 +0000
commita23cdedf3fd78fed276e32421da4de967f3b7d3b (patch)
tree7919408eba2ba0b617e6fa62335e17f969a7d766 /tools
parentb1cd683cf644d649809b925cb91bfe42d729e3f2 (diff)
downloadexternal_llvm-a23cdedf3fd78fed276e32421da4de967f3b7d3b.zip
external_llvm-a23cdedf3fd78fed276e32421da4de967f3b7d3b.tar.gz
external_llvm-a23cdedf3fd78fed276e32421da4de967f3b7d3b.tar.bz2
Plugin updates: support more options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60666 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvmc/plugins/Clang/Clang.td79
1 files changed, 57 insertions, 22 deletions
diff --git a/tools/llvmc/plugins/Clang/Clang.td b/tools/llvmc/plugins/Clang/Clang.td
index 4e1bd1d..2267baf 100644
--- a/tools/llvmc/plugins/Clang/Clang.td
+++ b/tools/llvmc/plugins/Clang/Clang.td
@@ -6,14 +6,24 @@
include "llvm/CompilerDriver/Common.td"
+def Priority : PluginPriority<1>;
+
def Options : OptionList<[
-(extern_switch "E",
- (help "Stop after the preprocessing stage, do not run the compiler")),
-(extern_list "L", (help "Specify a library search path")),
+(extern_switch "E"),
+(extern_switch "c"),
+(extern_switch "fsyntax-only"),
+(extern_switch "emit-llvm"),
+(extern_switch "pthread"),
+(extern_list "I"),
+(extern_list "include"),
+(extern_list "L"),
+(extern_list "l"),
+(extern_list "Wa,"),
+(extern_list "Wl,"),
(switch_option "clang", (help "Use Clang instead of llvm-gcc"))
]>;
-class clang_based<string language, string cmd> : Tool<
+class clang_based<string language, string cmd, string ext_E> : Tool<
[(in_language language),
(out_language "llvm-bitcode"),
(output_suffix "bc"),
@@ -24,38 +34,58 @@ class clang_based<string language, string cmd> : Tool<
!strconcat(cmd, " -E $INFILE -o $OUTFILE"),
(default),
!strconcat(cmd, " -E $INFILE")),
+ (switch_on "c"),
+ !strconcat(cmd, " -fsyntax-only $INFILE"),
(default),
!strconcat(cmd, " -emit-llvm-bc $INFILE -o $OUTFILE"))),
(actions (case (switch_on "E"),
- [(stop_compilation), (output_suffix "i")])),
+ [(stop_compilation), (output_suffix ext_E)],
+ (switch_on "c"), (stop_compilation),
+ (switch_on "fsyntax-only"), (stop_compilation),
+ (switch_on "emit-llvm"), (stop_compilation),
+ (not_empty "include"), (forward "include"),
+ (not_empty "I"), (forward "I"))),
(sink)
]>;
-def clang_c : clang_based<"c", "clang -x c">;
-def clang_cpp : clang_based<"c++", "clang -x c++">;
-def clang_objective_c : clang_based<"objective-c", "clang -x objective-c">;
+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++">;
+ "clang -x objective-c++", "mi">;
+
+def as : Tool<
+[(in_language "assembler"),
+ (out_language "object-code"),
+ (output_suffix "o"),
+ (cmd_line "as $INFILE -o $OUTFILE"),
+ (actions (case (not_empty "Wa,"), (unpack_values "Wa,")))
+]>;
// Default linker
def llvm_ld : Tool<
-[(in_language "llvm-bitcode"),
+[(in_language "object-code"),
(out_language "executable"),
(output_suffix "out"),
(cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"),
- (actions (case (not_empty "L"), (forward "L"))),
+ (actions (case
+ (switch_on "pthread"), (append_cmd "-lpthread"),
+ (not_empty "L"), (forward "L"),
+ (not_empty "l"), (forward "l"),
+ (not_empty "Wl,"), (unpack_values "Wl,"))),
(join)
]>;
// Language map
-def LanguageMap : LanguageMap<
- [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
- LangToSuffixes<"c", ["c"]>,
- LangToSuffixes<"objective-c", ["m"]>,
- LangToSuffixes<"c-cpp-output", ["i"]>,
- LangToSuffixes<"objective-c-cpp-output", ["mi"]>
- ]>;
+def LanguageMap : LanguageMap<[
+ LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
+ LangToSuffixes<"c", ["c"]>,
+ LangToSuffixes<"objective-c", ["m"]>,
+ LangToSuffixes<"c-cpp-output", ["i"]>,
+ LangToSuffixes<"objective-c-cpp-output", ["mi"]>
+]>;
// Compilation graph
@@ -66,7 +96,12 @@ def CompilationGraph : CompilationGraph<[
(case (switch_on "clang"), (inc_weight))>,
OptionalEdge<"root", "clang_objective_c",
(case (switch_on "clang"), (inc_weight))>,
- Edge<"clang_c", "llvm_ld">,
- Edge<"clang_cpp", "llvm_ld">,
- Edge<"clang_objective_c", "llvm_ld">
- ]>;
+ OptionalEdge<"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">,
+ OptionalEdge<"llc", "as", (case (switch_on "clang"), (inc_weight))>,
+ Edge<"as", "llvm_ld">
+]>;