X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fir1util.lisp;h=bd3c29837b59f2d36238b9e8a5fdbbdd603fdc43;hb=068cf4b55af3f8f8acf2c7c06869441612261cd4;hp=cba2914f78a153b935388c0ebef6c16d4a015be3;hpb=697f4d1bd284ed6b72d24f416dfb09c2779b12df;p=sbcl.git diff --git a/src/compiler/ir1util.lisp b/src/compiler/ir1util.lisp index cba2914..bd3c298 100644 --- a/src/compiler/ir1util.lisp +++ b/src/compiler/ir1util.lisp @@ -1636,6 +1636,15 @@ nil)) nil))) +(defun lvar-fun-debug-name (lvar) + (declare (type lvar lvar)) + (let ((uses (lvar-uses lvar))) + (flet ((name1 (use) + (leaf-debug-name (ref-leaf use)))) + (if (ref-p uses) + (name1 uses) + (mapcar #'name1 uses))))) + ;;; Return the source name of a combination. (This is an idiom ;;; which was used in CMU CL. I gather it always works. -- WHN) (defun combination-fun-source-name (combination) @@ -1850,3 +1859,15 @@ (setf (node-reoptimize node) t) (setf (block-reoptimize (node-block node)) t) (reoptimize-component (node-component node) :maybe))))))) + +;;; True if LVAR is for 'NAME, or #'NAME (global, not local) +(defun lvar-for-named-function (lvar name) + (if (constant-lvar-p lvar) + (eq name (lvar-value lvar)) + (let ((use (lvar-uses lvar))) + (and (not (listp use)) + (ref-p use) + (let ((leaf (ref-leaf use))) + (and (global-var-p leaf) + (eq :global-function (global-var-kind leaf)) + (eq name (leaf-source-name leaf))))))))