diff options
Diffstat (limited to 'tools/llvmc/plugins/Base/Base.td.in')
-rw-r--r-- | tools/llvmc/plugins/Base/Base.td.in | 146 |
1 files changed, 98 insertions, 48 deletions
diff --git a/tools/llvmc/plugins/Base/Base.td.in b/tools/llvmc/plugins/Base/Base.td.in index c94c3dfb1c..ac0f665925 100644 --- a/tools/llvmc/plugins/Base/Base.td.in +++ b/tools/llvmc/plugins/Base/Base.td.in @@ -25,13 +25,13 @@ def OptList : OptionList<[ (switch_option "opt", (help "Enable opt")), (switch_option "O0", - (help "Turn off optimization")), + (help "Turn off optimization"), (zero_or_more)), (switch_option "O1", - (help "Optimization level 1")), + (help "Optimization level 1"), (zero_or_more)), (switch_option "O2", - (help "Optimization level 2")), + (help "Optimization level 2"), (zero_or_more)), (switch_option "O3", - (help "Optimization level 3")), + (help "Optimization level 3"), (zero_or_more)), (switch_option "S", (help "Stop after compilation, do not assemble")), (switch_option "c", @@ -49,12 +49,7 @@ def OptList : OptionList<[ (parameter_option "linker", (help "Choose linker (possible values: gcc, g++)")), (parameter_option "mtune", - (help "Target a specific CPU type"), (hidden)), - (parameter_option "fmessage-length", - (help "Format error messages to fit on lines of about n characters "), - (hidden)), - (parameter_option "std", - (help "Determine the language standard"), (hidden)), + (help "Target a specific CPU type"), (hidden), (forward_not_split)), // TODO: Add a conditional compilation mechanism to make Darwin-only options // like '-arch' really Darwin-only. @@ -62,9 +57,11 @@ def OptList : OptionList<[ (parameter_option "arch", (help "Compile for the specified target architecture"), (hidden)), (parameter_option "march", - (help "A synonym for -mtune"), (hidden)), + (help "A synonym for -mtune"), (hidden), (forward_not_split)), (parameter_option "mcpu", - (help "A deprecated synonym for -mtune"), (hidden)), + (help "A deprecated synonym for -mtune"), (hidden), (forward_not_split)), + (switch_option "mfix-and-continue", + (help "Needed by gdb to load .o files dynamically"), (hidden)), (parameter_option "MF", (help "Specify a file to write dependencies to"), (hidden)), (parameter_list_option "MT", @@ -79,14 +76,20 @@ def OptList : OptionList<[ (help "Specifies a framework to link against")), (parameter_list_option "weak_framework", (help "Specifies a framework to weakly link against"), (hidden)), + (parameter_option "filelist", (hidden), + (help "Link the files listed in file")), (prefix_list_option "F", (help "Add a directory to framework search path")), (prefix_list_option "I", (help "Add a directory to include path")), (prefix_list_option "D", (help "Define a macro")), + (parameter_list_option "Xpreprocessor", (hidden), + (help "Pass options to preprocessor")), (prefix_list_option "Wa,", (comma_separated), (help "Pass options to assembler")), + (parameter_list_option "Xassembler", (hidden), + (help "Pass options to assembler")), (prefix_list_option "Wllc,", (comma_separated), (help "Pass options to llc")), (prefix_list_option "L", @@ -95,11 +98,27 @@ def OptList : OptionList<[ (help "Search a library when linking")), (prefix_list_option "Wl,", (help "Pass options to linker")), + (parameter_list_option "Xlinker", (hidden), + (help "Pass options to linker")), (prefix_list_option "Wo,", (comma_separated), (help "Pass options to opt")), (prefix_list_option "m", (help "Enable or disable various extensions (-mmmx, -msse, etc.)"), - (hidden)) + (hidden)), + (switch_option "dynamiclib", (hidden), + (help "Produce a dynamic library")), + (switch_option "prebind", (hidden), + (help "Prebind all undefined symbols")), + (switch_option "dead_strip", (hidden), + (help "Remove unreachable blocks of code")), + (switch_option "single_module", (hidden), + (help "Build the library so it contains only one module")), + (parameter_option "install_name", (hidden), + (help "File name the library will be installed in")), + (parameter_option "compatibility_version", (hidden), + (help "Compatibility version number")), + (parameter_option "current_version", (hidden), + (help "Current version number")) ]>; // Option preprocessor. @@ -117,31 +136,31 @@ def Preprocess : OptionPreprocessor< // Tools -class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool< +class llvm_gcc_based <string cmd_prefix, string in_lang, + string E_ext, string out_lang> : Tool< [(in_language in_lang), (out_language "llvm-bitcode"), - (output_suffix "bc"), - (cmd_line (case - (switch_on "E"), - (case (not_empty "o"), - !strconcat(cmd_prefix, " -E $INFILE -o $OUTFILE"), - (default), - !strconcat(cmd_prefix, " -E $INFILE")), - (switch_on "fsyntax-only"), - !strconcat(cmd_prefix, " -fsyntax-only $INFILE"), - (and (switch_on "S"), (switch_on "emit-llvm")), - !strconcat(cmd_prefix, " -S $INFILE -o $OUTFILE -emit-llvm"), - (default), - !strconcat(cmd_prefix, " -c $INFILE -o $OUTFILE -emit-llvm"))), + (output_suffix out_lang), + (command cmd_prefix), (actions (case - (and (multiple_input_files), (or (switch_on "S"), (switch_on "c"))), + (and (not_empty "o"), + (multiple_input_files), (or (switch_on "S"), (switch_on "c"))), (error "cannot specify -o with -c or -S with multiple files"), - (switch_on "E"), [(stop_compilation), (output_suffix E_ext)], + (switch_on "E"), + [(forward "E"), (stop_compilation), (output_suffix E_ext)], + (and (switch_on "E"), (empty "o")), (no_out_file), (switch_on ["emit-llvm", "S"]), [(output_suffix "ll"), (stop_compilation)], (switch_on ["emit-llvm", "c"]), (stop_compilation), - (switch_on "fsyntax-only"), (stop_compilation), + (switch_on "fsyntax-only"), [(forward "fsyntax-only"), + (no_out_file), (stop_compilation)], + (switch_on ["S", "emit-llvm"]), [(forward "S"), (forward "emit-llvm")], + (not (or (switch_on ["S", "emit-llvm"]), (switch_on "fsyntax-only"))), + [(append_cmd "-c"), (append_cmd "-emit-llvm")], + + // Forwards + (not_empty "Xpreprocessor"), (forward "Xpreprocessor"), (not_empty "include"), (forward "include"), (not_empty "iquote"), (forward "iquote"), (not_empty "save-temps"), (append_cmd "-save-temps"), @@ -153,8 +172,7 @@ class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool< (not_empty "mtune"), (forward "mtune"), (not_empty "mcpu"), (forward "mcpu"), (not_empty "m"), (forward "m"), - (not_empty "std"), (forward "std"), - (not_empty "fmessage-length"), (forward "fmessage-length"), + (switch_on "mfix-and-continue"), (forward "mfix-and-continue"), (switch_on "m32"), (forward "m32"), (switch_on "m64"), (forward "m64"), (switch_on "O0"), (forward "O0"), @@ -168,12 +186,24 @@ class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool< (sink) ]>; -def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i">; -def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i">; +def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i", "bc">; +def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i", "bc">; def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c", - "objective-c", "mi">; + "objective-c", "mi", "bc">; def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++", - "objective-c++", "mi">; + "objective-c++", "mi", "bc">; + +def llvm_gcc_c_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c-header", + "c-header", "i", "gch">; +def llvm_gcc_cpp_pch : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++-header", + "c++-header", + "i", "gch">; +def llvm_gcc_m_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c-header", + "objective-c-header", + "mi", "gch">; +def llvm_gcc_mxx_pch + : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++-header", + "objective-c++-header", "mi", "gch">; def opt : Tool< [(in_language "llvm-bitcode"), @@ -183,14 +213,14 @@ def opt : Tool< (switch_on "O1"), (forward "O1"), (switch_on "O2"), (forward "O2"), (switch_on "O3"), (forward "O3"))), - (cmd_line "opt -f $INFILE -o $OUTFILE") + (command "opt -f") ]>; def llvm_as : Tool< [(in_language "llvm-assembler"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "llvm-as $INFILE -o $OUTFILE"), + (command "llvm-as"), (actions (case (switch_on "emit-llvm"), (stop_compilation))) ]>; @@ -198,19 +228,19 @@ def llvm_gcc_assembler : Tool< [(in_language "assembler"), (out_language "object-code"), (output_suffix "o"), - (cmd_line "@LLVMGCCCOMMAND@ -c -x assembler $INFILE -o $OUTFILE"), + (command "@LLVMGCCCOMMAND@ -c -x assembler"), (actions (case (switch_on "c"), (stop_compilation), (not_empty "arch"), (forward "arch"), - (not_empty "fmessage-length"), (forward "fmessage-length"), - (not_empty "Wa,"), (forward_value "Wa,"))) + (not_empty "Xassembler"), (forward "Xassembler"), + (not_empty "Wa,"), (forward "Wa,"))) ]>; def llc : Tool< [(in_language ["llvm-bitcode", "llvm-assembler"]), (out_language "assembler"), (output_suffix "s"), - (cmd_line "llc -f $INFILE -o $OUTFILE"), + (command "llc -f"), (actions (case (switch_on "S"), (stop_compilation), (switch_on "O0"), (forward "O0"), @@ -220,8 +250,8 @@ def llc : Tool< (switch_on "fPIC"), (append_cmd "-relocation-model=pic"), (switch_on "mdynamic-no-pic"), (append_cmd "-relocation-model=dynamic-no-pic"), - (not_empty "march"), (forward "mcpu"), - (not_empty "mtune"), (forward "mcpu"), + (not_empty "march"), (forward_as "mtune", "-mcpu"), + (not_empty "mtune"), (forward_as "mtune", "-mcpu"), (not_empty "mcpu"), (forward "mcpu"), (not_empty "m"), (forward_transformed_value "m", "ConvertToMAttr"), (not_empty "Wllc,"), (forward_value "Wllc,"))) @@ -232,7 +262,9 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool< [(in_language "object-code"), (out_language "executable"), (output_suffix "out"), - (cmd_line !strconcat(cmd_prefix, " $INFILE -o $OUTFILE")), + (command cmd_prefix), + (works_on_empty (case (not_empty "filelist"), true, + (default), false)), (join), (actions (case (switch_on "pthread"), (append_cmd "-lpthread"), @@ -241,11 +273,20 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool< (not_empty "arch"), (forward "arch"), (not_empty "framework"), (forward "framework"), (not_empty "weak_framework"), (forward "weak_framework"), + (not_empty "filelist"), (forward "filelist"), (switch_on "m32"), (forward "m32"), (switch_on "m64"), (forward "m64"), - (not_empty "fmessage-length"), (forward "fmessage-length"), (not_empty "l"), (forward "l"), - (not_empty "Wl,"), (forward "Wl,"))) + (not_empty "Xlinker"), (forward "Xlinker"), + (not_empty "Wl,"), (forward "Wl,"), + (switch_on "dynamiclib"), (forward "dynamiclib"), + (switch_on "prebind"), (forward "prebind"), + (switch_on "dead_strip"), (forward "dead_strip"), + (switch_on "single_module"), (forward "single_module"), + (not_empty "compatibility_version"), + (forward "compatibility_version"), + (not_empty "current_version"), (forward "current_version"), + (not_empty "install_name"), (forward "install_name"))) ]>; // Default linker @@ -257,16 +298,20 @@ def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@">; def LanguageMap : LanguageMap< [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>, + LangToSuffixes<"c++-header", ["hpp"]>, LangToSuffixes<"c", ["c"]>, + LangToSuffixes<"c-header", ["h"]>, LangToSuffixes<"c-cpp-output", ["i"]>, LangToSuffixes<"objective-c-cpp-output", ["mi"]>, LangToSuffixes<"objective-c++", ["mm"]>, + LangToSuffixes<"objective-c++-header", ["hmm"]>, LangToSuffixes<"objective-c", ["m"]>, + LangToSuffixes<"objective-c-header", ["hm"]>, LangToSuffixes<"assembler", ["s"]>, LangToSuffixes<"assembler-with-cpp", ["S"]>, LangToSuffixes<"llvm-assembler", ["ll"]>, LangToSuffixes<"llvm-bitcode", ["bc"]>, - LangToSuffixes<"object-code", ["o"]>, + LangToSuffixes<"object-code", ["o", "*empty*"]>, LangToSuffixes<"executable", ["out"]> ]>; @@ -280,6 +325,11 @@ def CompilationGraph : CompilationGraph<[ Edge<"root", "llvm_gcc_mxx">, Edge<"root", "llc">, + Edge<"root", "llvm_gcc_c_pch">, + Edge<"root", "llvm_gcc_cpp_pch">, + Edge<"root", "llvm_gcc_m_pch">, + Edge<"root", "llvm_gcc_mxx_pch">, + Edge<"llvm_gcc_c", "llc">, Edge<"llvm_gcc_cpp", "llc">, Edge<"llvm_gcc_m", "llc">, |