Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 1 | /* |
Stephen Hines | 5c25c51 | 2012-02-27 12:58:17 -0800 | [diff] [blame] | 2 | * Copyright 2010-2012, The Android Open Source Project |
Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 17 | //===----------------------------------------------------------------------===// |
| 18 | // |
| 19 | // This file defines the options accepted by llvm-rs-cc. |
| 20 | // |
| 21 | //===----------------------------------------------------------------------===// |
| 22 | |
| 23 | // Include the common option parsing interfaces. |
Stephen Hines | a1f95ee | 2013-08-09 01:26:08 -0700 | [diff] [blame] | 24 | include "llvm/Option/OptParser.td" |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 25 | |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | // Target Options |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 30 | def target_api : Separate<["-"], "target-api">, |
Stephen Hines | 2e35b13 | 2011-07-22 02:50:19 -0700 | [diff] [blame] | 31 | HelpText<"Specify target API level (e.g. 14)">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 32 | def target_api_EQ : Joined<["-"], "target-api=">, Alias<target_api>; |
Stephen Hines | 2e35b13 | 2011-07-22 02:50:19 -0700 | [diff] [blame] | 33 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 34 | //===----------------------------------------------------------------------===// |
| 35 | // Header Search Options |
| 36 | //===----------------------------------------------------------------------===// |
| 37 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 38 | def I : JoinedOrSeparate<["-"], "I">, MetaVarName<"<directory>">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 39 | HelpText<"Add directory to include search path">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 40 | def _I : Separate<["-", "--"], "include-path">, MetaVarName<"<directory>">, Alias<I>; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 41 | |
| 42 | //===----------------------------------------------------------------------===// |
| 43 | // Frontend Options |
| 44 | //===----------------------------------------------------------------------===// |
| 45 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 46 | def o : Separate<["-"], "o">, MetaVarName<"<directory>">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 47 | HelpText<"Specify output directory">; |
| 48 | |
| 49 | def Output_Type_Group : OptionGroup<"<output type group>">; |
| 50 | let Group = Output_Type_Group in { |
| 51 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 52 | def emit_asm : Flag<["-"], "emit-asm">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 53 | HelpText<"Emit target assembly files">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 54 | def _emit_asm : Flag<["-"], "S">, Alias<emit_asm>; |
| 55 | def emit_llvm : Flag<["-"], "emit-llvm">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 56 | HelpText<"Build ASTs then convert to LLVM, emit .ll file">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 57 | def emit_bc : Flag<["-"], "emit-bc">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 58 | HelpText<"Build ASTs then convert to LLVM, emit .bc file">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 59 | def emit_nothing : Flag<["-"], "emit-nothing">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 60 | HelpText<"Build ASTs then convert to LLVM, but emit nothing">; |
| 61 | } |
| 62 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 63 | def emit_g : Flag<["-"], "g">, |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 64 | HelpText<"Emit LLVM Debug Metadata">; |
| 65 | |
Stephen Hines | e006c14 | 2013-05-17 16:14:58 -0700 | [diff] [blame] | 66 | def optimization_level : JoinedOrSeparate<["-"], "O">, MetaVarName<"<optimization-level>">, |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 67 | HelpText<"<optimization-level> can be one of '0' or '3' (default)">; |
| 68 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 69 | def allow_rs_prefix : Flag<["-"], "allow-rs-prefix">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 70 | HelpText<"Allow user-defined function prefixed with 'rs'">; |
| 71 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 72 | def java_reflection_path_base : Separate<["-"], "java-reflection-path-base">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 73 | MetaVarName<"<directory>">, |
| 74 | HelpText<"Base directory for output reflected Java files">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 75 | def _java_reflection_path_base : Separate<["-"], "p">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 76 | Alias<java_reflection_path_base>; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 77 | def java_reflection_package_name : Separate<["-"], "java-reflection-package-name">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 78 | HelpText<"Specify the package name that reflected Java files belong to">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 79 | def _java_reflection_package_name : Separate<["-"], "j">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 80 | Alias<java_reflection_package_name>; |
| 81 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 82 | def bitcode_storage : Separate<["-"], "bitcode-storage">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 83 | MetaVarName<"<value>">, HelpText<"<value> should be 'ar' or 'jc'">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 84 | def _bitcode_storage : Separate<["-"], "s">, Alias<bitcode_storage>; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 85 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 86 | def rs_package_name : Separate<["-"], "rs-package-name">, |
Stephen Hines | 0a813a3 | 2012-08-03 16:52:40 -0700 | [diff] [blame] | 87 | MetaVarName<"<package_name>">, |
| 88 | HelpText<"package name for referencing RS classes">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 89 | def rs_package_name_EQ : Joined<["-"], "rs-package-name=">, Alias<rs_package_name>; |
Stephen Hines | 0a813a3 | 2012-08-03 16:52:40 -0700 | [diff] [blame] | 90 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 91 | def W : Joined<["-"], "W">; |
| 92 | def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">; |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 93 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 94 | //===----------------------------------------------------------------------===// |
| 95 | // Dependency Output Options |
| 96 | //===----------------------------------------------------------------------===// |
| 97 | |
| 98 | def M_Group : OptionGroup<"M group>">; |
| 99 | let Group = M_Group in { |
| 100 | |
Stephen Hines | b399558 | 2013-01-25 15:14:29 -0800 | [diff] [blame] | 101 | def MD : Flag<["-"], "MD">, HelpText<"Emit .d dependency files">; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 102 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 103 | def M : Flag<["-"], "M">; |
| 104 | def emit_dep : Flag<["-"], "emit-dep">, Alias<M>; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 107 | def output_dep_dir : Separate<["-"], "output-dep-dir">, MetaVarName<"<directory>">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 108 | HelpText<"Specify output directory for dependencies output">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 109 | def _output_dep_dir : Separate<["-"], "d">, Alias<output_dep_dir>; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 110 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 111 | def additional_dep_target: Separate<["-"], "additional-dep-target">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 112 | HelpText<"Additional targets to show up in dependencies output">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 113 | def _additional_dep_target : Separate<["-"], "a">, Alias<additional_dep_target>; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 114 | |
| 115 | //===----------------------------------------------------------------------===// |
Stephen Hines | 5c25c51 | 2012-02-27 12:58:17 -0800 | [diff] [blame] | 116 | // Reflection Options |
| 117 | //===----------------------------------------------------------------------===// |
| 118 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 119 | def reflect_cpp : Flag<["-"], "reflect-c++">, |
Stephen Hines | 5c25c51 | 2012-02-27 12:58:17 -0800 | [diff] [blame] | 120 | HelpText<"Reflect C++ classes">; |
| 121 | |
| 122 | //===----------------------------------------------------------------------===// |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 123 | // Misc Options |
| 124 | //===----------------------------------------------------------------------===// |
| 125 | |
Stephen Hines | fc4f78b | 2014-06-10 18:07:10 -0700 | [diff] [blame] | 126 | def verbose : Flag<["-"], "v">, |
| 127 | HelpText<"Display verbose information during the compilation">; |
| 128 | def _verbose : Flag<["-"], "verbose">, Alias<verbose>; |
| 129 | def __verbose : Flag<["--"], "verbose">, Alias<verbose>; |
| 130 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 131 | def help : Flag<["-"], "help">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 132 | HelpText<"Print this help text">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 133 | def _help : Flag<["--"], "help">, Alias<help>; |
| 134 | def __help : Flag<["-"], "h">, Alias<help>; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 135 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 136 | def version : Flag<["-"], "version">, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 137 | HelpText<"Print the assembler version">; |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 138 | def _version : Flag<["--"], "version">, Alias<version>; |
Shih-wei Liao | ffa58bb | 2010-10-10 14:15:13 -0700 | [diff] [blame] | 139 | |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 140 | def emit_32_64 : Flag<["-"], "emit_32_64">, |
| 141 | HelpText<"Emit 32-bit and 64-bit bitcode in source files">; |
| 142 | |
Shih-wei Liao | ffa58bb | 2010-10-10 14:15:13 -0700 | [diff] [blame] | 143 | // Compatible with old slang |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 144 | def no_link : Flag<["-"], "no-link">; // currently no effect |