|
@@ -41,12 +41,12 @@ type t = {
|
|
|
fusion_debug : bool;
|
|
|
}
|
|
|
|
|
|
+let flag_optimize = "optimize"
|
|
|
let flag_const_propagation = "const_propagation"
|
|
|
let flag_copy_propagation = "copy_propagation"
|
|
|
let flag_code_motion = "code_motion"
|
|
|
let flag_local_dce = "local_dce"
|
|
|
let flag_fusion = "fusion"
|
|
|
-let flag_purity_inference = "purity_inference"
|
|
|
let flag_ignore = "ignore"
|
|
|
let flag_dot_debug = "dot_debug"
|
|
|
let flag_full_debug = "full_debug"
|
|
@@ -56,7 +56,7 @@ let flag_fusion_debug = "fusion_debug"
|
|
|
let all_flags =
|
|
|
List.fold_left (fun acc flag ->
|
|
|
flag :: ("no_" ^ flag) :: acc
|
|
|
- ) [] [flag_const_propagation;flag_copy_propagation;flag_code_motion;flag_local_dce;flag_fusion;flag_purity_inference;flag_ignore;flag_dot_debug;flag_user_var_fusion]
|
|
|
+ ) [] [flag_optimize;flag_const_propagation;flag_copy_propagation;flag_code_motion;flag_local_dce;flag_fusion;flag_ignore;flag_dot_debug;flag_user_var_fusion]
|
|
|
|
|
|
let has_analyzer_option meta s =
|
|
|
try
|
|
@@ -101,24 +101,30 @@ let update_config_from_meta com config meta =
|
|
|
List.fold_left (fun config meta -> match meta with
|
|
|
| (Meta.Analyzer,el,_) ->
|
|
|
List.fold_left (fun config e -> match fst e with
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_const_propagation -> { config with const_propagation = false}
|
|
|
- | EConst (Ident s) when s = flag_const_propagation -> { config with const_propagation = true}
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_copy_propagation -> { config with copy_propagation = false}
|
|
|
- | EConst (Ident s) when s = flag_copy_propagation -> { config with copy_propagation = true}
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_code_motion -> { config with code_motion = false}
|
|
|
- | EConst (Ident s) when s = flag_code_motion -> { config with code_motion = true}
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_local_dce -> { config with local_dce = false}
|
|
|
- | EConst (Ident s) when s = flag_local_dce -> { config with local_dce = true}
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_fusion -> { config with fusion = false}
|
|
|
- | EConst (Ident s) when s = flag_fusion -> { config with fusion = true}
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_purity_inference -> { config with purity_inference = false}
|
|
|
- | EConst (Ident s) when s = flag_purity_inference -> { config with purity_inference = true}
|
|
|
- | EConst (Ident s) when s = flag_dot_debug -> {config with debug_kind = DebugDot}
|
|
|
- | EConst (Ident s) when s = flag_full_debug -> {config with debug_kind = DebugFull}
|
|
|
- | EConst (Ident s) when s = flag_user_var_fusion -> {config with user_var_fusion = true}
|
|
|
- | EConst (Ident s) when s = "no_" ^ flag_user_var_fusion -> {config with user_var_fusion = false}
|
|
|
- | EConst (Ident s) when s = flag_fusion_debug -> {config with fusion_debug = true}
|
|
|
- | EConst (Ident s) when s = "as_var" -> config
|
|
|
+ | EConst (Ident s) ->
|
|
|
+ begin match s with
|
|
|
+ | "optimize" -> { config with optimize = true }
|
|
|
+ | "no_optimize" -> { config with optimize = false }
|
|
|
+ | "const_propagation" -> { config with const_propagation = true }
|
|
|
+ | "no_const_propagation" -> { config with const_propagation = false }
|
|
|
+ | "copy_propagation" -> { config with copy_propagation = true }
|
|
|
+ | "no_copy_propagation" -> { config with copy_propagation = false }
|
|
|
+ | "local_dce" -> { config with local_dce = true }
|
|
|
+ | "no_local_dce" -> { config with local_dce = false }
|
|
|
+ | "code_motion" -> { config with code_motion = true }
|
|
|
+ | "no_code_motion" -> { config with code_motion = false }
|
|
|
+ | "fusion" -> { config with fusion = true }
|
|
|
+ | "no_fusion" -> { config with fusion = false }
|
|
|
+ | "user_var_fusion" -> { config with user_var_fusion = true }
|
|
|
+ | "no_user_var_fusion" -> { config with user_var_fusion = false }
|
|
|
+ | "dot_debug" -> { config with debug_kind = DebugDot }
|
|
|
+ | "full_debug" -> { config with debug_kind = DebugFull }
|
|
|
+ | "fusion_debug" -> { config with fusion_debug = true }
|
|
|
+ | "as_var" -> config
|
|
|
+ | _ ->
|
|
|
+ com.warning (StringError.string_error s all_flags ("Unrecognized analyzer option: " ^ s)) (pos e);
|
|
|
+ config
|
|
|
+ end
|
|
|
| _ ->
|
|
|
let s = Ast.s_expr e in
|
|
|
com.warning (StringError.string_error s all_flags ("Unrecognized analyzer option: " ^ s)) (pos e);
|