postload.lisp 1.38 KB
Newer Older
1 2
;;;;------------------------------------------------------------------
;;;; 
3
;;;;    Copyright (C) 20012000, 2003-2004,
4
;;;;    Department of Computer Science, University of Tromso, Norway
5 6 7 8 9 10 11
;;;; 
;;;; Filename:      postload.lisp
;;;; Description:   
;;;; Author:        Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at:    Mon Jan 31 16:33:23 2000
;;;; Distribution:  See the accompanying file COPYING.
;;;;                
12
;;;; $Id: postload.lisp,v 1.3 2004/01/16 11:54:14 ffjeld Exp $
13 14 15
;;;;                
;;;;------------------------------------------------------------------

16
(in-package #:ia-x86)
17 18 19 20 21 22 23 24 25

(defun table-stats (prefix table)
  (format t "~&;; ~A ~D x86 instruction templates loaded.~%"
	  prefix
	  (reduce #'+ (map 'list #'length
			   table)))

  (format t "~&;; ~A Longest lookup list (#x~2,'0X) has ~D elements.~%"
	  prefix
26
	  (position #0=(reduce #'max (map 'list #'length
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
					 table))
		    (map 'list #'length
			 table))
	  #0#)
  
  (format t "~&;; ~A Average lookup list length is ~,1F.~%"
	  prefix
	  (/ (reduce #'+ (map 'list #'length
			      table))
	     (length table)))

  (let ((*print-base* 16)
	(*print-radix* t))
    (format t "~&;; ~A There are ~D empty lookup lists (~D%):~%;; ~A~%"
	    prefix
	    #1=(count-if #'null table)
	    (round (* 100 (/ #1# #x100)))
	    (let (r)
	      (dotimes (i #x100 (nreverse r))
		(when (null (aref table i))
		  (push i r)))))))