- clibdir = opt_clibdir.value
- if clibdir == null then
- var dir = once ("NIT_DIR".to_symbol).environ
- if dir.is_empty then
- dir = "{sys.program_name.dirname}/../clib"
- if dir.file_exists then clibdir = dir
- else
- dir = "{dir}/clib"
- if dir.file_exists then clibdir = dir
- end
- if clibdir == null then
- fatal_error(null, "Error: Cannot locate NIT C library directory. Uses --clibdir or envvar NIT_DIR.")
- end
- end
- bindir = opt_bindir.value
-
- if bindir == null then
- var dir = once ("NIT_DIR".to_symbol).environ
- if dir.is_empty then
- dir = "{sys.program_name.dirname}/../bin"
- if dir.file_exists then bindir = dir
- else
- dir = "{dir}/bin"
- if dir.file_exists then bindir = dir
- end
- if bindir == null then
- fatal_error(null, "Error: Cannot locate NIT tools directory. Uses --bindir or envvar NIT_DIR.")
- end
- end
- end
-
- fun dump_intermediate_code(mods: Collection[MMModule])
- do
- for mod in mods do
- for c in mod.local_classes do
- if not c isa MMConcreteClass then continue
- for p in c.local_local_properties do
- var routine: nullable IRoutine = null
- if p isa MMAttribute then
- routine = p.iroutine
- else if p isa MMMethod then
- routine = p.iroutine
- end
- if routine == null then continue
- print "**** Property {p.full_name} ****"
- var icd = new ICodeDumper
- routine.dump(icd)
- print "**** OPTIMIZE {p.full_name} ****"
- routine.optimize(mod)
- icd = new ICodeDumper
- routine.dump(icd)
- end
- end
- end
- end
-
- redef fun perform_work(mods)
- do
- if opt_dump.value then
- dump_intermediate_code(mods)
- end
- for mod in mods do
- var p = new Program(mod, self)
- p.compute_main_method
- p.generate_allocation_iroutines
- p.do_table_computation
- p.compile_prog_to_c
+ var sum = opt_global.value.to_i + opt_separate.value.to_i + opt_erasure.value.to_i
+ if sum > 1 then
+ print "Options --global, --separate and --erasure are exclusive"
+ exit(1)
+ else if sum == 0 then
+ # --separate by default
+ opt_separate.value = true