Changeset 1546


Ignore:
Timestamp:
Nov 23, 2011, 6:39:13 PM (8 years ago)
Author:
tranquil
Message:

added an option to prevent reindexing transformations from taking place, regardless of optimization options

Location:
Deliverables/D2.2/8051/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/acc.ml

    r1542 r1546  
    4343    (** If debugging is enabled, the compilation function returns all
    4444        the intermediate programs. *)
    45     Languages.compile (Options.is_debug_enabled ())
    46       (Options.get_transformations ()) src_language tgt_language input_ast
     45    Languages.compile
     46      (Options.is_debug_enabled ())
     47      (Options.get_transformations ())
     48      src_language tgt_language input_ast
    4749  in
    4850  let final_ast, intermediate_asts = Misc.ListExt.cut_last target_asts in
  • Deliverables/D2.2/8051/src/options.ml

    r1542 r1546  
    4848let is_debug_enabled ()         = !debug_flag
    4949
     50let reindex_flag                = ref true
     51
    5052let transformations = ref []
    51 let add_transformation t () = transformations := !transformations @ [t]
    52 let add_transformations ts () = transformations := !transformations @ ts
    53 let get_transformations () = !transformations
     53let reindexing_transformations = ref []
     54let add_transformation, add_reindexing_transformation =
     55  let add_to l t () = l := !l @ [t] in
     56  add_to transformations, add_to reindexing_transformations
     57let add_transformations (safe, reindexing) () =
     58  transformations := !transformations @ safe ;
     59  reindexing_transformations := !reindexing_transformations @ reindexing
     60let get_transformations () =
     61  if !reindex_flag then !transformations else
     62  !transformations @ !reindexing_transformations
    5463
    5564let cost_ternary_flag           = ref true
     
    100109let is_dev_test_enabled ()      = !dev_test
    101110
    102 let help_specify_opt_stage (trans : Languages.transformation) =
    103         Printf.sprintf "(done at the %s stage)." (Languages.to_string (fst trans))
     111let help_specify_opt_stage ?(reind = false) (trans : Languages.transformation) =
     112  extra_doc (Printf.sprintf " [%sdone in %s]"
     113               (if reind then "reindexing transformation, " else "")
     114               (Languages.to_string (fst trans)))
    104115
    105116let basic_optimizations =
    106   [
    107     LoopPeeling.trans;
     117  ([
    108118    ConstPropagation.trans;
    109119    CopyPropagation.trans;
     
    111121    CopyPropagation.trans;
    112122    RedundancyElimination.trans
    113   ]
    114  
     123  ],[
     124    LoopPeeling.trans
     125  ])
    115126
    116127let options = OptionsParsing.register [
     
    172183  extra_doc " [default is 1000]";
    173184
    174   "-peel", Arg.Unit (add_transformation LoopPeeling.trans),
    175   " Apply loop peeling " ^
    176     help_specify_opt_stage LoopPeeling.trans;
     185  "-peel", Arg.Unit (add_reindexing_transformation LoopPeeling.trans),
     186  " Apply loop peeling.";
     187    help_specify_opt_stage ~reind:true LoopPeeling.trans;
    177188
    178189  "-cst-prop", Arg.Unit (add_transformation ConstPropagation.trans),
    179   " Apply constant propagation " ^
    180     help_specify_opt_stage ConstPropagation.trans;
     190  " Apply constant propagation.";
     191  help_specify_opt_stage ConstPropagation.trans;
    181192
    182193  "-cpy-prop", Arg.Unit (add_transformation CopyPropagation.trans),
    183   " Apply copy propagation " ^
     194  " Apply copy propagation.";
    184195    help_specify_opt_stage CopyPropagation.trans;
    185196
    186197  "-pre", Arg.Unit (add_transformation RedundancyElimination.trans),
    187   " Apply partial redundancy elimination " ^
     198  " Apply partial redundancy elimination.";
    188199    help_specify_opt_stage RedundancyElimination.trans;
    189200
    190201  "-unroll-for",
    191   Arg.Int (fun i -> add_transformation (LoopUnrolling.trans ~factor:i ()) ()),
    192   " Apply loop unrolling, specifying factor " ^
    193   help_specify_opt_stage (LoopUnrolling.trans ());
    194 
    195   "-unroll", Arg.Unit (add_transformation (LoopUnrolling.trans ())),
    196   " Apply loop unrolling " ^
    197   help_specify_opt_stage (LoopUnrolling.trans ());
     202  Arg.Int (fun i -> add_reindexing_transformation (
     203    LoopUnrolling.trans ~factor:i ()) ()),
     204  " Apply loop unrolling, specifying factor.";
     205  help_specify_opt_stage ~reind:true (LoopUnrolling.trans ());
     206
     207  "-unroll", Arg.Unit (add_reindexing_transformation (LoopUnrolling.trans ())),
     208  " Apply loop unrolling.";
     209  help_specify_opt_stage ~reind:true (LoopUnrolling.trans ());
    198210
    199211  "-O", Arg.Unit (add_transformations basic_optimizations),
     
    201213
    202214  "-no-cost-tern",  Arg.Clear cost_ternary_flag,
    203   " Replace cost ternary expressions with equivalent branch statements.";
    204  
     215  " Replace cost ternary expressions with equivalent";
     216  extra_doc " branch statements.";
     217
     218  "-no-reindex", Arg.Clear reindex_flag,
     219  " Prevent optimizations that reindex labels.";
    205220(*
    206221  "-res", Arg.Set print_result_flag,
  • Deliverables/D2.2/8051/src/options.mli

    r1542 r1546  
    6767val get_lustre_test_max_int : unit -> int
    6868
    69 
    7069(** {2 Intermediate transformations } *)
    7170val get_transformations : unit -> Languages.transformation list
Note: See TracChangeset for help on using the changeset viewer.