Home | History | Annotate | Download | only in slang
      1 /*
      2  * Copyright 2010-2012, The Android Open Source Project
      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 
     17 //===----------------------------------------------------------------------===//
     18 //
     19 //  This file defines the options accepted by llvm-rs-cc.
     20 //
     21 //===----------------------------------------------------------------------===//
     22 
     23 // Include the common option parsing interfaces.
     24 include "llvm/Option/OptParser.td"
     25 
     26 //===----------------------------------------------------------------------===//
     27 // Target Options
     28 //===----------------------------------------------------------------------===//
     29 
     30 def target_api : Separate<["-"], "target-api">,
     31   HelpText<"Specify target API level (e.g. 14)">;
     32 def target_api_EQ : Joined<["-"], "target-api=">, Alias<target_api>;
     33 
     34 //===----------------------------------------------------------------------===//
     35 // Header Search Options
     36 //===----------------------------------------------------------------------===//
     37 
     38 def I : JoinedOrSeparate<["-"], "I">, MetaVarName<"<directory>">,
     39   HelpText<"Add directory to include search path">;
     40 def _I : Separate<["-", "--"], "include-path">, MetaVarName<"<directory>">, Alias<I>;
     41 
     42 //===----------------------------------------------------------------------===//
     43 // Frontend Options
     44 //===----------------------------------------------------------------------===//
     45 
     46 def o : Separate<["-"], "o">, MetaVarName<"<directory>">,
     47   HelpText<"Specify output directory">;
     48 
     49 def Output_Type_Group : OptionGroup<"<output type group>">;
     50 let Group = Output_Type_Group in {
     51 
     52 def emit_asm : Flag<["-"], "emit-asm">,
     53   HelpText<"Emit target assembly files">;
     54 def _emit_asm : Flag<["-"], "S">, Alias<emit_asm>;
     55 def emit_llvm : Flag<["-"], "emit-llvm">,
     56   HelpText<"Build ASTs then convert to LLVM, emit .ll file">;
     57 def emit_bc : Flag<["-"], "emit-bc">,
     58   HelpText<"Build ASTs then convert to LLVM, emit .bc file">;
     59 def emit_nothing : Flag<["-"], "emit-nothing">,
     60   HelpText<"Build ASTs then convert to LLVM, but emit nothing">;
     61 }
     62 
     63 def m32 : Flag<["-"], "m32">, HelpText<"Emit 32-bit code (only for C++, unless eng build)">;
     64 def m64 : Flag<["-"], "m64">, HelpText<"Emit 64-bit code (only for C++, unless eng build)">;
     65 
     66 def emit_g : Flag<["-"], "g">,
     67   HelpText<"Emit LLVM Debug Metadata">;
     68 
     69 def optimization_level : JoinedOrSeparate<["-"], "O">, MetaVarName<"<optimization-level>">,
     70   HelpText<"<optimization-level> can be one of '0' or '3' (default)">;
     71 
     72 def allow_rs_prefix : Flag<["-"], "allow-rs-prefix">,
     73   HelpText<"Allow user-defined function prefixed with 'rs'">;
     74 
     75 def java_reflection_path_base : Separate<["-"], "java-reflection-path-base">,
     76   MetaVarName<"<directory>">,
     77   HelpText<"Base directory for output reflected Java files">;
     78 def _java_reflection_path_base : Separate<["-"], "p">,
     79   Alias<java_reflection_path_base>;
     80 def java_reflection_package_name : Separate<["-"], "java-reflection-package-name">,
     81   HelpText<"Specify the package name that reflected Java files belong to">;
     82 def _java_reflection_package_name : Separate<["-"], "j">,
     83   Alias<java_reflection_package_name>;
     84 
     85 def bitcode_storage : Separate<["-"], "bitcode-storage">,
     86   MetaVarName<"<value>">, HelpText<"<value> should be 'ar' or 'jc'">;
     87 def _bitcode_storage : Separate<["-"], "s">, Alias<bitcode_storage>;
     88 
     89 def rs_package_name : Separate<["-"], "rs-package-name">,
     90   MetaVarName<"<package_name>">,
     91   HelpText<"package name for referencing RS classes">;
     92 def rs_package_name_EQ : Joined<["-"], "rs-package-name=">, Alias<rs_package_name>;
     93 
     94 def W : Joined<["-"], "W">, HelpText<"Enable the specified warning">;
     95 def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">;
     96 
     97 //===----------------------------------------------------------------------===//
     98 // Dependency Output Options
     99 //===----------------------------------------------------------------------===//
    100 
    101 def M_Group : OptionGroup<"M group>">;
    102 let Group = M_Group in {
    103 
    104   def MD : Flag<["-"], "MD">, HelpText<"Emit .d dependency files">;
    105   def MP : Flag<["-"], "MP">, HelpText<"Also emit phony target for dependency files">;
    106 
    107   def M : Flag<["-"], "M">;
    108   def emit_dep : Flag<["-"], "emit-dep">, Alias<M>;
    109 }
    110 
    111 def output_dep_dir : Separate<["-"], "output-dep-dir">, MetaVarName<"<directory>">,
    112   HelpText<"Specify output directory for dependencies output">;
    113 def _output_dep_dir : Separate<["-"], "d">, Alias<output_dep_dir>;
    114 
    115 def additional_dep_target: Separate<["-"], "additional-dep-target">,
    116   HelpText<"Additional targets to show up in dependencies output">;
    117 def _additional_dep_target : Separate<["-"], "a">, Alias<additional_dep_target>;
    118 
    119 //===----------------------------------------------------------------------===//
    120 // Reflection Options
    121 //===----------------------------------------------------------------------===//
    122 
    123 def reflect_cpp : Flag<["-"], "reflect-c++">,
    124   HelpText<"Reflect C++ classes">;
    125 
    126 //===----------------------------------------------------------------------===//
    127 // Diagnostic Options
    128 //===----------------------------------------------------------------------===//
    129 
    130 def ast_print : Flag<["-"], "ast-print">,
    131   HelpText<"Print clang AST prior to llvm IR generation">;
    132 
    133 def debug : Flag<["-"], "debug">,
    134   HelpText<"Enable debug output">;
    135 
    136 def print_after_all : Flag<["-"], "print-after-all">,
    137   HelpText<"Print llvm IR after each pass">;
    138 def print_before_all : Flag<["-"], "print-before-all">,
    139   HelpText<"Print llvm IR before each pass">;
    140 
    141 //===----------------------------------------------------------------------===//
    142 // Misc Options
    143 //===----------------------------------------------------------------------===//
    144 
    145 def verbose : Flag<["-"], "v">,
    146   HelpText<"Display verbose information during the compilation">;
    147 def _verbose : Flag<["-"], "verbose">, Alias<verbose>;
    148 def __verbose : Flag<["--"], "verbose">, Alias<verbose>;
    149 
    150 def help : Flag<["-"], "help">,
    151   HelpText<"Print this help text">;
    152 def _help : Flag<["--"], "help">, Alias<help>;
    153 def __help : Flag<["-"], "h">, Alias<help>;
    154 
    155 def version : Flag<["-"], "version">,
    156   HelpText<"Print the assembler version">;
    157 def _version : Flag<["--"], "version">, Alias<version>;
    158 
    159 // Compatible with old slang
    160 def no_link : Flag<["-"], "no-link">;  // currently no effect
    161