A basic PIC16 toolchain driver.
[oota-llvm.git] / tools / llvmc / example / mcc16 / plugins / PIC16Base / PIC16Base.td
1 //===- PIC16Base.td - PIC16 toolchain driver ---------------*- tablegen -*-===//
2 //
3 // A basic driver for the PIC16 toolchain.
4 //
5 //===----------------------------------------------------------------------===//
6
7 include "llvm/CompilerDriver/Common.td"
8
9 // Options
10
11 def OptionList : OptionList<[
12  (switch_option "g",
13     (help "Disable optimizations")),
14  (switch_option "S",
15     (help "Stop after compilation, do not assemble")),
16  (parameter_option "I",
17     (help "Add a directory to include path")),
18  (parameter_option "pre-RA-sched",
19     (help "Example of an option that is passed to llc")),
20  (prefix_list_option "Wa,",
21     (help "Pass options to native assembler")),
22  (prefix_list_option "Wl,",
23     (help "Pass options to native linker")),
24  (prefix_list_option "Wllc,",
25     (help "Pass options to llc")),
26  (prefix_list_option "Wo,",
27     (help "Pass options to llvm-ld"))
28 ]>;
29
30 // Tools
31
32 def clang_cc : Tool<[
33  (in_language "c"),
34  (out_language "llvm-bitcode"),
35  (output_suffix "bc"),
36  (cmd_line "clang-cc $INFILE -o $OUTFILE"),
37  (actions (case
38           (not_empty "I"), (forward "I"))),
39  (sink)
40 ]>;
41
42 def llvm_ld : Tool<[
43  (in_language "llvm-bitcode"),
44  (out_language "llvm-bitcode"),
45  (output_suffix "bc"),
46  (cmd_line "llvm-ld $INFILE -o $OUTFILE"),
47  (actions (case
48           (switch_on "g"), (append_cmd "-disable-opt"),
49           (not_empty "Wo,"), (unpack_values "Wo,")))
50 ]>;
51
52 def llvm_ld_lto : Tool<[
53  (in_language "llvm-bitcode"),
54  (out_language "llvm-bitcode"),
55  (output_suffix "bc"),
56  (cmd_line "llvm-ld $INFILE -o $OUTFILE"),
57  (actions (case
58           (switch_on "g"), (append_cmd "-disable-opt"),
59           (not_empty "Wo,"), (unpack_values "Wo,"))),
60  (join)
61 ]>;
62
63 def llc : Tool<[
64  (in_language "llvm-bitcode"),
65  (out_language "assembler"),
66  (output_suffix "s"),
67  (cmd_line "llc -f $INFILE -o $OUTFILE"),
68  (actions (case
69           (switch_on "S"), (stop_compilation),
70           (not_empty "Wllc,"), (unpack_values "Wllc,"),
71           (not_empty "pre-RA-sched"), (forward "pre-RA-sched")))
72 ]>;
73
74 def native_as : Tool<[
75  (in_language "assembler"),
76  (out_language "object-code"),
77  (output_suffix "o"),
78  (cmd_line "native-as $INFILE -o $OUTFILE"),
79  (actions (case
80           (not_empty "Wa,"), (unpack_values "Wa,")))
81 ]>;
82
83 def native_ld : Tool<[
84  (in_language "object-code"),
85  (out_language "executable"),
86  (output_suffix "out"),
87  (cmd_line "native-ld $INFILE -o $OUTFILE"),
88  (actions (case
89           (not_empty "Wl,"), (unpack_values "Wl,"))),
90  (join)
91 ]>;
92
93 // Language map
94
95 def LanguageMap : LanguageMap<[
96     LangToSuffixes<"c", ["c"]>,
97     LangToSuffixes<"c-cpp-output", ["i"]>,
98     LangToSuffixes<"assembler", ["s"]>,
99     LangToSuffixes<"assembler-with-cpp", ["S"]>,
100     LangToSuffixes<"llvm-assembler", ["ll"]>,
101     LangToSuffixes<"llvm-bitcode", ["bc"]>,
102     LangToSuffixes<"object-code", ["o"]>,
103     LangToSuffixes<"executable", ["out"]>
104 ]>;
105
106 // Compilation graph
107
108 def CompilationGraph : CompilationGraph<[
109     Edge<"root", "clang_cc">,
110     Edge<"clang_cc", "llvm_ld_lto">,
111     Edge<"llvm_ld_lto", "llc">,
112     OptionalEdge<"clang_cc", "llvm_ld", (case (switch_on "S"), (inc_weight))>,
113     Edge<"llvm_ld", "llc">,
114     Edge<"llc", "native_as">,
115     Edge<"native_as", "native_ld">
116 ]>;