From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta35.uswest2.a.cloudfilter.net (omta35.uswest2.a.cloudfilter.net [35.89.44.34]) by sourceware.org (Postfix) with ESMTPS id 232CA3858C2D for ; Sat, 19 Aug 2023 17:49:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 232CA3858C2D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTP id XM5AqpJz6EoVsXQ4VqsLyA; Sat, 19 Aug 2023 17:49:11 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id XQ4VqdtZGb6afXQ4VqNDdm; Sat, 19 Aug 2023 17:49:11 +0000 X-Authority-Analysis: v=2.4 cv=d4jmdDvE c=1 sm=1 tr=0 ts=64e10097 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=UttIx32zK-AA:10 a=Qbun_eYptAEA:10 a=UfCtvm4tw2tZlrQ2yp4A:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iXXN+nZfMPX6j9UpBnPgGKuk7bohd8KfByO492PlIQk=; b=ewZPpZaaGYu16s1sidiTyTEPct S7bpjJZeIe0ZCFdX5KmS4GRFk55fyQEWIJVtYyctE24H063BIQSuTfiG8huzpX6lf28i8KBlYdL9Z nylphz78G4V3i4DpiXk80PX03; Received: from 75-166-142-177.hlrn.qwest.net ([75.166.142.177]:36658 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qXQ4U-003yFg-39; Sat, 19 Aug 2023 11:49:11 -0600 From: Tom Tromey To: cgen@sourceware.org Cc: Tom Tromey Subject: [RFC 02/14] Remove some 'fastcall' code Date: Sat, 19 Aug 2023 11:42:01 -0600 Message-ID: <20230819174900.866436-3-tom@tromey.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230819174900.866436-1-tom@tromey.com> References: <20230819174900.866436-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.142.177 X-Source-L: No X-Exim-ID: 1qXQ4U-003yFg-39 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-142-177.hlrn.qwest.net (localhost.localdomain) [75.166.142.177]:36658 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCApgVKGrWD/czzLlpy6i9ODY6aEbvFxO92iVXbAWGxn3dGN0ige1n8bf+2b7VBs48np1matrTv5Ge94QSCt8qeSo2dCQHBzjdFvbI7J06NfkffPJRok CuzA/fehe3GS73X/RJaaG/t374HYa0m99EDTG+g6+tD7O2RHMVYlvtb62skXcazzlSAZqBXnRqqA/Q== X-Spam-Status: No, score=-3025.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: There are some comments referring to 'fastcall', which apparently is some sort of compilation mode for the presumably obsolete Hobbit scheme compiler. This patch removes this code and in the process removes some unnecessary global variables, by turning them into let bindings. --- sem-frags.scm | 125 ++++++++++++++++++++++---------------------------- utils.scm | 21 --------- 2 files changed, 54 insertions(+), 92 deletions(-) diff --git a/sem-frags.scm b/sem-frags.scm index 0fb26f4..0e471a0 100644 --- a/sem-frags.scm +++ b/sem-frags.scm @@ -159,12 +159,6 @@ ; Hash a statement. -; Computed hash value. -; Global 'cus /frag-hash-compute! is defined globally so we can use -; /fastcall (FIXME: Need /fastcall to work on non-global procs). - -(define /frag-hash-value-tmp 0) - (define (/frag-hash-string str) (let loop ((chars (map char->integer (string->list str))) (result 0)) (if (null? chars) @@ -172,77 +166,66 @@ (loop (cdr chars) (modulo (+ (* result 7) (car chars)) #xfffffff)))) ) -;; MODE is the name of the mode. - -(define (/frag-hash-compute! rtx-obj expr parent-expr op-pos tstate appstuff) - (let ((h 0)) - (case (rtx-name expr) - ((operand) - (set! h (/frag-hash-string (symbol->string (rtx-operand-name expr))))) - ((local) - (set! h (/frag-hash-string (symbol->string (rtx-local-name expr))))) - ((const) - (set! h (rtx-const-value expr))) - (else - (set! h (rtx-num rtx-obj)))) - (set! /frag-hash-value-tmp - ; Keep number small. - (modulo (+ (* /frag-hash-value-tmp 3) h op-pos) - #xfffffff))) - - ; #f -> "continue with normal traversing" - #f -) - (define (/frag-hash-stmt stmt locals size) - (set! /frag-hash-value-tmp 0) - (rtx-traverse-with-locals #f #f stmt /frag-hash-compute! locals #f) - (modulo /frag-hash-value-tmp size) + (let ((/frag-hash-value-tmp 0)) + (rtx-traverse-with-locals + #f #f stmt /frag-hash-compute! + (lambda (rtx-obj expr parent-expr op-pos tstate appstuff) + (let ((h 0)) + (case (rtx-name expr) + ((operand) + (set! h (/frag-hash-string (symbol->string (rtx-operand-name expr))))) + ((local) + (set! h (/frag-hash-string (symbol->string (rtx-local-name expr))))) + ((const) + (set! h (rtx-const-value expr))) + (else + (set! h (rtx-num rtx-obj)))) + (set! /frag-hash-value-tmp + ;; Keep number small. + (modulo (+ (* /frag-hash-value-tmp 3) h op-pos) + #xfffffff))) + + ;; #f -> "continue with normal traversing" + #f + ) + locals #f) + (modulo /frag-hash-value-tmp size)) ) ; Compute the speed/size costs of a statement. -; Compute speed/size costs. -; Global 'cus /frag-cost-compute! is defined globally so we can use -; /fastcall (FIXME: Need /fastcall to work on non-global procs). - -(define /frag-speed-cost-tmp 0) -(define /frag-size-cost-tmp 0) - -;; MODE is the name of the mode. - -(define (/frag-cost-compute! rtx-obj expr parent-expr op-pos tstate appstuff) - ; FIXME: wip - (let ((speed 0) - (size 0)) - (case (rtx-class rtx-obj) - ((ARG) - #f) ; these don't contribute to costs (at least for now) - ((SET) - ; FIXME: speed/size = 0? - (set! speed 1) - (set! size 1)) - ((UNARY BINARY TRINARY COMPARE) - (set! speed 1) - (set! size 1)) - ((IF) - (set! speed 2) - (set! size 2)) - (else - (set! speed 4) - (set! size 4))) - (set! /frag-speed-cost-tmp (+ /frag-speed-cost-tmp speed)) - (set! /frag-size-cost-tmp (+ /frag-size-cost-tmp size))) - - ; #f -> "continue with normal traversing" - #f -) - (define (/frag-stmt-cost stmt locals) - (set! /frag-speed-cost-tmp 0) - (set! /frag-size-cost-tmp 0) - (rtx-traverse-with-locals #f #f stmt /frag-cost-compute! locals #f) - (cons /frag-speed-cost-tmp /frag-size-cost-tmp) + (let ((/frag-speed-cost-tmp 0) + (/frag-size-cost-tmp 0)) + (rtx-traverse-with-locals + #f #f stmt + (lambda (rtx-obj expr parent-expr op-pos tstate appstuff) + ;; FIXME: wip + (let ((speed 0) + (size 0)) + (case (rtx-class rtx-obj) + ((ARG) + #f) ; these don't contribute to costs (at least for now) + ((SET) + ;; FIXME: speed/size = 0? + (set! speed 1) + (set! size 1)) + ((UNARY BINARY TRINARY COMPARE) + (set! speed 1) + (set! size 1)) + ((IF) + (set! speed 2) + (set! size 2)) + (else + (set! speed 4) + (set! size 4))) + (set! /frag-speed-cost-tmp (+ /frag-speed-cost-tmp speed)) + (set! /frag-size-cost-tmp (+ /frag-size-cost-tmp size))) + ;; #f -> "continue with normal traversing" + #f) + locals #f) + (cons /frag-speed-cost-tmp /frag-size-cost-tmp)) ) ; Add STMT to statement table DATA. diff --git a/utils.scm b/utils.scm index 8204838..330880b 100644 --- a/utils.scm +++ b/utils.scm @@ -13,27 +13,6 @@ (define nil '()) -; Hobbit support code; for when not using hobbit. -; FIXME: eliminate this stuff ASAP. - -(defmacro /fastcall-make (proc) proc) - -(defmacro fastcall4 (proc arg1 arg2 arg3 arg4) - (list proc arg1 arg2 arg3 arg4) -) - -(defmacro fastcall5 (proc arg1 arg2 arg3 arg4 arg5) - (list proc arg1 arg2 arg3 arg4 arg5) -) - -(defmacro fastcall6 (proc arg1 arg2 arg3 arg4 arg5 arg6) - (list proc arg1 arg2 arg3 arg4 arg5 arg6) -) - -(defmacro fastcall7 (proc arg1 arg2 arg3 arg4 arg5 arg6 arg7) - (list proc arg1 arg2 arg3 arg4 arg5 arg6 arg7) -) - ; Value doesn't matter too much here, just ensure it's portable. (define *UNSPECIFIED* (if #f 1)) -- 2.41.0