Handbook
Glossary
emit-conversion ( dst src dst-rep src-rep -- )
Vocabulary
compiler
.
cfg
.
representations
.
conversion
Inputs
dst
vreg
src
vreg
dst-rep
a
representation
src-rep
a
representation
Outputs
None
Word description
Emits an instruction converting a virtual register from one representation to another.
Definition
USING:
arrays
combinators
compiler.cfg.instructions
cpu.architecture
kernel
;
IN:
compiler.cfg.representations.conversion
:
emit-conversion
( dst src dst-rep src-rep -- )
{
{
[
2dup
eq?
]
[
drop
##copy,
]
}
{
[
dup
tagged-rep?
]
[
drop
tagged>rep
]
}
{
[
over
tagged-rep?
]
[
nip
rep>tagged
]
}
{
[
dup
int-rep?
]
[
drop
int>rep
]
}
{
[
over
int-rep?
]
[
nip
rep>int
]
}
[
2dup
2array
{
{
{
double-rep
float-rep
}
[
2drop
##single>double-float,
]
}
{
{
float-rep
double-rep
}
[
2drop
##double>single-float,
]
}
[
drop
2dup
[
reg-class-of
]
bi@
eq?
[
drop
##copy,
]
[
bad-conversion
]
if
]
}
case
]
}
cond
;