f4c73cb735b265a3965d56b2b48329f4d135e3f6
[oota-llvm.git] / tools / llvmc2 / Tools.td
1 //===- Tools.td - Tools description for the LLVMCC  --------*- tablegen -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains descriptions of the various build tools run by llvmcc.
11 //
12 //===----------------------------------------------------------------------===//
13
14 // Open issue: should we use DAG lists in Tool specifications
15 // or change to something like
16 // def LLVMGccC : < Tool<
17 // [ InLanguage<"c">,
18 //   PrefixListOption<"Wl", [UnpackValues, PropertyName<Arg>, ...]>
19 //  ...] ?
20 // DAG lists look more aesthetically pleasing to me.
21
22 def llvm_gcc_c : Tool<
23 [(in_language "c"),
24  (out_language "llvm-bitcode"),
25  (output_suffix "bc"),
26  (cmd_line "llvm-gcc -c $INFILE -o $OUTFILE -emit-llvm"),
27  (sink)
28 ]>;
29
30 def llvm_gcc_cpp : Tool<
31 [(in_language "c++"),
32  (out_language "llvm-bitcode"),
33  (output_suffix "bc"),
34  (cmd_line "llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm"),
35  (sink)
36 ]>;
37
38 def opt : Tool<
39 [(in_language "llvm-bitcode"),
40  (out_language "llvm-bitcode"),
41  (switch_option "S", (help "Test switch")),
42  (parameter_option "O", (help "Test Parameter")),
43  (prefix_list_option "P", (help "Test Parameter List")),
44  (output_suffix "bc"),
45  (cmd_line "opt $INFILE -o $OUTFILE")
46 ]>;
47
48 def llvm_as : Tool<
49 [(in_language "llvm-assembler"),
50  (out_language "llvm-bitcode"),
51  (output_suffix "bc"),
52  (cmd_line "llvm-as $INFILE -o $OUTFILE")
53 ]>;
54
55 def llc : Tool<
56 [(in_language "llvm-bitcode"),
57  (out_language "assembler"),
58  (output_suffix "s"),
59  (cmd_line "llc $INFILE -o $OUTFILE")
60 ]>;
61
62 def llvm_gcc_assembler : Tool<
63 [(in_language "assembler"),
64  (out_language "object-code"),
65  (output_suffix "o"),
66  (cmd_line "llvm-gcc -c $INFILE -o $OUTFILE"),
67  (prefix_list_option "Wa", (unpack_values), (help "pass options to assembler"))
68 ]>;
69
70 def llvm_gcc_linker : Tool<
71 [(in_language "object-code"),
72  (out_language "executable"),
73  (output_suffix "out"),
74  (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
75  (join),
76  (prefix_list_option "L", (forward), (help "add a directory to link path")),
77  (prefix_list_option "l", (forward), (help "search a library when linking")),
78  (prefix_list_option "Wl", (unpack_values), (help "pass options to linker"))
79 ]>;
80
81 // Language map
82
83 def LanguageMap : LanguageMap<
84     [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
85      LangToSuffixes<"c", ["c"]>,
86      LangToSuffixes<"assembler", ["s"]>,
87      LangToSuffixes<"llvm-assembler", ["ll"]>,
88      LangToSuffixes<"llvm-bitcode", ["bc"]>,
89      LangToSuffixes<"object-code", ["o"]>,
90      LangToSuffixes<"executable", ["out"]>]>;