From f33ace67e4e0760a423b460bb76ad2b99f49b2cd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 8 Mar 2021 19:44:49 -0800 Subject: compiler: optimization control. * lisplib.c (compiler_set_entries): Register *opt-level* symbol for auto-loading. * share/txr/stdlib/compiler.tl (*opt-level*): New special variable. (compiler comp-let): Eliminate frames only at level 3. (compiler comp-lambda-impl): Lift load time at level 3. (compiler comp-arith-form): Constant-folding only at lvl 1. (compiler comp-fun-form): Algebraic substitutions and reductions and constant-folding only at level 1. (compiler comp-apply-call): Constant folding at level 1. (compiler optimize): Optimizations off if level zero. Thread jumps and eliminate dead code at level 2. Flow-analysis based optimizations at level 3. Additional optimizations at level 4. (compile comp-block): Block elimination at level 3. (compile-toplevel): Rebind *opt-level*, giving it value zero if it is previously nil. * share/txr/stdlib/optimize.tl (basic-blocks get-insns): Just retrieve the instructions, letting caller decide whether to call late-peephole or not. * txr.1: Documented *opt-level*. --- lisplib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lisplib.c') diff --git a/lisplib.c b/lisplib.c index 79c7087b..a425d95b 100644 --- a/lisplib.c +++ b/lisplib.c @@ -724,6 +724,7 @@ static val compiler_set_entries(val dlt, val fun) lit("compile-toplevel"), lit("compile"), lit("compile-file"), lit("compile-update-file"), lit("with-compilation-unit"), lit("dump-compiled-objects"), + lit("*opt-level*"), nil }; -- cgit v1.2.3