From 8171400aa1d9ad318401a4d9c4c07f5f3b374556 Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Tue, 19 Nov 2013 19:53:02 -0500 Subject: [PATCH] Actually optimize in PACK-TN We used to track location usage information, but never use it to determine which register to use. I'm not actually convinced that this change improves the quality of the code we generate, but it can't hurt for PACK-TN to actually do what it says it does: usage- guided packing can always be disabled if it's not useful. --- src/compiler/pack.lisp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/pack.lisp b/src/compiler/pack.lisp index 16ea3ab..0e93c72 100644 --- a/src/compiler/pack.lisp +++ b/src/compiler/pack.lisp @@ -1396,6 +1396,7 @@ ;;; of allocating a new stack location. (defun pack-tn (tn restricted optimize &key (allow-unbounded-sc t)) (declare (type tn tn)) + (aver (not (tn-offset tn))) (let* ((original (original-tn tn)) (fsc (tn-sc tn)) (alternates (unless restricted (sc-alternate-scs fsc))) @@ -1408,7 +1409,7 @@ ((null sc) (failed-to-pack-error tn restricted)) (unless (or allow-unbounded-sc - (neq (sb-kind (sc-sb sc)) :unbounded)) + (not (unbounded-sc-p sc))) (return nil)) (when (eq sc specified-save-sc) (unless (tn-offset save) @@ -1419,10 +1420,11 @@ (when (or restricted (not (and (minusp (tn-cost tn)) (sc-save-p sc)))) (let ((loc (or (find-ok-target-offset original sc) - (select-location original sc) + (select-location original sc :optimize optimize) (and restricted - (select-location original sc :use-reserved-locs t)) - (when (eq (sb-kind (sc-sb sc)) :unbounded) + (select-location original sc :use-reserved-locs t + :optimize optimize)) + (when (unbounded-sc-p sc) (grow-sc sc) (or (select-location original sc) (error "failed to pack after growing SC?")))))) -- 1.7.10.4