1 //===- Tools.td - Tools description for LLVMC2 -------------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains descriptions of the various build tools run by llvmc2.
12 //===----------------------------------------------------------------------===//
14 def llvm_gcc_c : Tool<
16 (out_language "llvm-bitcode"),
20 (case (not_empty "o"),
21 "llvm-gcc -E -x c++ $INFILE -o $OUTFILE",
23 "llvm-gcc -E -x c++ $INFILE"),
25 "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm")),
26 (switch_option "E", (stop_compilation),
27 (help "Stop after the preprocessing stage, do not run the compiler")),
31 def llvm_gcc_cpp : Tool<
33 (out_language "llvm-bitcode"),
37 (case (not_empty "o"),
38 "llvm-g++ -E -x c++ $INFILE -o $OUTFILE",
40 "llvm-g++ -E -x c++ $INFILE"),
42 "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
43 (switch_option "E", (stop_compilation)),
47 def llvm_gcc_m : Tool<
48 [(in_language "objective-c"),
49 (out_language "llvm-bitcode"),
53 (case (not_empty "o"),
54 "llvm-gcc -E -x objective-c $INFILE -o $OUTFILE",
56 "llvm-gcc -E -x objective-c $INFILE"),
58 "llvm-gcc -c -x objective-c $INFILE -o $OUTFILE -emit-llvm")),
59 (switch_option "E", (stop_compilation)),
63 def llvm_gcc_mxx : Tool<
64 [(in_language "objective-c++"),
65 (out_language "llvm-bitcode"),
69 (case (not_empty "o"),
70 "llvm-gcc -E -x objective-c++ $INFILE -o $OUTFILE",
72 "llvm-gcc -E -x objective-c++ $INFILE"),
74 "llvm-gcc -c -x objective-c++ $INFILE -o $OUTFILE -emit-llvm")),
75 (switch_option "E", (stop_compilation)),
80 [(in_language "llvm-bitcode"),
81 (out_language "llvm-bitcode"),
82 (switch_option "opt", (help "Enable opt")),
84 (cmd_line "opt -f $INFILE -o $OUTFILE")
88 [(in_language "llvm-assembler"),
89 (out_language "llvm-bitcode"),
91 (cmd_line "llvm-as $INFILE -o $OUTFILE")
95 [(in_language "llvm-bitcode"),
96 (out_language "assembler"),
98 (switch_option "S", (stop_compilation),
99 (help "Stop after compilation, do not assemble")),
100 (cmd_line "llc -f $INFILE -o $OUTFILE")
103 def llvm_gcc_assembler : Tool<
104 [(in_language "assembler"),
105 (out_language "object-code"),
107 (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
108 (switch_option "c", (stop_compilation),
109 (help "Compile and assemble, but do not link")),
110 (prefix_list_option "Wa,", (unpack_values), (help "Pass options to assembler"))
114 def llvm_gcc_linker : Tool<
115 [(in_language "object-code"),
116 (out_language "executable"),
117 (output_suffix "out"),
118 (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
120 (prefix_list_option "L", (forward), (help "Add a directory to link path")),
121 (prefix_list_option "l", (forward), (help "Search a library when linking")),
122 (prefix_list_option "Wl,", (unpack_values), (help "Pass options to linker"))
125 // Alternative linker for C++
126 def llvm_gcc_cpp_linker : Tool<
127 [(in_language "object-code"),
128 (out_language "executable"),
129 (output_suffix "out"),
130 (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
132 (parameter_option "linker",
133 (help "Choose linker (possible values: gcc, g++)")),
134 (prefix_list_option "L", (forward)),
135 (prefix_list_option "l", (forward)),
136 (prefix_list_option "Wl,", (unpack_values))
141 def LanguageMap : LanguageMap<
142 [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
143 LangToSuffixes<"c", ["c"]>,
144 LangToSuffixes<"objective-c++", ["mm"]>,
145 LangToSuffixes<"objective-c", ["m"]>,
146 LangToSuffixes<"assembler", ["s"]>,
147 LangToSuffixes<"llvm-assembler", ["ll"]>,
148 LangToSuffixes<"llvm-bitcode", ["bc"]>,
149 LangToSuffixes<"object-code", ["o"]>,
150 LangToSuffixes<"executable", ["out"]>