blob: 67104ec2c7368f6af731e1d73b638c92306f6189 [file] [log] [blame]
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +00001//===- 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
22def llvm_gcc_c : Tool<
23[(in_language "c"),
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000024 (out_language "llvm-bitcode"),
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000025 (output_suffix "bc"),
26 (cmd_line "llvm-gcc -c $INFILE -o $OUTFILE -emit-llvm"),
27 (sink)
28]>;
29
30def llvm_gcc_cpp : Tool<
31[(in_language "c++"),
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000032 (out_language "llvm-bitcode"),
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000033 (output_suffix "bc"),
34 (cmd_line "llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm"),
35 (sink)
36]>;
37
38def opt : Tool<
39[(in_language "llvm-bitcode"),
40 (out_language "llvm-bitcode"),
Mikhail Glushenkovf68efe12008-05-06 17:23:50 +000041 (switch_option "opt", (help "Enable opt")),
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000042 (output_suffix "bc"),
43 (cmd_line "opt $INFILE -o $OUTFILE")
44]>;
45
46def llvm_as : Tool<
47[(in_language "llvm-assembler"),
48 (out_language "llvm-bitcode"),
49 (output_suffix "bc"),
50 (cmd_line "llvm-as $INFILE -o $OUTFILE")
51]>;
52
53def llc : Tool<
54[(in_language "llvm-bitcode"),
55 (out_language "assembler"),
56 (output_suffix "s"),
57 (cmd_line "llc $INFILE -o $OUTFILE")
58]>;
59
60def llvm_gcc_assembler : Tool<
61[(in_language "assembler"),
62 (out_language "object-code"),
63 (output_suffix "o"),
64 (cmd_line "llvm-gcc -c $INFILE -o $OUTFILE"),
65 (prefix_list_option "Wa", (unpack_values), (help "pass options to assembler"))
66]>;
67
68def llvm_gcc_linker : Tool<
69[(in_language "object-code"),
70 (out_language "executable"),
71 (output_suffix "out"),
72 (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
73 (join),
74 (prefix_list_option "L", (forward), (help "add a directory to link path")),
75 (prefix_list_option "l", (forward), (help "search a library when linking")),
76 (prefix_list_option "Wl", (unpack_values), (help "pass options to linker"))
77]>;
78
79// Language map
80
81def LanguageMap : LanguageMap<
82 [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
83 LangToSuffixes<"c", ["c"]>,
84 LangToSuffixes<"assembler", ["s"]>,
85 LangToSuffixes<"llvm-assembler", ["ll"]>,
86 LangToSuffixes<"llvm-bitcode", ["bc"]>,
87 LangToSuffixes<"object-code", ["o"]>,
88 LangToSuffixes<"executable", ["out"]>]>;