From 17213d94ac9686e1e6cb2de98e58afa7ca79822b Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 12 Sep 2018 17:41:44 -0400 Subject: [PATCH] Added a TODO --- scheme/cyclone/cps-optimizations.sld | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/scheme/cyclone/cps-optimizations.sld b/scheme/cyclone/cps-optimizations.sld index b014eebe..bc66a1dc 100644 --- a/scheme/cyclone/cps-optimizations.sld +++ b/scheme/cyclone/cps-optimizations.sld @@ -1927,6 +1927,35 @@ ) (define (analyze:find-known-lambdas exp) - 'TODO) +TODO: scan for well-known lambdas: +- app of a lambda is well-known, that's easy +- lambda can be passed as a cont. If we can identify all the places the cont is called (?) and it is not used for anything but calls, then I suppose that also qualifies as well-known. + this is more problematic to generate code for, though. + may need a lookup table of symbol to well-known function (if any) +- ?? must be other cases + + (define (scan exp) + (cond + ((ast:lambda? exp) + (for-each + (lambda (e) + (scan e def-sym)) + (ast:lambda-body exp))) + ((quote? exp) exp) + ((const? exp) exp) + ((ref? exp) + exp) + ((define? exp) #f) ;; TODO ?? + ((set!? exp) #f) ;; TODO ?? + ((if? exp) + (scan (if->condition exp) def-sym) + (scan (if->then exp) def-sym) + (scan (if->else exp) def-sym)) + ((app? exp) + ) + (else #f))) + +;(trace:error `(update-lambda-atv! ,syms ,value)) + (scan exp)) ))