1 //===- PIC16Base.td - PIC16 toolchain driver ---------------*- tablegen -*-===//
3 // A basic driver for the PIC16 toolchain.
5 //===----------------------------------------------------------------------===//
7 include "llvm/CompilerDriver/Common.td"
11 def OptionList : OptionList<[
13 (help "Enable Debugging")),
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"))
34 (out_language "llvm-bitcode"),
36 (cmd_line "$CALL(GetBinDir)clang-cc -I $CALL(GetStdHeadersDir) -triple=pic16- -emit-llvm-bc $INFILE -o $OUTFILE"),
38 (not_empty "I"), (forward "I"))),
43 (in_language "llvm-bitcode"),
44 (out_language "llvm-bitcode"),
46 (cmd_line "llvm-ld -f -link-as-library $INFILE -o $OUTFILE"),
48 (switch_on "g"), (append_cmd "-disable-opt"),
49 (not_empty "Wo,"), (unpack_values "Wo,")))
52 def llvm_ld_lto : Tool<[
53 (in_language "llvm-bitcode"),
54 (out_language "llvm-bitcode"),
56 (cmd_line "llvm-ld -link-as-library $INFILE -o $OUTFILE"),
58 (switch_on "g"), (append_cmd "-disable-opt"),
59 (not_empty "Wo,"), (unpack_values "Wo,"))),
64 (in_language "llvm-bitcode"),
65 (out_language "assembler"),
67 (cmd_line "llc -march=pic16 -f $INFILE -o $OUTFILE"),
69 (switch_on "S"), (stop_compilation),
70 (not_empty "Wllc,"), (unpack_values "Wllc,"),
71 (not_empty "pre-RA-sched"), (forward "pre-RA-sched")))
75 (in_language "assembler"),
76 (out_language "object-code"),
78 (cmd_line "gpasm -I $CALL(GetStdAsmHeadersDir) $INFILE -o $OUTFILE"),
80 (not_empty "Wa,"), (unpack_values "Wa,")))
84 (in_language "object-code"),
85 (out_language "executable"),
86 (output_suffix "out"),
87 (cmd_line "mplink /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) $INFILE -o $OUTFILE"),
89 (not_empty "Wl,"), (unpack_values "Wl,"))),
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"]>
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", "gpasm">,
115 Edge<"gpasm", "mplink">