1 //===- Tools.td - Tools description for the LLVMCC --------*- 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 llvmcc.
12 //===----------------------------------------------------------------------===//
14 // TOTHINK: Open issue: should we use DAG lists in Tool specifications
15 // or change to something like
17 // def LLVMGccC : < Tool<
19 // PrefixListOption<"Wl", [UnpackValues, PropertyName<Arg>, ...]>
22 // DAG lists look more aesthetically pleasing to me.
24 def llvm_gcc_c : Tool<
26 (out_language "llvm-bitcode"),
30 "llvm-g++ -E -x c $INFILE -o $OUTFILE -emit-llvm",
32 "llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm")),
33 // TOFIX: Preprocessed files currently have suffix ".bc".
34 (switch_option "E", (stop_compilation),
35 // Make this possible:
36 // (output_suffix "i"),
37 (help "Stop after the preprocessing stage, do not run the compiler")),
41 def llvm_gcc_cpp : Tool<
43 (out_language "llvm-bitcode"),
47 "llvm-g++ -E -x c++ $INFILE -o $OUTFILE -emit-llvm",
49 "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
50 (switch_option "E", (stop_compilation)),
55 [(in_language "llvm-bitcode"),
56 (out_language "llvm-bitcode"),
57 (switch_option "opt", (help "Enable opt")),
59 (cmd_line "opt $INFILE -o $OUTFILE")
63 [(in_language "llvm-assembler"),
64 (out_language "llvm-bitcode"),
66 (cmd_line "llvm-as $INFILE -o $OUTFILE")
70 [(in_language "llvm-bitcode"),
71 (out_language "assembler"),
73 (switch_option "S", (stop_compilation),
74 (help "Stop after compilation, do not assemble")),
75 (cmd_line "llc -f $INFILE -o $OUTFILE")
78 def llvm_gcc_assembler : Tool<
79 [(in_language "assembler"),
80 (out_language "object-code"),
82 (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
83 (switch_option "c", (stop_compilation),
84 (help "Compile and assemble, but do not link")),
85 (prefix_list_option "Wa,", (unpack_values), (help "pass options to assembler"))
89 def llvm_gcc_linker : Tool<
90 [(in_language "object-code"),
91 (out_language "executable"),
92 (output_suffix "out"),
93 (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
95 (prefix_list_option "L", (forward), (help "add a directory to link path")),
96 (prefix_list_option "l", (forward), (help "search a library when linking")),
97 (prefix_list_option "Wl,", (unpack_values), (help "pass options to linker"))
100 // Alternative linker for C++
101 def llvm_gcc_cpp_linker : Tool<
102 [(in_language "object-code"),
103 (out_language "executable"),
104 (output_suffix "out"),
105 (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
107 (parameter_option "linker",
108 (help "Choose linker (possible values: gcc, g++)")),
109 (prefix_list_option "L", (forward)),
110 (prefix_list_option "l", (forward)),
111 (prefix_list_option "Wl,", (unpack_values))
116 def LanguageMap : LanguageMap<
117 [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
118 LangToSuffixes<"c", ["c"]>,
119 LangToSuffixes<"assembler", ["s"]>,
120 LangToSuffixes<"llvm-assembler", ["ll"]>,
121 LangToSuffixes<"llvm-bitcode", ["bc"]>,
122 LangToSuffixes<"object-code", ["o"]>,
123 LangToSuffixes<"executable", ["out"]>