Skip to content

Commit f7a1ebb

Browse files
committed
BIR builder: define convenience function for start iblocks
1 parent 336bbc8 commit f7a1ebb

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

BIR-builder/builder.lisp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@
5252
(set:nadjoinf (bir:scope dynamic-environment) ib)
5353
ib))
5454

55+
;;; Make a function's initial iblock.
56+
;;; make-iblock can do this too, since the inserter is only used
57+
;;; for defaults that a start iblock doesn't need, but this function
58+
;;; lets you do it without an inserter, and also sets it up in the
59+
;;; function for you.
60+
(defun make-start-iblock (function &key (name '#:start))
61+
(let ((ib (make-instance 'bir:iblock
62+
:name name
63+
:function function :dynamic-environment function)))
64+
(setf (bir:start function) ib)
65+
(set:nadjoinf (bir:scope function) ib)
66+
ib))
67+
5568
;;; Function called to carry out any convenient post-processing
5669
;;; called when an instruction is built.
5770
;;; NOTE: An alternate design would be to make INSERT and TERMINATE generic,

BIR-builder/packages.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
(#:set #:cleavir-set))
55
(:export #:inserter #:constant #:vcell #:fcell #:adjoin-variable)
66
(:export #:begin #:proceed #:insert #:terminate)
7-
(:export #:make-iblock))
7+
(:export #:make-iblock #:make-start-iblock))

0 commit comments

Comments
 (0)