Handbook
Glossary
emit-node ( block node -- block' )
Vocabulary
compiler
.
cfg
.
builder
Inputs
block
a
basic-block
node
a
node
Outputs
block'
a
basic-block
Word description
Emits CFG instructions for the given SSA node. The word can add one or more basic blocks to the
cfg
. The next block to operate on is pushed onto the stack.
The following classes emit-node methods does not change the current block:
•
#alien-assembly
•
#alien-callback
•
#alien-indirect
Definition
IN:
compiler.cfg.builder
GENERIC:
emit-node
( block node -- block' )
Methods
USING:
accessors
compiler.cfg.builder
compiler.cfg.builder.alien
compiler.cfg.instructions
compiler.tree
kernel
;
M:
#alien-assembly
emit-node
params>>
[
[
params>alien-insn-params
]
[
quot>>
]
bi
##alien-assembly,
]
[
caller-return
]
bi
;
USING:
accessors
compiler.cfg
compiler.cfg.builder
compiler.cfg.builder.alien
compiler.tree
kernel
namespaces
;
M:
#alien-callback
emit-node
dup
params>>
xt>>
dup
[
t
cfg
get
frame-pointer?<<
begin-word
over
params>>
emit-callback-inputs
over
child>>
emit-callback-body
[
swap
params>>
emit-callback-outputs
]
keep
[
end-word
drop
]
when*
]
with-cfg-builder
;
USING:
accessors
compiler.cfg.builder
compiler.cfg.builder.alien
compiler.cfg.hats
compiler.cfg.instructions
compiler.cfg.stacks
compiler.tree
kernel
;
M:
#alien-indirect
emit-node
params>>
[
[
ds-pop
^^unbox-any-c-ptr
]
dip
params>alien-insn-params
<gc-map>
##alien-indirect,
]
[
caller-return
]
bi
;
USING:
accessors
compiler.cfg.builder
compiler.cfg.builder.alien
compiler.cfg.instructions
compiler.tree
kernel
;
M:
#alien-invoke
emit-node
params>>
[
[
params>alien-insn-params
]
[
caller-linkage
]
bi
<gc-map>
##alien-invoke,
]
[
caller-return
]
bi
;
USING:
accessors
compiler.cfg.builder
compiler.cfg.builder.blocks
compiler.tree
kernel
;
M:
#call-recursive
emit-node
[
label>>
id>>
]
[
call-height
]
bi
emit-call
;
USING:
accessors
combinators
compiler.cfg.builder
compiler.cfg.builder.blocks
compiler.tree
kernel
words
;
M:
#call
emit-node
dup
word>>
dup
"intrinsic"
word-prop
[
nip
( block #call -- block' )
call-effect
]
[
swap
call-height
emit-call
]
if*
;
USING:
compiler.cfg.builder
compiler.tree
kernel
;
M:
#copy
emit-node
drop
;
USING:
compiler.cfg.builder
compiler.tree
kernel
;
M:
#declare
emit-node
drop
;
USING:
compiler.cfg.builder
compiler.cfg.hats
compiler.cfg.instructions
compiler.cfg.registers
compiler.cfg.stacks
compiler.tree
;
M:
#dispatch
emit-node
ds-pop
^^offset>slot
next-vreg
##dispatch,
emit-if
;
USING:
compiler.cfg.builder
compiler.tree
kernel
;
M:
#enter-recursive
emit-node
drop
;
USING:
combinators
compiler.cfg.builder
compiler.tree
kernel
;
M:
#if
emit-node
{
{
[
dup
trivial-if?
]
[
drop
emit-trivial-if
]
}
{
[
dup
trivial-not-if?
]
[
drop
emit-trivial-not-if
]
}
[
emit-actual-if
]
}
cond
;
USING:
compiler.cfg.builder
compiler.tree
kernel
;
M:
#introduce
emit-node
drop
;
USING:
compiler.cfg.builder
compiler.tree
kernel
;
M:
#phi
emit-node
drop
;
USING:
accessors
compiler.cfg.builder
compiler.cfg.hats
compiler.cfg.stacks
compiler.tree
;
M:
#push
emit-node
literal>>
^^load-literal
ds-push
;
USING:
accessors
compiler.cfg.builder
compiler.tree
kernel
;
M:
#recursive
emit-node
dup
label>>
loop?>>
[
emit-loop
]
[
emit-recursive
]
if
;
USING:
accessors
assocs
compiler.cfg.builder
compiler.tree
kernel
namespaces
;
M:
#return-recursive
emit-node
label>>
id>>
loops
get
key?
[
]
[
end-word
]
if
;
USING:
compiler.cfg.builder
compiler.tree
kernel
;
M:
#return
emit-node
drop
end-word
;
USING:
compiler.cfg.builder
compiler.cfg.registers
compiler.cfg.stacks
compiler.tree
kernel
sequences
;
M:
#shuffle
emit-node
[
out-vregs/stack
]
keep
store-height-changes
first2
[
ds-loc
store-vregs
]
[
rs-loc
store-vregs
]
bi*
;
USING:
compiler.cfg.builder
compiler.cfg.builder.blocks
compiler.cfg.instructions
compiler.tree
kernel
;
M:
#terminate
emit-node
drop
##no-tco,
end-basic-block
f
;