summaryrefslogtreecommitdiffstats
path: root/arith.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-18 20:04:03 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-18 20:04:03 -0800
commitf42715f03ed773d375d88717c65605b020cfc467 (patch)
tree32d602e91a4bcdd439a5d2a41307b8f4a1ed80c2 /arith.c
parentf2441b0b93c9ed2c4d0ca46c89f0677fc60a5a85 (diff)
downloadtxr-f42715f03ed773d375d88717c65605b020cfc467.tar.gz
txr-f42715f03ed773d375d88717c65605b020cfc467.tar.bz2
txr-f42715f03ed773d375d88717c65605b020cfc467.zip
compiler: start of constant-folding implementation.
Introducing folding of certain expressions that can be evaluated at compile time, with some special handling for common arithmetic functions, in which we can collapse consecutive arguments that are constant integer expressions. * share/txr/stdlib/compiler.tl (%const-foldable-funs%): New global variable. (compiler compile): Send multiplication and division through new methods that that treat integer arguments. (compiler comp-arith-form, compiler comp-neg-arith-form): New methods. (comp-fun-form): Apply constant folding to a proper function call whose operator is listed in %const-foldable-funs%. (reduce-constant): New function.
Diffstat (limited to 'arith.c')
0 files changed, 0 insertions, 0 deletions