Handbook
Glossary
rewrite-redundant-comparison ( insn -- insn' )
Vocabulary
compiler
.
cfg
.
gvn
.
comparisons
Inputs
insn
an
object
Outputs
insn'
an
object
Definition
USING:
accessors
combinators
compiler.cfg.comparisons
compiler.cfg.gvn.graph
compiler.cfg.instructions
compiler.cfg.registers
kernel
;
IN:
compiler.cfg.gvn.comparisons
:
rewrite-redundant-comparison
( insn -- insn' )
[
cc>>
]
[
dst>>
]
[
src1>>
vreg>insn
]
tri
{
{
[
dup
##compare?
]
[
>compare<
next-vreg
##compare
new-insn
]
}
{
[
dup
##compare-imm?
]
[
>compare<
next-vreg
##compare-imm
new-insn
]
}
{
[
dup
##compare-integer?
]
[
>compare<
next-vreg
##compare-integer
new-insn
]
}
{
[
dup
##compare-integer-imm?
]
[
>compare<
next-vreg
##compare-integer-imm
new-insn
]
}
{
[
dup
##test?
]
[
>compare<
next-vreg
##test
new-insn
]
}
{
[
dup
##test-imm?
]
[
>compare<
next-vreg
##test-imm
new-insn
]
}
{
[
dup
##compare-float-unordered?
]
[
>compare<
next-vreg
##compare-float-unordered
new-insn
]
}
{
[
dup
##compare-float-ordered?
]
[
>compare<
next-vreg
##compare-float-ordered
new-insn
]
}
}
cond
swap
cc=
eq?
[
[
negate-cc
]
change-cc
]
when
;