diff options
-rw-r--r-- | driver/Clflags.ml | 3 | ||||
-rw-r--r-- | driver/Driver.ml | 12 | ||||
-rw-r--r-- | mppa_k1c/TargetPrinter.ml | 10 |
3 files changed, 20 insertions, 5 deletions
diff --git a/driver/Clflags.ml b/driver/Clflags.ml index b1afab6f..fd5f0e68 100644 --- a/driver/Clflags.ml +++ b/driver/Clflags.ml @@ -71,3 +71,6 @@ let option_fglobaladdrtmp = ref false let option_fglobaladdroffset = ref false let option_fxsaddr = ref true let option_coalesce_mem = ref true + +let option_div_i32 = ref "stsud" +let option_div_i64 = ref "stsud" diff --git a/driver/Driver.ml b/driver/Driver.ml index cfafcaa3..314cf31c 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -265,9 +265,13 @@ let num_input_files = ref 0 let cmdline_actions = let f_opt name ref = [Exact("-f" ^ name), Set ref; Exact("-fno-" ^ name), Unset ref] in - let f_opt_str name ref strref = + let f_opt_str name ref strref default = [Exact("-f" ^ name ^ "="), String - (fun s -> (strref := (if s == "" then "list" else s)); ref := true) + (fun s -> (strref := (if s == "" then default else s)); ref := true) + ] in + let f_str name strref default = + [Exact("-f" ^ name ^ "="), String + (fun s -> (strref := (if s == "" then default else s))) ] in [ (* Getting help *) @@ -369,13 +373,15 @@ let cmdline_actions = @ f_opt "cse" option_fcse @ f_opt "redundancy" option_fredundancy @ f_opt "postpass" option_fpostpass - @ f_opt_str "postpass" option_fpostpass option_fpostpass_sched + @ f_opt_str "postpass" option_fpostpass option_fpostpass_sched "list" @ f_opt "inline" option_finline @ f_opt "inline-functions-called-once" option_finline_functions_called_once @ f_opt "globaladdrtmp" option_fglobaladdrtmp @ f_opt "globaladdroffset" option_fglobaladdroffset @ f_opt "xsaddr" option_fxsaddr @ f_opt "coalesce-mem" option_coalesce_mem + @ f_str "div-i32" option_div_i32 "stsud" + @ f_str "div-i64" option_div_i64 "stsud" (* Code generation options *) @ f_opt "fpu" option_ffpu @ f_opt "sse" option_ffpu (* backward compatibility *) diff --git a/mppa_k1c/TargetPrinter.ml b/mppa_k1c/TargetPrinter.ml index 4dc4b7c2..2bdd0978 100644 --- a/mppa_k1c/TargetPrinter.ml +++ b/mppa_k1c/TargetPrinter.ml @@ -39,8 +39,14 @@ module Target (*: TARGET*) = | Idiv_stsud | Idiv_fp;; - let idiv_function_kind_32bit () = Idiv_fp;; - let idiv_function_kind_64bit () = Idiv_stsud;; + let idiv_function_kind = function + "stsud" -> Idiv_stsud + | "system" -> Idiv_system + | "fp" -> Idiv_fp + | _ -> failwith "unknown integer division kind";; + + let idiv_function_kind_32bit () = idiv_function_kind !Clflags.option_div_i32;; + let idiv_function_kind_64bit () = idiv_function_kind !Clflags.option_div_i64;; let subst_symbol = function "__compcert_i64_udiv" -> |