cs_options.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- Copyright (C) International Computer Science Institute, 1995.  COPYRIGHT  --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
-- the file "Doc/License" of the Sather distribution.  The license is also   --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
--------> Please email comments to sather-bugs@icsi.berkeley.edu. <----------




class CODE_OPTIONS < $GET_OPTIONS

class CODE_OPTIONS < $GET_OPTIONS is -- This is an options handler for things with back-ends. -- Don't put things that are specific to the ICSI `cs' compiler -- (e.g. CGEN) here; this is meant to be usable for other back-ends. -- Modify CS_OPTIONS for such things instead. include GET_OPTIONS create->private old_create, str->private old_str; -- because we don't know the class names at the time -- that the command line is parsed, there is a special -- representation for sets of classes with given checking -- on or off. *.union(chk_in).difference(chk_out), where -- chk is the check name and * is all classes if chk_all -- is true or the empty set if chk_all is false. attr pre_all, post_all, invariant_all, assert_all, arith_all, bounds_all, void_all, when_all, return_all:BOOL; attr pre_in, post_in, invariant_in, assert_in, arith_in, bounds_in, void_in, when_in, return_in:FSET{STR}; attr pre_out, post_out, invariant_out, assert_out, arith_out, bounds_out, void_out, when_out, return_out:FSET{STR}; attr destroy_chk, psather_chk, stats, psather_stats, psather_trace:BOOL; create(p:PROG):SAME is r::=old_create(p);-- CS_OPTIONS::old_create r.bounds_all:=true;-- CS_OPTIONS::bounds_all r.void_all:=true;-- CS_OPTIONS::void_all p.void_checks:=true;-- PROG::void_checks r.when_all:=true;-- CS_OPTIONS::when_all r.return_all:=true;-- CS_OPTIONS::return_all r.psather_chk:=true;-- CS_OPTIONS::psather_chk return r; end; str:STR is r,s:STR; s:=old_str;-- CODE_OPTIONS::old_str r:=""; if pre_all then r:=r+"All";-- CODE_OPTIONS::pre_all STR::plus else loop r:=r+'+'+pre_in.elt!; end;-- STR::plus CODE_OPTIONS::pre_in FSET{1}::elt! end; loop r:=r+'-'+pre_out.elt!; end;-- STR::plus CODE_OPTIONS::pre_out FSET{1}::elt! s:=mention("Preconditions",s,r);-- CODE_OPTIONS::mention r:=""; if post_all then r:=r+"All";-- CODE_OPTIONS::post_all STR::plus else loop r:=r+'+'+post_in.elt!; end;-- STR::plus CODE_OPTIONS::post_in FSET{1}::elt! end; loop r:=r+'-'+post_out.elt!; end;-- STR::plus CODE_OPTIONS::post_out FSET{1}::elt! s:=mention("Postconditions",s,r);-- CODE_OPTIONS::mention r:=""; if invariant_all then r:=r+"All";-- CODE_OPTIONS::invariant_all STR::plus else loop r:=r+'+'+invariant_in.elt!; end;-- STR::plus CODE_OPTIONS::invariant_in FSET{1}::elt! end; loop r:=r+'-'+invariant_out.elt!; end;-- STR::plus CODE_OPTIONS::invariant_out FSET{1}::elt! s:=mention("Invariants",s,r);-- CODE_OPTIONS::mention r:=""; if assert_all then r:=r+"All";-- CODE_OPTIONS::assert_all STR::plus else loop r:=r+'+'+assert_in.elt!; end;-- STR::plus CODE_OPTIONS::assert_in FSET{1}::elt! end; loop r:=r+'-'+assert_out.elt!; end;-- STR::plus CODE_OPTIONS::assert_out FSET{1}::elt! s:=mention("Asserts",s,r);-- CODE_OPTIONS::mention r:=""; if void_all then r:=r+"All";-- CODE_OPTIONS::void_all STR::plus else loop r:=r+'+'+void_in.elt!; end;-- STR::plus CODE_OPTIONS::void_in FSET{1}::elt! end; loop r:=r+'-'+void_out.elt!; end;-- STR::plus CODE_OPTIONS::void_out FSET{1}::elt! s:=mention("Void checks",s,r);-- CODE_OPTIONS::mention r:=""; if when_all then r:=r+"All";-- CODE_OPTIONS::when_all STR::plus else loop r:=r+'+'+when_in.elt!; end;-- STR::plus CODE_OPTIONS::when_in FSET{1}::elt! end; loop r:=r+'-'+when_out.elt!; end;-- STR::plus CODE_OPTIONS::when_out FSET{1}::elt! s:=mention("When clause",s,r);-- CODE_OPTIONS::mention r:=""; if bounds_all then r:=r+"All";-- CODE_OPTIONS::bounds_all STR::plus else loop r:=r+'+'+bounds_in.elt!; end;-- STR::plus CODE_OPTIONS::bounds_in FSET{1}::elt! end; loop r:=r+'-'+bounds_out.elt!; end;-- STR::plus CODE_OPTIONS::bounds_out FSET{1}::elt! s:=mention("Bounds",s,r);-- CODE_OPTIONS::mention if destroy_chk then r:="On"; else r:="Off"; end;-- CODE_OPTIONS::destroy_chk s:=mention("Destroy",s,r);-- CODE_OPTIONS::mention if psather_chk then r:="On"; else r:="Off"; end;-- CODE_OPTIONS::psather_chk s:=mention("pSather checks",s,r);-- CODE_OPTIONS::mention if stats then r:="On"; else r:="Off"; end;-- CODE_OPTIONS::stats s:=mention("Statistics generation",s,r);-- CODE_OPTIONS::mention if psather_stats then r:="On"; else r:="Off"; end;-- CODE_OPTIONS::psather_stats s:=mention("pSather stats",s,r);-- CODE_OPTIONS::mention if psather_trace then r:="On"; else r:="Off"; end;-- CODE_OPTIONS::psather_trace s:=mention("pSather trace",s,r);-- CODE_OPTIONS::mention r:=""; if arith_all then r:=r+"All";-- CODE_OPTIONS::arith_all STR::plus else loop r:=r+'+'+arith_in.elt!; end;-- STR::plus CODE_OPTIONS::arith_in FSET{1}::elt! end; loop r:=r+'-'+arith_out.elt!; end;-- STR::plus CODE_OPTIONS::arith_out FSET{1}::elt! s:=mention("Arith",s,r);-- CODE_OPTIONS::mention r:=""; if return_all then r:=r+"All";-- CODE_OPTIONS::return_all STR::plus else loop r:=r+'+'+return_in.elt!; end;-- STR::plus CODE_OPTIONS::return_in FSET{1}::elt! end; loop r:=r+'-'+return_out.elt!; end;-- STR::plus CODE_OPTIONS::return_out FSET{1}::elt! s:=mention("Return",s,r);-- CODE_OPTIONS::mention return s; end; pre_chk(n:STR):BOOL is return (pre_all or pre_in.test(n)) and ~pre_out.test(n);-- CS_OPTIONS::pre_all CS_OPTIONS::pre_in FSET{1}::test CS_OPTIONS::pre_out FSET{1}::test BOOL::not end; post_chk(n:STR):BOOL is return (post_all or post_in.test(n)) and ~post_out.test(n);-- CS_OPTIONS::post_all CS_OPTIONS::post_in FSET{1}::test CS_OPTIONS::post_out FSET{1}::test BOOL::not end; invariant_chk(n:STR):BOOL is return (invariant_all or invariant_in.test(n)) and ~invariant_out.test(n);-- CS_OPTIONS::invariant_all CS_OPTIONS::invariant_in FSET{1}::test CS_OPTIONS::invariant_out FSET{1}::test BOOL::not end; assert_chk(n:STR):BOOL is return (assert_all or assert_in.test(n)) and ~assert_out.test(n);-- CS_OPTIONS::assert_all CS_OPTIONS::assert_in FSET{1}::test CS_OPTIONS::assert_out FSET{1}::test BOOL::not end; arith_chk(n:STR):BOOL is return (arith_all or arith_in.test(n)) and ~arith_out.test(n);-- CS_OPTIONS::arith_all CS_OPTIONS::arith_in FSET{1}::test CS_OPTIONS::arith_out FSET{1}::test BOOL::not end; bounds_chk(n:STR):BOOL is return (bounds_all or bounds_in.test(n)) and ~bounds_out.test(n);-- CS_OPTIONS::bounds_all CS_OPTIONS::bounds_in FSET{1}::test CS_OPTIONS::bounds_out FSET{1}::test BOOL::not end; void_chk(n:STR):BOOL is return (void_all or void_in.test(n)) and ~void_out.test(n);-- CS_OPTIONS::void_all CS_OPTIONS::void_in FSET{1}::test CS_OPTIONS::void_out FSET{1}::test BOOL::not end; when_chk(n:STR):BOOL is return (when_all or when_in.test(n)) and ~when_out.test(n);-- CS_OPTIONS::when_all CS_OPTIONS::when_in FSET{1}::test CS_OPTIONS::when_out FSET{1}::test BOOL::not end; return_chk(n:STR):BOOL is return (return_all or return_in.test(n)) and ~return_out.test(n);-- CS_OPTIONS::return_all CS_OPTIONS::return_in FSET{1}::test CS_OPTIONS::return_out FSET{1}::test BOOL::not end; private handle_other_options(s:STR) is case s when "-chk_all", "-chk" then-- STR::is_eq STR::is_eq if s="-chk" then all:=true;-- STR::is_eq CODE_OPTIONS::all else get_classes;-- CODE_OPTIONS::get_classes end; prog.arith_checks:=true;-- CODE_OPTIONS::prog PROG::arith_checks prog.pre_checks:=true;-- CODE_OPTIONS::prog PROG::pre_checks prog.post_checks:=true;-- CODE_OPTIONS::prog PROG::post_checks prog.assert_checks:=true;-- CODE_OPTIONS::prog PROG::assert_checks prog.void_checks:=true;-- CODE_OPTIONS::prog PROG::void_checks if all then-- CODE_OPTIONS::all arith_all:=true; arith_out:=#;-- CODE_OPTIONS::arith_all CODE_OPTIONS::arith_out FSET{1}::create bounds_all:=true; bounds_out:=#;-- CODE_OPTIONS::bounds_all CODE_OPTIONS::bounds_out FSET{1}::create void_all:=true; void_out:=#;-- CODE_OPTIONS::void_all CODE_OPTIONS::void_out FSET{1}::create pre_all:=true; pre_out:=#;-- CODE_OPTIONS::pre_all CODE_OPTIONS::pre_out FSET{1}::create post_all:=true; post_out:=#;-- CODE_OPTIONS::post_all CODE_OPTIONS::post_out FSET{1}::create assert_all:=true; assert_out:=#;-- CODE_OPTIONS::assert_all CODE_OPTIONS::assert_out FSET{1}::create invariant_all:=true; invariant_out:=#;-- CODE_OPTIONS::invariant_all CODE_OPTIONS::invariant_out FSET{1}::create when_all:=true; when_out:=#;-- CODE_OPTIONS::when_all CODE_OPTIONS::when_out FSET{1}::create return_all:=true; return_out:=#;-- CODE_OPTIONS::return_all CODE_OPTIONS::return_out FSET{1}::create destroy_chk:=true;-- CODE_OPTIONS::destroy_chk psather_chk:=true;-- CODE_OPTIONS::psather_chk else arith_in:=arith_in.union(classes);-- CODE_OPTIONS::arith_in CODE_OPTIONS::arith_in FSET{1}::union CODE_OPTIONS::classes bounds_in:=bounds_in.union(classes);-- CODE_OPTIONS::bounds_in CODE_OPTIONS::bounds_in FSET{1}::union CODE_OPTIONS::classes void_in:=void_in.union(classes);-- CODE_OPTIONS::void_in CODE_OPTIONS::void_in FSET{1}::union CODE_OPTIONS::classes pre_in:=pre_in.union(classes);-- CODE_OPTIONS::pre_in CODE_OPTIONS::pre_in FSET{1}::union CODE_OPTIONS::classes post_in:=post_in.union(classes);-- CODE_OPTIONS::post_in CODE_OPTIONS::post_in FSET{1}::union CODE_OPTIONS::classes assert_in:=assert_in.union(classes);-- CODE_OPTIONS::assert_in CODE_OPTIONS::assert_in FSET{1}::union CODE_OPTIONS::classes invariant_in:=invariant_in.union(classes);-- CODE_OPTIONS::invariant_in CODE_OPTIONS::invariant_in FSET{1}::union CODE_OPTIONS::classes when_in:=when_in.union(classes);-- CODE_OPTIONS::when_in CODE_OPTIONS::when_in FSET{1}::union CODE_OPTIONS::classes return_in:=return_in.union(classes);-- CODE_OPTIONS::return_in CODE_OPTIONS::return_in FSET{1}::union CODE_OPTIONS::classes arith_out:=arith_out.difference(classes);-- CODE_OPTIONS::arith_out CODE_OPTIONS::arith_out FSET{1}::difference CODE_OPTIONS::classes bounds_out:=bounds_out.difference(classes);-- CODE_OPTIONS::bounds_out CODE_OPTIONS::bounds_out FSET{1}::difference CODE_OPTIONS::classes void_out:=void_out.difference(classes);-- CODE_OPTIONS::void_out CODE_OPTIONS::void_out FSET{1}::difference CODE_OPTIONS::classes pre_out:=pre_out.difference(classes);-- CODE_OPTIONS::pre_out CODE_OPTIONS::pre_out FSET{1}::difference CODE_OPTIONS::classes post_out:=post_out.difference(classes);-- CODE_OPTIONS::post_out CODE_OPTIONS::post_out FSET{1}::difference CODE_OPTIONS::classes assert_out:=assert_out.difference(classes);-- CODE_OPTIONS::assert_out CODE_OPTIONS::assert_out FSET{1}::difference CODE_OPTIONS::classes invariant_out:=invariant_out.difference(classes);-- CODE_OPTIONS::invariant_out CODE_OPTIONS::invariant_out FSET{1}::difference CODE_OPTIONS::classes when_out:=when_out.difference(classes);-- CODE_OPTIONS::when_out CODE_OPTIONS::when_out FSET{1}::difference CODE_OPTIONS::classes return_out:=return_out.difference(classes);-- CODE_OPTIONS::return_out CODE_OPTIONS::return_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_arith" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes prog.arith_checks:=true;-- CODE_OPTIONS::prog PROG::arith_checks if all then arith_all:=true; arith_out:=#;-- CODE_OPTIONS::all CODE_OPTIONS::arith_all CODE_OPTIONS::arith_out FSET{1}::create else arith_in:=arith_in.union(classes);-- CODE_OPTIONS::arith_in CODE_OPTIONS::arith_in FSET{1}::union CODE_OPTIONS::classes arith_out:=arith_out.difference(classes);-- CODE_OPTIONS::arith_out CODE_OPTIONS::arith_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_bounds" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then bounds_all:=true; bounds_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::bounds_all CODE_OPTIONS::bounds_out FSET{1}::create else bounds_in:=bounds_in.union(classes);-- CODE_OPTIONS::bounds_in CODE_OPTIONS::bounds_in FSET{1}::union CODE_OPTIONS::classes bounds_out:=bounds_out.difference(classes);-- CODE_OPTIONS::bounds_out CODE_OPTIONS::bounds_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_void" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes prog.void_checks:=true;-- CODE_OPTIONS::prog PROG::void_checks if all then void_all:=true; void_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::void_all CODE_OPTIONS::void_out FSET{1}::create else void_in:=void_in.union(classes);-- CODE_OPTIONS::void_in CODE_OPTIONS::void_in FSET{1}::union CODE_OPTIONS::classes void_out:=void_out.difference(classes);-- CODE_OPTIONS::void_out CODE_OPTIONS::void_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_pre" then-- STR::is_eq prog.pre_checks:=true;-- CODE_OPTIONS::prog PROG::pre_checks get_classes;-- CODE_OPTIONS::get_classes if all then pre_all:=true; pre_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::pre_all CODE_OPTIONS::pre_out FSET{1}::create else pre_in:=pre_in.union(classes);-- CODE_OPTIONS::pre_in CODE_OPTIONS::pre_in FSET{1}::union CODE_OPTIONS::classes pre_out:=pre_out.difference(classes);-- CODE_OPTIONS::pre_out CODE_OPTIONS::pre_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_post" then-- STR::is_eq prog.post_checks:=true;-- CODE_OPTIONS::prog PROG::post_checks get_classes;-- CODE_OPTIONS::get_classes if all then post_all:=true; post_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::post_all CODE_OPTIONS::post_out FSET{1}::create else post_in:=post_in.union(classes);-- CODE_OPTIONS::post_in CODE_OPTIONS::post_in FSET{1}::union CODE_OPTIONS::classes post_out:=post_out.difference(classes);-- CODE_OPTIONS::post_out CODE_OPTIONS::post_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_assert" then-- STR::is_eq prog.assert_checks:=true;-- CODE_OPTIONS::prog PROG::assert_checks get_classes;-- CODE_OPTIONS::get_classes if all then assert_all:=true; assert_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::assert_all CODE_OPTIONS::assert_out FSET{1}::create else assert_in:=assert_in.union(classes);-- CODE_OPTIONS::assert_in CODE_OPTIONS::assert_in FSET{1}::union CODE_OPTIONS::classes assert_out:=assert_out.difference(classes);-- CODE_OPTIONS::assert_out CODE_OPTIONS::assert_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_invariant" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then invariant_all:=true; invariant_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::invariant_all CODE_OPTIONS::invariant_out FSET{1}::create else invariant_in:=invariant_in.union(classes);-- CODE_OPTIONS::invariant_in CODE_OPTIONS::invariant_in FSET{1}::union CODE_OPTIONS::classes invariant_out:=invariant_out.difference(classes);-- CODE_OPTIONS::invariant_out CODE_OPTIONS::invariant_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_when" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then when_all:=true; when_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::when_all CODE_OPTIONS::when_out FSET{1}::create else when_in:=when_in.union(classes);-- CODE_OPTIONS::when_in CODE_OPTIONS::when_in FSET{1}::union CODE_OPTIONS::classes when_out:=when_out.difference(classes);-- CODE_OPTIONS::when_out CODE_OPTIONS::when_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_destroy" then-- STR::is_eq destroy_chk:=true;-- CODE_OPTIONS::destroy_chk when "-chk_psather" then-- STR::is_eq psather_chk:=true;-- CODE_OPTIONS::psather_chk when "-stats" then-- STR::is_eq stats:=true;-- CODE_OPTIONS::stats when "-psather_stats" then-- STR::is_eq psather_stats:=true;-- CODE_OPTIONS::psather_stats when "-psather_trace" then-- STR::is_eq psather_trace:=true;-- CODE_OPTIONS::psather_trace when "-show_am" then-- STR::is_eq prog.show_am:=true;-- CODE_OPTIONS::prog PROG::show_am when "-return" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then return_all:=true; return_out:=#; -- CODE_OPTIONS::all CODE_OPTIONS::return_all CODE_OPTIONS::return_out FSET{1}::create else return_in:=return_in.union(classes);-- CODE_OPTIONS::return_in CODE_OPTIONS::return_in FSET{1}::union CODE_OPTIONS::classes return_out:=return_out.difference(classes);-- CODE_OPTIONS::return_out CODE_OPTIONS::return_out FSET{1}::difference CODE_OPTIONS::classes end; when "-chk_no_all", "-chk_no" then-- STR::is_eq STR::is_eq if s="-chk_no" then all:=true;-- STR::is_eq CODE_OPTIONS::all else get_classes;-- CODE_OPTIONS::get_classes end; if all then-- CODE_OPTIONS::all prog.void_checks:=false;-- CODE_OPTIONS::prog PROG::void_checks prog.pre_checks:=false;-- CODE_OPTIONS::prog PROG::pre_checks prog.post_checks:=false;-- CODE_OPTIONS::prog PROG::post_checks prog.assert_checks:=false;-- CODE_OPTIONS::prog PROG::assert_checks prog.arith_checks:=false;-- CODE_OPTIONS::prog PROG::arith_checks arith_in:=#; arith_all:=false;-- CODE_OPTIONS::arith_in FSET{1}::create CODE_OPTIONS::arith_all bounds_in:=#; bounds_all:=false;-- CODE_OPTIONS::bounds_in FSET{1}::create CODE_OPTIONS::bounds_all void_in:=#; void_all:=false;-- CODE_OPTIONS::void_in FSET{1}::create CODE_OPTIONS::void_all pre_in:=#; pre_all:=false;-- CODE_OPTIONS::pre_in FSET{1}::create CODE_OPTIONS::pre_all post_in:=#; post_all:=false;-- CODE_OPTIONS::post_in FSET{1}::create CODE_OPTIONS::post_all assert_in:=#; assert_all:=false;-- CODE_OPTIONS::assert_in FSET{1}::create CODE_OPTIONS::assert_all invariant_in:=#; invariant_all:=false;-- CODE_OPTIONS::invariant_in FSET{1}::create CODE_OPTIONS::invariant_all when_in:=#; when_all:=false;-- CODE_OPTIONS::when_in FSET{1}::create CODE_OPTIONS::when_all destroy_chk:=false;-- CODE_OPTIONS::destroy_chk return_in:=#; return_all:=false;-- CODE_OPTIONS::return_in FSET{1}::create CODE_OPTIONS::return_all psather_chk:=false;-- CODE_OPTIONS::psather_chk else arith_out:=arith_out.union(classes);-- CODE_OPTIONS::arith_out CODE_OPTIONS::arith_out FSET{1}::union CODE_OPTIONS::classes bounds_out:=bounds_out.union(classes);-- CODE_OPTIONS::bounds_out CODE_OPTIONS::bounds_out FSET{1}::union CODE_OPTIONS::classes void_out:=void_out.union(classes);-- CODE_OPTIONS::void_out CODE_OPTIONS::void_out FSET{1}::union CODE_OPTIONS::classes pre_out:=pre_out.union(classes);-- CODE_OPTIONS::pre_out CODE_OPTIONS::pre_out FSET{1}::union CODE_OPTIONS::classes post_out:=post_out.union(classes);-- CODE_OPTIONS::post_out CODE_OPTIONS::post_out FSET{1}::union CODE_OPTIONS::classes assert_out:=assert_out.union(classes);-- CODE_OPTIONS::assert_out CODE_OPTIONS::assert_out FSET{1}::union CODE_OPTIONS::classes invariant_out:=invariant_out.union(classes);-- CODE_OPTIONS::invariant_out CODE_OPTIONS::invariant_out FSET{1}::union CODE_OPTIONS::classes when_out:=when_out.union(classes);-- CODE_OPTIONS::when_out CODE_OPTIONS::when_out FSET{1}::union CODE_OPTIONS::classes return_out:=return_out.union(classes);-- CODE_OPTIONS::return_out CODE_OPTIONS::return_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_arith" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then prog.arith_checks:=false;arith_in:=#; arith_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::prog PROG::arith_checks CODE_OPTIONS::arith_in FSET{1}::create CODE_OPTIONS::arith_all else arith_out:=arith_out.union(classes);-- CODE_OPTIONS::arith_out CODE_OPTIONS::arith_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_bounds" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then bounds_in:=#; bounds_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::bounds_in FSET{1}::create CODE_OPTIONS::bounds_all else bounds_out:=bounds_out.union(classes);-- CODE_OPTIONS::bounds_out CODE_OPTIONS::bounds_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_void" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then prog.void_checks:=false;void_in:=#; void_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::prog PROG::void_checks CODE_OPTIONS::void_in FSET{1}::create CODE_OPTIONS::void_all else void_out:=void_out.union(classes);-- CODE_OPTIONS::void_out CODE_OPTIONS::void_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_pre" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then prog.pre_checks:=false;pre_in:=#; pre_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::prog PROG::pre_checks CODE_OPTIONS::pre_in FSET{1}::create CODE_OPTIONS::pre_all else pre_out:=pre_out.union(classes);-- CODE_OPTIONS::pre_out CODE_OPTIONS::pre_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_post" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then prog.post_checks:=false;post_in:=#; post_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::prog PROG::post_checks CODE_OPTIONS::post_in FSET{1}::create CODE_OPTIONS::post_all else post_out:=post_out.union(classes);-- CODE_OPTIONS::post_out CODE_OPTIONS::post_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_assert" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then prog.assert_checks:=false;assert_in:=#; assert_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::prog PROG::assert_checks CODE_OPTIONS::assert_in FSET{1}::create CODE_OPTIONS::assert_all else assert_out:=assert_out.union(classes);-- CODE_OPTIONS::assert_out CODE_OPTIONS::assert_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_invariant" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then invariant_in:=#; invariant_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::invariant_in FSET{1}::create CODE_OPTIONS::invariant_all else invariant_out:=invariant_out.union(classes);-- CODE_OPTIONS::invariant_out CODE_OPTIONS::invariant_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_destroy" then-- STR::is_eq destroy_chk:=false;-- CODE_OPTIONS::destroy_chk when "-chk_no_psather" then-- STR::is_eq psather_chk:=false;-- CODE_OPTIONS::psather_chk when "-no_stats" then-- STR::is_eq stats:=false;-- CODE_OPTIONS::stats when "-no_psather_stats" then-- STR::is_eq psather_stats:=false;-- CODE_OPTIONS::psather_stats when "-no_psather_trace" then-- STR::is_eq psather_trace:=false;-- CODE_OPTIONS::psather_trace when "-chk_no_return" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then return_in:=#; return_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::return_in FSET{1}::create CODE_OPTIONS::return_all else return_out:=return_out.union(classes);-- CODE_OPTIONS::return_out CODE_OPTIONS::return_out FSET{1}::union CODE_OPTIONS::classes end; when "-chk_no_when" then-- STR::is_eq get_classes;-- CODE_OPTIONS::get_classes if all then when_in:=#; when_all:=false; -- CODE_OPTIONS::all CODE_OPTIONS::when_in FSET{1}::create CODE_OPTIONS::when_all else when_out:=when_out.union(classes);-- CODE_OPTIONS::when_out CODE_OPTIONS::when_out FSET{1}::union CODE_OPTIONS::classes end; when "-show_calls" then-- STR::is_eq prog.show_calls := next_arg;-- CODE_OPTIONS::prog PROG::show_calls CODE_OPTIONS::next_arg when "-not_a_real_platform" then-- STR::is_eq prog.genuine_platforms:=prog.genuine_platforms-1;-- CODE_OPTIONS::prog PROG::genuine_platforms CODE_OPTIONS::prog PROG::genuine_platforms INT::minus else if s[0]='-' then-- STR::aget CHAR::is_eq cfs::=prog.home+"/System/Platforms/"+s.tail(s.length-1);-- CODE_OPTIONS::prog PROG::home STR::plus STR::plus STR::tail STR::length INT::minus platform_module::=cfs+"/Platform.module";-- STR::plus f::=FILE::open_for_read(platform_module);-- FILE::open_for_read if f.error then-- FILE::error #ERR + "Unrecognized option ``" + s + -- ERR::create ERR::plus ERR::plus "'' or platform ``" + s.tail(s.length-1)+ "'' missing\n"; -- ERR::plus ERR::plus STR::tail STR::length INT::minus ERR::plus else prog.platforms:=prog.platforms.push(cfs);-- CODE_OPTIONS::prog PROG::platforms CODE_OPTIONS::prog PROG::platforms FLIST{1}::push prog.genuine_platforms:=prog.genuine_platforms+1;-- CODE_OPTIONS::prog PROG::genuine_platforms CODE_OPTIONS::prog PROG::genuine_platforms INT::plus insert_here(args_from_file(platform_module),"Platform:"+s);-- CODE_OPTIONS::insert_here CODE_OPTIONS::args_from_file STR::plus end; else handle_files(s);-- CODE_OPTIONS::handle_files end; end; end; end;

