Ignore:
Timestamp:
Nov 15, 2011, 5:11:19 PM (9 years ago)
Author:
tranquil
Message:
  • added an option to not use ternary expressions in costs, to accomodate frama-c explosion of such expressions
  • corrected some typos in comments
  • added a check for well behaved for loops in loop unrolling, but intelligent unrolling is not done yet
  • TODO: peeling and unrolling can contradict preciseness (with difference between introduced branches around 2 cycles). I guess it can be corrected easily
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051-indexed-labels-branch/src/options.ml

    r1483 r1507  
    5353let get_transformations () = !transformations
    5454
     55let cost_ternary_flag           = ref true
     56let set_cost_ternary            = (:=) cost_ternary_flag
     57let is_cost_ternary_enabled ()  = !cost_ternary_flag
     58
    5559(*
    5660let print_result_flag           = ref false
     
    6266let set_dev_test                = (:=) dev_test
    6367let is_dev_test_enabled ()      = !dev_test
     68
     69let help_specify_opt_stage (trans : Languages.transformation) =
     70        Printf.sprintf "(done at the %s stage)." (Languages.to_string (fst trans))
     71
     72let basic_optimizations =
     73        [
     74                LoopPeeling.trans;
     75                ConstPropagation.trans;
     76                CopyPropagation.trans;
     77                RedundancyElimination.trans;
     78    CopyPropagation.trans;
     79    RedundancyElimination.trans
     80        ]
     81 
    6482
    6583let options = OptionsParsing.register [
     
    88106  "-o", Arg.String set_output_files,
    89107  " Prefix of the output files.";
    90        
    91     "-peel", Arg.Unit (add_transformation LoopPeeling.trans),
    92     " Apply loop peeling.";
    93                
    94                 "-cst-prop", Arg.Unit (add_transformation ConstPropagation.trans),
    95     " Apply constant propagation.";
    96108
    97     "-cpy-prop", Arg.Unit (add_transformation CopyPropagation.trans),
    98     " Apply copy propagation.";
     109  "-peel", Arg.Unit (add_transformation LoopPeeling.trans),
     110  " Apply loop peeling " ^
     111    help_specify_opt_stage LoopPeeling.trans;
    99112
    100     "-pre", Arg.Unit (add_transformation RedundancyElimination.trans),
    101     " Apply partial redundancy elimination.";
    102                
    103                 "-unroll-for",
    104     Arg.Int (fun i -> add_transformation (LoopUnrolling.trans ~factor:i ()) ()),
    105                 " Apply loop unrolling (specifying factor).";
     113  "-cst-prop", Arg.Unit (add_transformation ConstPropagation.trans),
     114  " Apply constant propagation " ^
     115    help_specify_opt_stage ConstPropagation.trans;
    106116
     117  "-cpy-prop", Arg.Unit (add_transformation CopyPropagation.trans),
     118  " Apply copy propagation " ^
     119    help_specify_opt_stage CopyPropagation.trans;
     120
     121  "-pre", Arg.Unit (add_transformation RedundancyElimination.trans),
     122  " Apply partial redundancy elimination " ^
     123    help_specify_opt_stage RedundancyElimination.trans;
     124
     125  "-unroll-for",
     126  Arg.Int (fun i -> add_transformation (LoopUnrolling.trans ~factor:i ()) ()),
     127  " Apply loop unrolling, specifying factor " ^
     128  help_specify_opt_stage (LoopUnrolling.trans ());
     129
     130  "-unroll", Arg.Unit (add_transformation (LoopUnrolling.trans ())),
     131  " Apply loop unrolling " ^
     132  help_specify_opt_stage (LoopUnrolling.trans ());
     133
     134  "-O", Arg.Unit (add_transformations basic_optimizations),
     135  " Apply some optimizations.";
     136
     137  "-no-cost-tern",  Arg.Clear cost_ternary_flag,
     138  " Replace cost ternary expressions with equivalent branch statements.";
     139 
    107140(*
    108141  "-res", Arg.Set print_result_flag,
Note: See TracChangeset for help on using the changeset viewer.