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"),
28 (cmd_line "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm"),
32 def llvm_gcc_cpp : Tool<
34 (out_language "llvm-bitcode"),
36 (cmd_line "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm"),
41 [(in_language "llvm-bitcode"),
42 (out_language "llvm-bitcode"),
43 (switch_option "opt", (help "Enable opt")),
45 (cmd_line "opt $INFILE -o $OUTFILE")
49 [(in_language "llvm-assembler"),
50 (out_language "llvm-bitcode"),
52 (cmd_line "llvm-as $INFILE -o $OUTFILE")
56 [(in_language "llvm-bitcode"),
57 (out_language "assembler"),
59 (cmd_line "llc -f $INFILE -o $OUTFILE")
62 def llvm_gcc_assembler : Tool<
63 [(in_language "assembler"),
64 (out_language "object-code"),
66 (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
67 (switch_option "c", (stop_compilation),
68 (help "Compile and assemble, but do not link")),
69 (prefix_list_option "Wa", (unpack_values), (help "pass options to assembler"))
73 def llvm_gcc_linker : Tool<
74 [(in_language "object-code"),
75 (out_language "executable"),
76 (output_suffix "out"),
77 (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
79 (prefix_list_option "L", (forward), (help "add a directory to link path")),
80 (prefix_list_option "l", (forward), (help "search a library when linking")),
81 (prefix_list_option "Wl", (unpack_values), (help "pass options to linker"))
84 // Alternative linker for C++
85 def llvm_gcc_cpp_linker : Tool<
86 [(in_language "object-code"),
87 (out_language "executable"),
88 (output_suffix "out"),
89 (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
91 (parameter_option "linker",
92 (help "Choose linker (possible values: gcc, g++)")),
93 (prefix_list_option "L", (forward)),
94 (prefix_list_option "l", (forward)),
95 (prefix_list_option "Wl", (unpack_values))
100 def LanguageMap : LanguageMap<
101 [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
102 LangToSuffixes<"c", ["c"]>,
103 LangToSuffixes<"assembler", ["s"]>,
104 LangToSuffixes<"llvm-assembler", ["ll"]>,
105 LangToSuffixes<"llvm-bitcode", ["bc"]>,
106 LangToSuffixes<"object-code", ["o"]>,
107 LangToSuffixes<"executable", ["out"]>