From a8a33011186c5fa16a0d97a8ce773c229a49b85f Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Tue, 17 Jan 2012 20:14:54 -0800 Subject: [PATCH] Change cse-methods alist to a hash-table. --- src/compiler/rtlopt/rcse1.scm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/compiler/rtlopt/rcse1.scm b/src/compiler/rtlopt/rcse1.scm index 7fea0eded..28fe66d5a 100644 --- a/src/compiler/rtlopt/rcse1.scm +++ b/src/compiler/rtlopt/rcse1.scm @@ -92,10 +92,10 @@ USA. (let ((rtl (rinst-rtl rinst))) ((if (eq? (rtl:expression-type rtl) 'ASSIGN) cse/assign - (let ((entry (assq (rtl:expression-type rtl) cse-methods))) - (if (not entry) + (let ((method (hash-table/get cse-methods (rtl:expression-type rtl) #f))) + (if (not method) (error "Missing CSE method" (rtl:expression-type rtl))) - (cdr entry))) + method)) rtl)) (if (rinst-next rinst) (loop (rinst-next rinst)))) @@ -131,14 +131,11 @@ USA. (walk-bblock bblock)) (define (define-cse-method type method) - (let ((entry (assq type cse-methods))) - (if entry - (set-cdr! entry method) - (set! cse-methods (cons (cons type method) cse-methods)))) + (hash-table/put! cse-methods type method) type) -(define cse-methods - '()) +(define cse-methods (make-strong-eq-hash-table)) + (define (cse/assign statement) (expression-replace! rtl:assign-expression rtl:set-assign-expression! -- 2.25.1