class CS_OPTIONS < $GET_OPTIONS

class CS_OPTIONS < $GET_OPTIONS is -- This is the options handler used by the standard compiler. include CODE_OPTIONS create->private was_create, str->private was_str, handle_other_options->old_handle_other_options; private attr cs:CS; private attr parser:PARSE; private attr cgen:CGEN; private attr inliner:INLINE; attr side_effects, side_debug, specul_prefetch, loop_prefetch, prefetch, cse, cse_debug :BOOL; attr prefetch_weight:INT; attr cache:BOOL; attr cache_size:INT; attr cache_slot_size:INT; private attr debug_C_seen:BOOL; private attr debug_source_seen:BOOL; create(p:PROG,cs:CS):SAME is r::=was_create(p);-- CS_OPTIONS::was_create r.prefetch_weight:=15;-- CS_OPTIONS::prefetch_weight r.cache_size:=1024;-- CS_OPTIONS::cache_size r.cache_slot_size:=8;-- CS_OPTIONS::cache_slot_size r.cs:=cs;-- CS_OPTIONS::cs be::=p.back_end;-- PROG::back_end typecase be when CGEN then r.cgen:=be;-- CS_OPTIONS::cgen if ~void(UNIX::get_env("ZONES")) then be.zones:=true; end;-- UNIX::get_env BOOL::not CGEN::zones end; pr::=p.parse;-- PROG::parse typecase pr when PARSE then r.parser:=pr; end;-- CS_OPTIONS::parser il::=p.inliner;-- PROG::inliner typecase il when INLINE then r.inliner:=il; end;-- CS_OPTIONS::inliner r.cgen.executable:="a.out";-- CS_OPTIONS::cgen CGEN::executable return r; end; str:STR is r,s:STR; s:=was_str;-- CS_OPTIONS::was_str r:=""; loop r:=r+' '+cgen.c_files.elt!; end;-- STR::plus CS_OPTIONS::cgen CGEN::c_files FSET{1}::elt! s:=mention("C files",s,r);-- CS_OPTIONS::mention r:=""; loop r:=r+' '+cgen.object_files.elt!; end;-- STR::plus CS_OPTIONS::cgen CGEN::object_files FSET{1}::elt! s:=mention("object files",s,r);-- CS_OPTIONS::mention r:=""; loop r:=r+' '+cgen.archive_files.elt!; end;-- STR::plus CS_OPTIONS::cgen CGEN::archive_files FLIST{1}::elt! s:=mention("archive files",s,r);-- CS_OPTIONS::mention s:=mention("Executable",s,cgen.executable);-- CS_OPTIONS::mention CS_OPTIONS::cgen CGEN::executable if cgen.gen_c then s:=s+"\nGenerate C."; end;-- CS_OPTIONS::cgen CGEN::gen_c STR::plus if cgen.pretty then s:=s+"\nPretty C."; end;-- CS_OPTIONS::cgen CGEN::pretty STR::plus if cgen.optimize then s:=s+"\nOptimize:"; end;-- CS_OPTIONS::cgen CGEN::optimize STR::plus if prog.opt_debug then s:=s+"\n Print Optimizer Debug Info."; end;-- CS_OPTIONS::prog PROG::opt_debug STR::plus if prog.opt_verbose then s:=s+"\n Print Optimizer Statistics."; end;-- CS_OPTIONS::prog PROG::opt_verbose STR::plus if prog.hoist_const then s:=s+"\n Hoist Constant Loop Expressions."; end;-- CS_OPTIONS::prog PROG::hoist_const STR::plus if prog.move_while then s:=s+"\n Move while!/until! to the end of loops."; end;-- CS_OPTIONS::prog PROG::move_while STR::plus if prog.replace_iters then s:=s+"\n Replace some array and int iters."; end;-- CS_OPTIONS::prog PROG::replace_iters STR::plus if inliner.inline_routs then-- CS_OPTIONS::inliner INLINE::inline_routs s:=s+"\n Inline routs of up to "+inliner.rout_thres+" stmts." end;-- STR::plus CS_OPTIONS::inliner INLINE::rout_thres STR::plus if inliner.inline_iters then-- CS_OPTIONS::inliner INLINE::inline_iters s:=s+"\n Inline iters of up to "+inliner.iter_thres+" stmts." end;-- STR::plus CS_OPTIONS::inliner INLINE::iter_thres STR::plus if prog.hoist_iter_init then s:=s+"\n Hoist Iter initializations."; end;-- CS_OPTIONS::prog PROG::hoist_iter_init STR::plus if cgen.debug then s:=s+"\nGenerate debugging info."; end;-- CS_OPTIONS::cgen CGEN::debug STR::plus if cgen.deterministic then s:=s+"\nGenerate deterministic ob ids."; end;-- CS_OPTIONS::cgen CGEN::deterministic STR::plus if cgen.type_tables then s:=s+"\nGenerate Type Tables."; end;-- CS_OPTIONS::cgen CGEN::type_tables STR::plus if cgen.func_tables then s:=s+"\nGenerate Function Tables."; end;-- CS_OPTIONS::cgen CGEN::func_tables STR::plus if cgen.print_ob then s:=s+"\nGenerate PO function."; end;-- CS_OPTIONS::cgen CGEN::print_ob STR::plus if cgen.print_ob_g then s:=s+"\nGenerate POG function."; end;-- CS_OPTIONS::cgen CGEN::print_ob_g STR::plus if cs.only_parse then s:=s+"\nStop after parsing."; end;-- CS_OPTIONS::cs CS::only_parse STR::plus if cgen.only_check then s:=s+"\nDon't generate code."; end;-- CS_OPTIONS::cgen CGEN::only_check STR::plus if cgen.only_C then s:=s+"\nDon't compile C."; end;-- CS_OPTIONS::cgen CGEN::only_C STR::plus if cs.only_reachable then s:=s+"\nDon't check unreachable code."; end;-- CS_OPTIONS::cs CS::only_reachable STR::plus if side_effects then r:="On"; else r:="Off"; end;-- CS_OPTIONS::side_effects s:=mention("Side effects",s,r);-- CS_OPTIONS::mention if side_debug then r:="On"; else r:="Off"; end;-- CS_OPTIONS::side_debug s:=mention("Side debug",s,r);-- CS_OPTIONS::mention if prefetch then r:="On"; else r:="Off"; end;-- CS_OPTIONS::prefetch s:=mention("prefetching data (pSather only, weight="+prefetch_weight+")",s,r);-- CS_OPTIONS::mention CS_OPTIONS::prefetch_weight STR::plus if specul_prefetch then r:="On"; else r:="Off"; end;-- CS_OPTIONS::specul_prefetch s:=mention("speculating prefetch (pSather only)",s,r);-- CS_OPTIONS::mention if loop_prefetch then r:="On"; else r:="Off"; end;-- CS_OPTIONS::loop_prefetch s:=mention("loop prefetch (pSather only)",s,r);-- CS_OPTIONS::mention if cache then r:="On"; else r:="Off"; end;-- CS_OPTIONS::cache s:=mention("cache (pSather only, size="+cache_size+" a "+cache_slot_size+")",s,r);-- CS_OPTIONS::mention CS_OPTIONS::cache_size STR::plus CS_OPTIONS::cache_slot_size STR::plus if cse then r:="On"; else r:="Off"; end;-- CS_OPTIONS::cse s:=mention("Common Subexpression elimination",s,r);-- CS_OPTIONS::mention if cse_debug then r:="On"; else r:="Off"; end;-- CS_OPTIONS::cse_debug s:=mention("CSE debug",s,r);-- CS_OPTIONS::mention if cgen.zones then s:=s+"\nExperimental zone runtime enabled."; end;-- CS_OPTIONS::cgen CGEN::zones STR::plus r:=""; if ~cgen.c_flags.is_empty then loop r:=r+' '+cgen.c_flags.elt!; end; end;-- CS_OPTIONS::cgen CGEN::c_flags FLIST{1}::is_empty BOOL::not STR::plus CS_OPTIONS::cgen CGEN::c_flags FLIST{1}::elt! s:=mention("C flags",s,r);-- CS_OPTIONS::mention if ~cgen.externals.is_empty then-- CS_OPTIONS::cgen CGEN::externals FMAP{2}::is_empty BOOL::not s:=s+"\nExternals:";-- STR::plus loop p::=cgen.externals.pairs!;-- CS_OPTIONS::cgen CGEN::externals FMAP{2}::pairs! s:=s+"\n "+p.t1+" -> {";-- STR::plus STR::plus TUP{2}::t1 STR::plus loop s:=s+", ".separate!(p.t2.elt!); end;-- STR::plus STR::separate! TUP{2}::t2 FSET{1}::elt! s:=s+"}";-- STR::plus end; end; --if ~parser.has.is_empty then -- s:=s+"\nHas:"; -- loop p::=parser.has.pairs!; s:=s+"\n "+p.t1+" in "+p.t2; end; -- s:=s+"\n"; --end; r:=""; if cgen.force_all then r:=r+"All";-- CS_OPTIONS::cgen CGEN::force_all STR::plus elsif ~cgen.force_routines.is_empty then-- CS_OPTIONS::cgen CGEN::force_routines FSET{1}::is_empty BOOL::not loop r:=r+' '+cgen.force_routines.elt!; end;-- STR::plus CS_OPTIONS::cgen CGEN::force_routines FSET{1}::elt! end; s:=mention("Forced routines",s,r);-- CS_OPTIONS::mention return s; end; private handle_other_options(s:STR) is case s when "-o" then cgen.executable:=next_arg;-- STR::is_eq CS_OPTIONS::cgen CGEN::executable CS_OPTIONS::next_arg when "-output_C" then cgen.gen_c:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::gen_c when "-pretty" then cgen.pretty:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::pretty when "-only_parse" then cs.only_parse:=true;-- STR::is_eq CS_OPTIONS::cs CS::only_parse when "-only_check" then cgen.only_check:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::only_check when "-only_C" then cgen.only_C:=true; cgen.gen_c:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::only_C CS_OPTIONS::cgen CGEN::gen_c when "-only_reachable" then cs.only_reachable:=true;-- STR::is_eq CS_OPTIONS::cs CS::only_reachable when "-O" then -- STR::is_eq prog.inline_routs:=true;-- CS_OPTIONS::prog PROG::inline_routs prog.inline_iters:=true;-- CS_OPTIONS::prog PROG::inline_iters prog.move_while:=true;-- CS_OPTIONS::prog PROG::move_while prog.replace_iters:=true;-- CS_OPTIONS::prog PROG::replace_iters prog.hoist_iter_init:=true;-- CS_OPTIONS::prog PROG::hoist_iter_init prog.hoist_const:=true;-- CS_OPTIONS::prog PROG::hoist_const cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize inliner.inline_routs:=true;-- CS_OPTIONS::inliner INLINE::inline_routs inliner.inline_iters:=true;-- CS_OPTIONS::inliner INLINE::inline_iters side_effects:=true;-- CS_OPTIONS::side_effects cse:=true;-- CS_OPTIONS::cse when "-debug_source" then-- STR::is_eq if debug_C_seen then-- CS_OPTIONS::debug_C_seen prog.barf("You may not combine -debug_C with -debug_source");-- CS_OPTIONS::prog PROG::barf end; cgen.debug:=true;-- CS_OPTIONS::cgen CGEN::debug cgen.gen_c:=true;-- CS_OPTIONS::cgen CGEN::gen_c debug_source_seen:=true;-- CS_OPTIONS::debug_source_seen when "-debug_deterministic" then cgen.deterministic:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::deterministic when "-debug" then -- STR::is_eq if cgen.print_ob_g then-- CS_OPTIONS::cgen CGEN::print_ob_g prog.barf("You may not combine -debug and -debug_graphical");-- CS_OPTIONS::prog PROG::barf end; if ~cgen.print_ob then-- CS_OPTIONS::cgen CGEN::print_ob BOOL::not cgen.print_ob:=true;cgen.func_tables:=true;-- CS_OPTIONS::cgen CGEN::print_ob CS_OPTIONS::cgen CGEN::func_tables cgen.type_tables:=true;-- CS_OPTIONS::cgen CGEN::type_tables insert_here(args_from_file(prog.home+"/System/Debug/PO.module"),-- CS_OPTIONS::insert_here CS_OPTIONS::prog PROG::home STR::plus "system defined PO module"); end; cgen.debug:=true;-- CS_OPTIONS::cgen CGEN::debug cgen.gen_c:=true;-- CS_OPTIONS::cgen CGEN::gen_c when "-debug_graphical" then-- STR::is_eq if cgen.print_ob and ~cgen.print_ob_g then-- CS_OPTIONS::cgen CGEN::print_ob CS_OPTIONS::cgen CGEN::print_ob_g BOOL::not prog.barf("You may not combine -debug and -debug_graphical");-- CS_OPTIONS::prog PROG::barf end; if ~cgen.print_ob_g then-- CS_OPTIONS::cgen CGEN::print_ob_g BOOL::not cgen.print_ob_g:=true; cgen.func_tables:=true;-- CS_OPTIONS::cgen CGEN::print_ob_g CS_OPTIONS::cgen CGEN::func_tables cgen.type_tables:=true;-- CS_OPTIONS::cgen CGEN::type_tables insert_here(args_from_file(prog.home+"/System/Debug/POG.module"),-- CS_OPTIONS::insert_here CS_OPTIONS::prog PROG::home STR::plus "system defined System/Debug/POG.module"); end; cgen.debug:=true;-- CS_OPTIONS::cgen CGEN::debug cgen.gen_c:=true;-- CS_OPTIONS::cgen CGEN::gen_c when "-debug_C" then-- STR::is_eq if debug_source_seen then-- CS_OPTIONS::debug_source_seen prog.barf("You may not combine -debug_C with -debug_source");-- CS_OPTIONS::prog PROG::barf end; debug_C_seen:=true;-- CS_OPTIONS::debug_C_seen cgen.c_flags:=cgen.c_flags.push("-g");-- CS_OPTIONS::cgen CGEN::c_flags CS_OPTIONS::cgen CGEN::c_flags FLIST{1}::push cgen.debug:=false;-- CS_OPTIONS::cgen CGEN::debug cgen.gen_c:=true;-- CS_OPTIONS::cgen CGEN::gen_c cgen.pretty:=true;-- CS_OPTIONS::cgen CGEN::pretty if ~cgen.print_ob then-- CS_OPTIONS::cgen CGEN::print_ob BOOL::not cgen.print_ob:=true;cgen.func_tables:=true;-- CS_OPTIONS::cgen CGEN::print_ob CS_OPTIONS::cgen CGEN::func_tables cgen.type_tables:=true;-- CS_OPTIONS::cgen CGEN::type_tables insert_here(args_from_file(prog.home+"/System/Debug/PO.module"),-- CS_OPTIONS::insert_here CS_OPTIONS::prog PROG::home STR::plus "system defined PO module"); end; when "-reflect" then -- STR::is_eq cgen.type_tables:=true;-- CS_OPTIONS::cgen CGEN::type_tables cgen.func_tables := true;-- CS_OPTIONS::cgen CGEN::func_tables insert_here(args_from_file(prog.home+"/System/Reflection/reflection.module"), "system defined System/Reflection/reflection module");-- CS_OPTIONS::insert_here CS_OPTIONS::prog PROG::home STR::plus when "-P_type" then cgen.type_tables:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::type_tables when "-P_func" then cgen.type_tables:=true;cgen.func_tables:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::type_tables CS_OPTIONS::cgen CGEN::func_tables when "-C_flag" then cgen.c_flags:=cgen.c_flags.push(next_arg);-- STR::is_eq CS_OPTIONS::cgen CGEN::c_flags CS_OPTIONS::cgen CGEN::c_flags FLIST{1}::push CS_OPTIONS::next_arg when "-external" then -- STR::is_eq cgen.externals:=cgen.externals.insert(next_arg,files);-- CS_OPTIONS::cgen CGEN::externals CS_OPTIONS::cgen CGEN::externals FMAP{2}::insert CS_OPTIONS::next_arg CS_OPTIONS::files when "-has" then-- STR::is_eq fn::=next_arg;-- CS_OPTIONS::next_arg parser.known_files:=parser.known_files.insert(fn);-- CS_OPTIONS::parser PARSE::known_files CS_OPTIONS::parser PARSE::known_files FSET{1}::insert get_classes;-- CS_OPTIONS::get_classes loop parser.has:=parser.has.insert(classes.elt!,fn); end;-- CS_OPTIONS::parser PARSE::has CS_OPTIONS::parser PARSE::has FMAP{2}::insert CS_OPTIONS::classes FSET{1}::elt! when "-O_hoist_iter_init" then-- STR::is_eq cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize prog.hoist_iter_init:=true;-- CS_OPTIONS::prog PROG::hoist_iter_init when "-O_no_hoist_iter_init" then-- STR::is_eq prog.hoist_iter_init:=false;-- CS_OPTIONS::prog PROG::hoist_iter_init when "-O_move_while" then-- STR::is_eq prog.move_while:=true;-- CS_OPTIONS::prog PROG::move_while cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_no_move_while" then-- STR::is_eq prog.move_while:=false;-- CS_OPTIONS::prog PROG::move_while when "-O_hoist_const" then-- STR::is_eq prog.hoist_const:=true;-- CS_OPTIONS::prog PROG::hoist_const cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_no_hoist_const" then-- STR::is_eq prog.hoist_const:=false;-- CS_OPTIONS::prog PROG::hoist_const when "-replace_iters" then-- STR::is_eq prog.replace_iters:=true;-- CS_OPTIONS::prog PROG::replace_iters cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-no_replace_iters" then-- STR::is_eq prog.replace_iters:=false;-- CS_OPTIONS::prog PROG::replace_iters when "-O_no_inline" then-- STR::is_eq inliner.inline_routs:=false;-- CS_OPTIONS::inliner INLINE::inline_routs inliner.inline_iters:=false;-- CS_OPTIONS::inliner INLINE::inline_iters prog.inline_routs:=false;-- CS_OPTIONS::prog PROG::inline_routs prog.inline_iters:=false;-- CS_OPTIONS::prog PROG::inline_iters when "-O_inline" then-- STR::is_eq -- enable default inlining for both routs and iters inliner.inline_routs:=true;-- CS_OPTIONS::inliner INLINE::inline_routs inliner.inline_iters:=true;-- CS_OPTIONS::inliner INLINE::inline_iters prog.inline_routs:=true;-- CS_OPTIONS::prog PROG::inline_routs prog.inline_iters:=true;-- CS_OPTIONS::prog PROG::inline_iters cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_inline_routines" then-- STR::is_eq inliner.rout_thres:=#INT(next_arg); -- CS_OPTIONS::inliner INLINE::rout_thres INT::create CS_OPTIONS::next_arg prog.inline_routs:=true;-- CS_OPTIONS::prog PROG::inline_routs inliner.inline_routs:=inliner.rout_thres>0;-- CS_OPTIONS::inliner INLINE::inline_routs CS_OPTIONS::inliner INLINE::rout_thres INT::is_lt cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_inline_iters" then-- STR::is_eq inliner.iter_thres:=#INT(next_arg);-- CS_OPTIONS::inliner INLINE::iter_thres INT::create CS_OPTIONS::next_arg prog.inline_iters:=true;-- CS_OPTIONS::prog PROG::inline_iters inliner.inline_iters:=inliner.iter_thres>0; -- CS_OPTIONS::inliner INLINE::inline_iters CS_OPTIONS::inliner INLINE::iter_thres INT::is_lt cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_yields_in_locks" then-- STR::is_eq prog.yields_in_locks:=true;-- CS_OPTIONS::prog PROG::yields_in_locks side_effects:=true;-- CS_OPTIONS::side_effects when "-O_no_yields_in_locks" then-- STR::is_eq prog.yields_in_locks:=false;-- CS_OPTIONS::prog PROG::yields_in_locks when "-O_locks_on_stack" then-- STR::is_eq prog.locks_on_stack:=true;-- CS_OPTIONS::prog PROG::locks_on_stack side_effects:=true;-- CS_OPTIONS::side_effects when "-O_no_locks_on_stack" then-- STR::is_eq prog.locks_on_stack:=false;-- CS_OPTIONS::prog PROG::locks_on_stack when "-O_fast" then-- STR::is_eq cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize inliner.inline_routs:=true;-- CS_OPTIONS::inliner INLINE::inline_routs inliner.inline_iters:=true;-- CS_OPTIONS::inliner INLINE::inline_iters prog.inline_routs:=true;-- CS_OPTIONS::prog PROG::inline_routs prog.inline_iters:=true;-- CS_OPTIONS::prog PROG::inline_iters prog.move_while:=true;-- CS_OPTIONS::prog PROG::move_while prog.replace_iters:=true;-- CS_OPTIONS::prog PROG::replace_iters prog.hoist_iter_init:=true;-- CS_OPTIONS::prog PROG::hoist_iter_init prog.hoist_const:=true;-- CS_OPTIONS::prog PROG::hoist_const prog.yields_in_locks:=true;-- CS_OPTIONS::prog PROG::yields_in_locks prog.locks_on_stack:=true;-- CS_OPTIONS::prog PROG::locks_on_stack side_effects:=true;-- CS_OPTIONS::side_effects cse:=true;-- CS_OPTIONS::cse arith_in:=#; arith_all:=false;-- CS_OPTIONS::arith_in FSET{1}::create CS_OPTIONS::arith_all bounds_in:=#; bounds_all:=false;-- CS_OPTIONS::bounds_in FSET{1}::create CS_OPTIONS::bounds_all void_in:=#; void_all:=false;-- CS_OPTIONS::void_in FSET{1}::create CS_OPTIONS::void_all pre_in:=#; pre_all:=false;-- CS_OPTIONS::pre_in FSET{1}::create CS_OPTIONS::pre_all post_in:=#; post_all:=false;-- CS_OPTIONS::post_in FSET{1}::create CS_OPTIONS::post_all assert_in:=#; assert_all:=false;-- CS_OPTIONS::assert_in FSET{1}::create CS_OPTIONS::assert_all invariant_in:=#; invariant_all:=false;-- CS_OPTIONS::invariant_in FSET{1}::create CS_OPTIONS::invariant_all when_in:=#; when_all:=false;-- CS_OPTIONS::when_in FSET{1}::create CS_OPTIONS::when_all destroy_chk:=false;-- CS_OPTIONS::destroy_chk return_in:=#; return_all:=false;-- CS_OPTIONS::return_in FSET{1}::create CS_OPTIONS::return_all prog.arith_checks:=false;-- CS_OPTIONS::prog PROG::arith_checks prog.assert_checks:=false;-- CS_OPTIONS::prog PROG::assert_checks prog.void_checks:=false;-- CS_OPTIONS::prog PROG::void_checks prog.pre_checks:=false;-- CS_OPTIONS::prog PROG::pre_checks prog.post_checks:=false;-- CS_OPTIONS::prog PROG::post_checks when "-force" then-- STR::is_eq cgen.force_routines:=cgen.force_routines.insert(next_arg);-- CS_OPTIONS::cgen CGEN::force_routines CS_OPTIONS::cgen CGEN::force_routines FSET{1}::insert CS_OPTIONS::next_arg when "-force_all" then cgen.force_all:=true;-- STR::is_eq CS_OPTIONS::cgen CGEN::force_all when "-threshold" then cgen.threshold:=#STR_CURSOR(next_arg).int;-- STR::is_eq CS_OPTIONS::cgen CGEN::threshold STR_CURSOR::create CS_OPTIONS::next_arg STR_CURSOR::int when "-zones" then-- STR::is_eq cgen.zones:=true; -- Please leave undocumented-- CS_OPTIONS::cgen CGEN::zones when "-O_cache" then-- STR::is_eq cache:=true;-- CS_OPTIONS::cache when "-O_cache_size" then-- STR::is_eq cache_size:=#INT(next_arg);-- CS_OPTIONS::cache_size INT::create CS_OPTIONS::next_arg when "-O_cache_slot_size" then-- STR::is_eq cache_slot_size:=#INT(next_arg);-- CS_OPTIONS::cache_slot_size INT::create CS_OPTIONS::next_arg when "-O_side_effects" then-- STR::is_eq side_effects:=true;-- CS_OPTIONS::side_effects when "-O_side_debug" then-- STR::is_eq side_effects:=true;-- CS_OPTIONS::side_effects side_debug:=true;-- CS_OPTIONS::side_debug when "-O_prefetch_weight" then-- STR::is_eq prefetch_weight:=#INT(next_arg); -- CS_OPTIONS::prefetch_weight INT::create CS_OPTIONS::next_arg when "-O_specul_prefetch" then-- STR::is_eq loop_prefetch:=true;-- CS_OPTIONS::loop_prefetch specul_prefetch:=true;-- CS_OPTIONS::specul_prefetch prefetch:=true;-- CS_OPTIONS::prefetch side_effects:=true;-- CS_OPTIONS::side_effects cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_loop_prefetch" then-- STR::is_eq loop_prefetch:=true;-- CS_OPTIONS::loop_prefetch prefetch:=true;-- CS_OPTIONS::prefetch side_effects:=true;-- CS_OPTIONS::side_effects cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_prefetch" then-- STR::is_eq prefetch:=true;-- CS_OPTIONS::prefetch side_effects:=true;-- CS_OPTIONS::side_effects cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_cse" then-- STR::is_eq cse:=true;-- CS_OPTIONS::cse side_effects:=true;-- CS_OPTIONS::side_effects cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_cse_debug" then-- STR::is_eq cse:=true;-- CS_OPTIONS::cse cse_debug:=true;-- CS_OPTIONS::cse_debug side_effects:=true;-- CS_OPTIONS::side_effects cgen.optimize:=true;-- CS_OPTIONS::cgen CGEN::optimize when "-O_no_side_effects" then-- STR::is_eq side_effects:=false;-- CS_OPTIONS::side_effects when "-O_no_side_debug" then-- STR::is_eq side_debug:=false;-- CS_OPTIONS::side_debug when "-O_no_cache" then-- STR::is_eq cache:=false;-- CS_OPTIONS::cache when "-O_no_prefetch" then-- STR::is_eq prefetch:=false;-- CS_OPTIONS::prefetch when "-O_no_specul_prefetch" then-- STR::is_eq specul_prefetch:=false;-- CS_OPTIONS::specul_prefetch when "-O_no_loop_prefetch" then-- STR::is_eq loop_prefetch:=false;-- CS_OPTIONS::loop_prefetch when "-O_no_cse" then-- STR::is_eq cse:=false;-- CS_OPTIONS::cse when "-O_no_cse_debug" then-- STR::is_eq cse_debug:=false;-- CS_OPTIONS::cse_debug when "-convert" then-- STR::is_eq arg::=next_arg;-- CS_OPTIONS::next_arg parser.convert_files := parser.convert_files.insert(arg);-- CS_OPTIONS::parser PARSE::convert_files CS_OPTIONS::parser PARSE::convert_files FSET{1}::insert path::=FILE::resolve_path(arg);-- FILE::resolve_path if ~paths.test(path) then-- CS_OPTIONS::paths FSET{1}::test BOOL::not prog.sather_files:=prog.sather_files.insert(arg);-- CS_OPTIONS::prog PROG::sather_files CS_OPTIONS::prog PROG::sather_files FSET{1}::insert paths:=paths.insert(path);-- CS_OPTIONS::paths CS_OPTIONS::paths FSET{1}::insert end; when "-convert_all" then-- STR::is_eq parser.convert_all := true;-- CS_OPTIONS::parser PARSE::convert_all parser.version_1_0 := true; -- CS_OPTIONS::parser PARSE::version_1_0 when "-V1.0" then-- STR::is_eq parser.version_1_0 := true;-- CS_OPTIONS::parser PARSE::version_1_0 when "-version" then-- STR::is_eq prog.print_version := true;-- CS_OPTIONS::prog PROG::print_version when "-V" then-- STR::is_eq prog.print_version := true;-- CS_OPTIONS::prog PROG::print_version else old_handle_other_options(s);-- CS_OPTIONS::old_handle_other_options end; end; private handle_other_file_suffix(arg,suf:STR) is case suf when ".c" then cgen.c_files:=cgen.c_files.insert(arg);-- STR::is_eq CS_OPTIONS::cgen CGEN::c_files CS_OPTIONS::cgen CGEN::c_files FSET{1}::insert when ".o",".obj" then cgen.object_files:=cgen.object_files.insert(arg);-- STR::is_eq STR::is_eq CS_OPTIONS::cgen CGEN::object_files CS_OPTIONS::cgen CGEN::object_files FSET{1}::insert when ".a",".lib" then cgen.archive_files:=cgen.archive_files.push(arg);-- STR::is_eq STR::is_eq CS_OPTIONS::cgen CGEN::archive_files CS_OPTIONS::cgen CGEN::archive_files FLIST{1}::push else #ERR + "Didn't understand apparent file name: " + arg + '\n';-- ERR::create ERR::plus ERR::plus ERR::plus usage;-- CS_OPTIONS::usage --rewind; end; end; end;