2008-03-23 08:57:20 +00:00
|
|
|
//===- Tools.td - Tools description for the LLVMCC --------*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains descriptions of the various build tools run by llvmcc.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-05-06 18:10:20 +00:00
|
|
|
// TOTHINK: Open issue: should we use DAG lists in Tool specifications
|
2008-03-23 08:57:20 +00:00
|
|
|
// or change to something like
|
2008-05-06 18:10:20 +00:00
|
|
|
|
2008-03-23 08:57:20 +00:00
|
|
|
// def LLVMGccC : < Tool<
|
|
|
|
// [ InLanguage<"c">,
|
|
|
|
// PrefixListOption<"Wl", [UnpackValues, PropertyName<Arg>, ...]>
|
|
|
|
// ...] ?
|
2008-05-06 18:10:20 +00:00
|
|
|
|
2008-03-23 08:57:20 +00:00
|
|
|
// DAG lists look more aesthetically pleasing to me.
|
|
|
|
|
|
|
|
def llvm_gcc_c : Tool<
|
|
|
|
[(in_language "c"),
|
2008-05-06 16:36:06 +00:00
|
|
|
(out_language "llvm-bitcode"),
|
2008-03-23 08:57:20 +00:00
|
|
|
(output_suffix "bc"),
|
2008-05-30 06:10:19 +00:00
|
|
|
(cmd_line (case
|
|
|
|
(switch_on "E"),
|
|
|
|
"llvm-g++ -E -x c $INFILE -o $OUTFILE -emit-llvm",
|
|
|
|
(default),
|
|
|
|
"llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm")),
|
2008-05-30 06:13:02 +00:00
|
|
|
(switch_option "E", (stop_compilation),(output_suffix "i"),
|
2008-05-08 20:02:36 +00:00
|
|
|
(help "Stop after the preprocessing stage, do not run the compiler")),
|
2008-03-23 08:57:20 +00:00
|
|
|
(sink)
|
|
|
|
]>;
|
|
|
|
|
|
|
|
def llvm_gcc_cpp : Tool<
|
|
|
|
[(in_language "c++"),
|
2008-05-06 16:36:06 +00:00
|
|
|
(out_language "llvm-bitcode"),
|
2008-03-23 08:57:20 +00:00
|
|
|
(output_suffix "bc"),
|
2008-05-30 06:10:19 +00:00
|
|
|
(cmd_line (case
|
|
|
|
(switch_on "E"),
|
|
|
|
"llvm-g++ -E -x c++ $INFILE -o $OUTFILE -emit-llvm",
|
|
|
|
(default),
|
|
|
|
"llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
|
2008-05-30 06:13:02 +00:00
|
|
|
(switch_option "E", (stop_compilation), (output_suffix "i")),
|
2008-03-23 08:57:20 +00:00
|
|
|
(sink)
|
|
|
|
]>;
|
|
|
|
|
|
|
|
def opt : Tool<
|
|
|
|
[(in_language "llvm-bitcode"),
|
|
|
|
(out_language "llvm-bitcode"),
|
2008-05-06 17:23:50 +00:00
|
|
|
(switch_option "opt", (help "Enable opt")),
|
2008-03-23 08:57:20 +00:00
|
|
|
(output_suffix "bc"),
|
|
|
|
(cmd_line "opt $INFILE -o $OUTFILE")
|
|
|
|
]>;
|
|
|
|
|
|
|
|
def llvm_as : Tool<
|
|
|
|
[(in_language "llvm-assembler"),
|
|
|
|
(out_language "llvm-bitcode"),
|
|
|
|
(output_suffix "bc"),
|
|
|
|
(cmd_line "llvm-as $INFILE -o $OUTFILE")
|
|
|
|
]>;
|
|
|
|
|
|
|
|
def llc : Tool<
|
|
|
|
[(in_language "llvm-bitcode"),
|
|
|
|
(out_language "assembler"),
|
|
|
|
(output_suffix "s"),
|
2008-05-08 20:02:36 +00:00
|
|
|
(switch_option "S", (stop_compilation),
|
|
|
|
(help "Stop after compilation, do not assemble")),
|
2008-05-06 18:10:53 +00:00
|
|
|
(cmd_line "llc -f $INFILE -o $OUTFILE")
|
2008-03-23 08:57:20 +00:00
|
|
|
]>;
|
|
|
|
|
|
|
|
def llvm_gcc_assembler : Tool<
|
|
|
|
[(in_language "assembler"),
|
|
|
|
(out_language "object-code"),
|
|
|
|
(output_suffix "o"),
|
2008-05-06 18:10:20 +00:00
|
|
|
(cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
|
2008-05-06 18:17:42 +00:00
|
|
|
(switch_option "c", (stop_compilation),
|
|
|
|
(help "Compile and assemble, but do not link")),
|
2008-05-12 16:33:06 +00:00
|
|
|
(prefix_list_option "Wa,", (unpack_values), (help "pass options to assembler"))
|
2008-03-23 08:57:20 +00:00
|
|
|
]>;
|
|
|
|
|
2008-05-06 18:10:53 +00:00
|
|
|
// Default linker
|
2008-03-23 08:57:20 +00:00
|
|
|
def llvm_gcc_linker : Tool<
|
|
|
|
[(in_language "object-code"),
|
|
|
|
(out_language "executable"),
|
|
|
|
(output_suffix "out"),
|
|
|
|
(cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
|
|
|
|
(join),
|
|
|
|
(prefix_list_option "L", (forward), (help "add a directory to link path")),
|
|
|
|
(prefix_list_option "l", (forward), (help "search a library when linking")),
|
2008-05-12 16:33:06 +00:00
|
|
|
(prefix_list_option "Wl,", (unpack_values), (help "pass options to linker"))
|
2008-03-23 08:57:20 +00:00
|
|
|
]>;
|
|
|
|
|
2008-05-06 18:10:53 +00:00
|
|
|
// Alternative linker for C++
|
2008-05-06 18:13:00 +00:00
|
|
|
def llvm_gcc_cpp_linker : Tool<
|
|
|
|
[(in_language "object-code"),
|
|
|
|
(out_language "executable"),
|
|
|
|
(output_suffix "out"),
|
|
|
|
(cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
|
|
|
|
(join),
|
|
|
|
(parameter_option "linker",
|
|
|
|
(help "Choose linker (possible values: gcc, g++)")),
|
|
|
|
(prefix_list_option "L", (forward)),
|
|
|
|
(prefix_list_option "l", (forward)),
|
2008-05-12 16:33:06 +00:00
|
|
|
(prefix_list_option "Wl,", (unpack_values))
|
2008-05-06 18:13:00 +00:00
|
|
|
]>;
|
2008-05-06 18:10:53 +00:00
|
|
|
|
2008-03-23 08:57:20 +00:00
|
|
|
// Language map
|
|
|
|
|
|
|
|
def LanguageMap : LanguageMap<
|
|
|
|
[LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
|
|
|
|
LangToSuffixes<"c", ["c"]>,
|
|
|
|
LangToSuffixes<"assembler", ["s"]>,
|
|
|
|
LangToSuffixes<"llvm-assembler", ["ll"]>,
|
|
|
|
LangToSuffixes<"llvm-bitcode", ["bc"]>,
|
|
|
|
LangToSuffixes<"object-code", ["o"]>,
|
2008-05-06 18:10:20 +00:00
|
|
|
LangToSuffixes<"executable", ["out"]>
|
|
|
|
]>;
|