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 (case (not_empty "o"),
31 "llvm-gcc -E -x c++ $INFILE -o $OUTFILE",
33 "llvm-gcc -E -x c++ $INFILE"),
35 "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm")),
36 (switch_option "E", (stop_compilation),
37 (help "Stop after the preprocessing stage, do not run the compiler")),
41 def llvm_gcc_cpp : Tool<
43 (out_language "llvm-bitcode"),
47 (case (not_empty "o"),
48 "llvm-g++ -E -x c++ $INFILE -o $OUTFILE",
50 "llvm-g++ -E -x c++ $INFILE"),
52 "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
53 (switch_option "E", (stop_compilation)),
58 [(in_language "llvm-bitcode"),
59 (out_language "llvm-bitcode"),
60 (switch_option "opt", (help "Enable opt")),
62 (cmd_line "opt -f $INFILE -o $OUTFILE")
66 [(in_language "llvm-assembler"),
67 (out_language "llvm-bitcode"),
69 (cmd_line "llvm-as $INFILE -o $OUTFILE")
73 [(in_language "llvm-bitcode"),
74 (out_language "assembler"),
76 (switch_option "S", (stop_compilation),
77 (help "Stop after compilation, do not assemble")),
78 (cmd_line "llc -f $INFILE -o $OUTFILE")
81 def llvm_gcc_assembler : Tool<
82 [(in_language "assembler"),
83 (out_language "object-code"),
85 (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
86 (switch_option "c", (stop_compilation),
87 (help "Compile and assemble, but do not link")),
88 (prefix_list_option "Wa,", (unpack_values), (help "Pass options to assembler"))
92 def llvm_gcc_linker : Tool<
93 [(in_language "object-code"),
94 (out_language "executable"),
95 (output_suffix "out"),
96 (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
98 (prefix_list_option "L", (forward), (help "Add a directory to link path")),
99 (prefix_list_option "l", (forward), (help "Search a library when linking")),
100 (prefix_list_option "Wl,", (unpack_values), (help "Pass options to linker"))
103 // Alternative linker for C++
104 def llvm_gcc_cpp_linker : Tool<
105 [(in_language "object-code"),
106 (out_language "executable"),
107 (output_suffix "out"),
108 (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
110 (parameter_option "linker",
111 (help "Choose linker (possible values: gcc, g++)")),
112 (prefix_list_option "L", (forward)),
113 (prefix_list_option "l", (forward)),
114 (prefix_list_option "Wl,", (unpack_values))
119 def LanguageMap : LanguageMap<
120 [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
121 LangToSuffixes<"c", ["c"]>,
122 LangToSuffixes<"assembler", ["s"]>,
123 LangToSuffixes<"llvm-assembler", ["ll"]>,
124 LangToSuffixes<"llvm-bitcode", ["bc"]>,
125 LangToSuffixes<"object-code", ["o"]>,
126 LangToSuffixes<"executable", ["out"]>