Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
9f06f67a
Commit
9f06f67a
authored
34 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Added transforms for CONSTANTLY and COMPLEMENT.
parent
67d6823f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/srctran.lisp
+40
-1
40 additions, 1 deletion
compiler/srctran.lisp
with
40 additions
and
1 deletion
compiler/srctran.lisp
+
40
−
1
View file @
9f06f67a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.2
5
1991/01/
22 12:11:15
ram Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.2
6
1991/01/
30 23:21:37
ram Exp $
;;;
;;;
;;; This file contains macro-like source transformations which convert
;;; This file contains macro-like source transformations which convert
;;; uses of certain functions into the canonical form desired within the
;;; uses of certain functions into the canonical form desired within the
...
@@ -37,6 +37,45 @@
...
@@ -37,6 +37,45 @@
(
def-source-transform
identity
(
x
)
`
(
prog1
,
x
))
(
def-source-transform
identity
(
x
)
`
(
prog1
,
x
))
(
def-source-transform
values
(
x
)
`
(
prog1
,
x
))
(
def-source-transform
values
(
x
)
`
(
prog1
,
x
))
;;; CONSTANTLY source transform -- Internal
;;;
;;; Bind the values and make a closure that returns them.
;;;
(
def-source-transform
constantly
(
value
&rest
values
)
(
let
((
temps
(
loop
repeat
(
1+
(
length
values
))
collect
(
gensym
)))
(
dum
(
gensym
)))
`
(
let
,
(
loop
for
temp
in
temps
and
value
in
(
list*
value
values
)
collect
`
(
,
temp
,
value
))
#'
(
lambda
(
&rest
,
dum
)
(
declare
(
ignore
,
dum
))
(
values
,@
temps
)))))
;;; COMPLEMENT IR1 transform -- Internal
;;;
;;; If the function has a known number of arguments, then return a lambda
;;; with the appropriate fixed number of args. If the destination is a
;;; FUNCALL, then do the &REST APPLY thing, and let MV optimization figure
;;; things out.
;;;
(
deftransform
complement
((
fun
)
*
*
:node
node
)
(
multiple-value-bind
(
min
max
)
(
function-type-nargs
(
continuation-type
fun
))
(
cond
((
and
min
(
eql
min
max
))
(
let
((
dums
(
loop
repeat
min
collect
(
gensym
))))
`
#'
(
lambda
,
dums
(
not
(
funcall
fun
,@
dums
)))))
((
let*
((
cont
(
node-cont
node
))
(
dest
(
continuation-dest
cont
)))
(
and
(
combination-p
dest
)
(
eq
(
combination-fun
dest
)
cont
)))
'
#'
(
lambda
(
&rest
args
)
(
not
(
apply
fun
args
))))
(
t
(
give-up
"Can't open-code COMPLEMENT of a non-fixed arg function."
)))))
;;;; List hackery:
;;;; List hackery:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment