2009-05-29 14:11:34 -04:00
|
|
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
2008-09-10 23:11:03 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-10-17 16:35:04 -04:00
|
|
|
USING: assocs accessors arrays kernel sequences namespaces words
|
2009-09-02 07:22:37 -04:00
|
|
|
math math.order layouts classes.algebra classes.union
|
|
|
|
compiler.units alien byte-arrays compiler.constants combinators
|
|
|
|
compiler.cfg.registers compiler.cfg.instructions.syntax ;
|
2008-09-15 02:54:48 -04:00
|
|
|
IN: compiler.cfg.instructions
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
<<
|
|
|
|
SYMBOL: insn-classes
|
|
|
|
V{ } clone insn-classes set-global
|
|
|
|
>>
|
|
|
|
|
2009-07-29 07:50:46 -04:00
|
|
|
: new-insn ( ... class -- insn ) f swap boa ; inline
|
2009-05-29 14:11:34 -04:00
|
|
|
|
2008-09-10 23:11:03 -04:00
|
|
|
! Virtual CPU instructions, used by CFG and machine IRs
|
2008-10-24 10:17:06 -04:00
|
|
|
TUPLE: insn ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
! Instructions which are referentially transparent; used for
|
|
|
|
! value numbering
|
|
|
|
TUPLE: pure-insn < insn ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
! Stack operations
|
|
|
|
INSN: ##load-immediate
|
|
|
|
def: dst/int-rep
|
|
|
|
constant: val ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##load-reference
|
|
|
|
def: dst/int-rep
|
|
|
|
constant: obj ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##peek
|
|
|
|
def: dst/int-rep
|
|
|
|
literal: loc ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##replace
|
|
|
|
use: src/int-rep
|
|
|
|
literal: loc ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##inc-d
|
|
|
|
literal: n ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##inc-r
|
|
|
|
literal: n ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
! Subroutine calls
|
|
|
|
INSN: ##call
|
|
|
|
literal: word ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##jump
|
|
|
|
literal: word ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-10-07 17:13:29 -04:00
|
|
|
INSN: ##return ;
|
|
|
|
|
2009-06-30 22:21:46 -04:00
|
|
|
! Dummy instruction that simply inhibits TCO
|
|
|
|
INSN: ##no-tco ;
|
|
|
|
|
2008-09-10 23:11:03 -04:00
|
|
|
! Jump tables
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##dispatch
|
|
|
|
use: src/int-rep
|
|
|
|
temp: temp/int-rep ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-10-20 02:56:28 -04:00
|
|
|
! Slot access
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##slot
|
|
|
|
def: dst/int-rep
|
2009-09-26 01:28:14 -04:00
|
|
|
use: obj/int-rep slot/int-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
INSN: ##slot-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: obj/int-rep
|
|
|
|
literal: slot tag ;
|
|
|
|
|
|
|
|
INSN: ##set-slot
|
2009-09-26 01:28:14 -04:00
|
|
|
use: src/int-rep obj/int-rep slot/int-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
INSN: ##set-slot-imm
|
|
|
|
use: src/int-rep obj/int-rep
|
|
|
|
literal: slot tag ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2008-11-06 02:11:28 -05:00
|
|
|
! String element access
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##string-nth
|
|
|
|
def: dst/int-rep
|
|
|
|
use: obj/int-rep index/int-rep
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##set-string-nth-fast
|
|
|
|
use: src/int-rep obj/int-rep index/int-rep
|
|
|
|
temp: temp/int-rep ;
|
2008-11-06 02:11:28 -05:00
|
|
|
|
2009-09-03 03:33:07 -04:00
|
|
|
PURE-INSN: ##copy
|
|
|
|
def: dst
|
|
|
|
use: src
|
|
|
|
literal: rep ;
|
|
|
|
|
2008-10-20 02:56:28 -04:00
|
|
|
! Integer arithmetic
|
2009-09-02 07:22:37 -04:00
|
|
|
PURE-INSN: ##add
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##add-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##sub
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##sub-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##mul
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##mul-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##and
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##and-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##or
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##or-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##xor
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##xor-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##shl
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##shl-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##shr
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##shr-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##sar
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##sar-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2 ;
|
|
|
|
|
|
|
|
PURE-INSN: ##min
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##max
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##not
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##log2
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
2008-10-20 21:40:15 -04:00
|
|
|
|
2008-10-20 02:56:28 -04:00
|
|
|
! Bignum/integer conversion
|
2009-09-02 07:22:37 -04:00
|
|
|
PURE-INSN: ##integer>bignum
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##bignum>integer
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep
|
|
|
|
temp: temp/int-rep ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
|
|
|
! Float arithmetic
|
2009-09-03 03:33:07 -04:00
|
|
|
PURE-INSN: ##unbox-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
2009-09-03 03:33:07 -04:00
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##box-float
|
|
|
|
def: dst/int-rep
|
2009-09-03 21:58:56 -04:00
|
|
|
use: src/double-rep
|
2009-09-03 03:33:07 -04:00
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
PURE-INSN: ##add-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##sub-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##mul-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##div-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##min-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##max-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##sqrt
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src/double-rep ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-08-30 05:52:01 -04:00
|
|
|
! libc intrinsics
|
2009-09-02 07:22:37 -04:00
|
|
|
PURE-INSN: ##unary-float-function
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src/double-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
literal: func ;
|
|
|
|
|
|
|
|
PURE-INSN: ##binary-float-function
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src1/double-rep src2/double-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
literal: func ;
|
2009-08-30 05:52:01 -04:00
|
|
|
|
2009-09-03 03:33:07 -04:00
|
|
|
! Single/double float conversion
|
|
|
|
PURE-INSN: ##single>double-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
|
|
|
use: src/float-rep ;
|
2009-09-03 03:33:07 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##double>single-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/float-rep
|
|
|
|
use: src/double-rep ;
|
2009-09-03 03:33:07 -04:00
|
|
|
|
2008-10-20 02:56:28 -04:00
|
|
|
! Float/integer conversion
|
2009-09-02 07:22:37 -04:00
|
|
|
PURE-INSN: ##float>integer
|
|
|
|
def: dst/int-rep
|
2009-09-03 21:58:56 -04:00
|
|
|
use: src/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##integer>float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
use: src/int-rep ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-03 03:33:07 -04:00
|
|
|
! SIMD operations
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##box-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst/int-rep
|
|
|
|
use: src
|
|
|
|
literal: rep
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##unbox-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src/int-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##broadcast-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src/scalar-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##gather-vector-2
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1/scalar-rep src2/scalar-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##gather-vector-4
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1/scalar-rep src2/scalar-rep src3/scalar-rep src4/scalar-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##add-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-21 00:16:02 -04:00
|
|
|
PURE-INSN: ##saturated-add-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-20 18:43:16 -04:00
|
|
|
PURE-INSN: ##add-sub-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-21 00:16:02 -04:00
|
|
|
PURE-INSN: ##sub-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##saturated-sub-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##mul-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
2009-09-21 00:16:02 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##saturated-mul-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
2009-09-03 03:33:07 -04:00
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##div-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##min-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 21:58:56 -04:00
|
|
|
PURE-INSN: ##max-vector
|
2009-09-03 03:33:07 -04:00
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-23 03:46:54 -04:00
|
|
|
PURE-INSN: ##horizontal-add-vector
|
|
|
|
def: dst/scalar-rep
|
|
|
|
use: src
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##abs-vector
|
2009-09-02 07:22:37 -04:00
|
|
|
def: dst
|
|
|
|
use: src
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-23 03:46:54 -04:00
|
|
|
PURE-INSN: ##sqrt-vector
|
|
|
|
def: dst
|
2009-09-03 03:33:07 -04:00
|
|
|
use: src
|
|
|
|
literal: rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
2009-09-23 03:46:54 -04:00
|
|
|
PURE-INSN: ##and-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##or-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##xor-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-24 04:32:39 -04:00
|
|
|
PURE-INSN: ##shl-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2/scalar-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##shr-vector
|
|
|
|
def: dst
|
|
|
|
use: src1 src2/scalar-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
! Scalar/integer conversion
|
|
|
|
PURE-INSN: ##scalar>integer
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src
|
|
|
|
literal: rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##integer>scalar
|
|
|
|
def: dst
|
|
|
|
use: src/int-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-03 03:33:07 -04:00
|
|
|
! Boxing and unboxing aliens
|
2009-09-02 07:22:37 -04:00
|
|
|
PURE-INSN: ##box-alien
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##box-displaced-alien
|
|
|
|
def: dst/int-rep
|
|
|
|
use: displacement/int-rep base/int-rep
|
|
|
|
temp: temp1/int-rep temp2/int-rep
|
|
|
|
literal: base-class ;
|
2008-10-20 06:55:20 -04:00
|
|
|
|
2009-09-03 22:22:43 -04:00
|
|
|
PURE-INSN: ##unbox-any-c-ptr
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
2008-10-20 06:55:20 -04:00
|
|
|
: ##unbox-f ( dst src -- ) drop 0 ##load-immediate ;
|
|
|
|
: ##unbox-byte-array ( dst src -- ) byte-array-offset ##add-imm ;
|
2009-09-03 22:22:43 -04:00
|
|
|
|
|
|
|
PURE-INSN: ##unbox-alien
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
2008-10-20 06:55:20 -04:00
|
|
|
|
|
|
|
: ##unbox-c-ptr ( dst src class temp -- )
|
2008-10-20 02:56:28 -04:00
|
|
|
{
|
2008-10-20 06:55:20 -04:00
|
|
|
{ [ over \ f class<= ] [ 2drop ##unbox-f ] }
|
|
|
|
{ [ over simple-alien class<= ] [ 2drop ##unbox-alien ] }
|
|
|
|
{ [ over byte-array class<= ] [ 2drop ##unbox-byte-array ] }
|
|
|
|
[ nip ##unbox-any-c-ptr ]
|
|
|
|
} cond ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
|
|
|
! Alien accessors
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##alien-unsigned-1
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
2008-09-17 01:46:38 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##alien-unsigned-2
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
2009-05-27 19:55:49 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##alien-unsigned-4
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-signed-1
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-signed-2
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-signed-4
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-cell
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-float
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/float-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
use: src/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-double
|
2009-09-03 21:58:56 -04:00
|
|
|
def: dst/double-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
use: src/int-rep ;
|
2009-05-27 19:55:49 -04:00
|
|
|
|
2009-09-03 03:33:07 -04:00
|
|
|
INSN: ##alien-vector
|
|
|
|
def: dst
|
|
|
|
use: src/int-rep
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##set-alien-integer-1
|
|
|
|
use: src/int-rep value/int-rep ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##set-alien-integer-2
|
|
|
|
use: src/int-rep value/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##set-alien-integer-4
|
|
|
|
use: src/int-rep value/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##set-alien-cell
|
|
|
|
use: src/int-rep value/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##set-alien-float
|
2009-09-03 21:58:56 -04:00
|
|
|
use: src/int-rep value/float-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
INSN: ##set-alien-double
|
2009-09-03 21:58:56 -04:00
|
|
|
use: src/int-rep value/double-rep ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
2009-09-03 03:33:07 -04:00
|
|
|
INSN: ##set-alien-vector
|
|
|
|
use: src/int-rep value
|
|
|
|
literal: rep ;
|
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
! Memory allocation
|
|
|
|
INSN: ##allot
|
|
|
|
def: dst/int-rep
|
|
|
|
literal: size class
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##write-barrier
|
|
|
|
use: src/int-rep
|
|
|
|
temp: card#/int-rep table/int-rep ;
|
|
|
|
|
|
|
|
INSN: ##alien-global
|
|
|
|
def: dst/int-rep
|
|
|
|
literal: symbol library ;
|
2008-12-06 10:16:29 -05:00
|
|
|
|
2009-08-21 15:13:49 -04:00
|
|
|
INSN: ##vm-field-ptr
|
|
|
|
def: dst/int-rep
|
2009-09-23 14:40:34 -04:00
|
|
|
literal: field-name ;
|
2009-08-21 15:13:49 -04:00
|
|
|
|
2008-09-10 23:11:03 -04:00
|
|
|
! FFI
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##alien-invoke
|
|
|
|
literal: params stack-frame ;
|
|
|
|
|
|
|
|
INSN: ##alien-indirect
|
|
|
|
literal: params stack-frame ;
|
|
|
|
|
|
|
|
INSN: ##alien-callback
|
|
|
|
literal: params stack-frame ;
|
|
|
|
|
|
|
|
INSN: ##callback-return
|
|
|
|
literal: params ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-09-17 01:46:38 -04:00
|
|
|
! Instructions used by CFG IR only.
|
|
|
|
INSN: ##prologue ;
|
|
|
|
INSN: ##epilogue ;
|
2008-09-15 02:54:48 -04:00
|
|
|
|
2008-09-17 01:46:38 -04:00
|
|
|
INSN: ##branch ;
|
2008-09-15 02:54:48 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##phi
|
|
|
|
def: dst
|
|
|
|
literal: inputs ;
|
2009-05-21 17:49:28 -04:00
|
|
|
|
2009-07-16 19:29:40 -04:00
|
|
|
! Conditionals
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##compare-branch
|
|
|
|
use: src1/int-rep src2/int-rep
|
|
|
|
literal: cc ;
|
|
|
|
|
|
|
|
INSN: ##compare-imm-branch
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2
|
|
|
|
literal: cc ;
|
|
|
|
|
|
|
|
PURE-INSN: ##compare
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep
|
|
|
|
literal: cc
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##compare-imm
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2
|
|
|
|
literal: cc
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
2009-09-08 18:04:26 -04:00
|
|
|
INSN: ##compare-float-ordered-branch
|
2009-09-03 21:58:56 -04:00
|
|
|
use: src1/double-rep src2/double-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
literal: cc ;
|
|
|
|
|
2009-09-08 18:04:26 -04:00
|
|
|
INSN: ##compare-float-unordered-branch
|
|
|
|
use: src1/double-rep src2/double-rep
|
|
|
|
literal: cc ;
|
|
|
|
|
|
|
|
PURE-INSN: ##compare-float-ordered
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/double-rep src2/double-rep
|
|
|
|
literal: cc
|
|
|
|
temp: temp/int-rep ;
|
|
|
|
|
|
|
|
PURE-INSN: ##compare-float-unordered
|
2009-09-02 07:22:37 -04:00
|
|
|
def: dst/int-rep
|
2009-09-03 21:58:56 -04:00
|
|
|
use: src1/double-rep src2/double-rep
|
2009-09-02 07:22:37 -04:00
|
|
|
literal: cc
|
|
|
|
temp: temp/int-rep ;
|
2008-10-20 02:56:28 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
! Overflowing arithmetic
|
|
|
|
INSN: ##fixnum-add
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
2008-10-20 06:55:20 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##fixnum-sub
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
2008-09-11 03:05:22 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##fixnum-mul
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
2009-07-16 19:29:40 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: ##gc
|
|
|
|
temp: temp1/int-rep temp2/int-rep
|
|
|
|
literal: data-values tagged-values uninitialized-locs ;
|
2009-05-31 19:21:11 -04:00
|
|
|
|
2009-09-08 22:50:55 -04:00
|
|
|
INSN: ##save-context
|
|
|
|
temp: temp1/int-rep temp2/int-rep
|
|
|
|
literal: callback-allowed? ;
|
|
|
|
|
2008-09-11 03:05:22 -04:00
|
|
|
! Instructions used by machine IR only.
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _prologue
|
|
|
|
literal: stack-frame ;
|
|
|
|
|
|
|
|
INSN: _epilogue
|
|
|
|
literal: stack-frame ;
|
2008-09-11 03:05:22 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _label
|
|
|
|
literal: label ;
|
|
|
|
|
|
|
|
INSN: _branch
|
|
|
|
literal: label ;
|
2008-09-11 03:05:22 -04:00
|
|
|
|
2009-07-22 07:05:17 -04:00
|
|
|
INSN: _loop-entry ;
|
2008-09-17 01:46:38 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _dispatch
|
|
|
|
use: src/int-rep
|
|
|
|
temp: temp ;
|
|
|
|
|
|
|
|
INSN: _dispatch-label
|
|
|
|
literal: label ;
|
2009-05-29 06:36:04 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _compare-branch
|
|
|
|
literal: label
|
|
|
|
use: src1/int-rep src2/int-rep
|
|
|
|
literal: cc ;
|
2008-10-20 06:55:20 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _compare-imm-branch
|
|
|
|
literal: label
|
|
|
|
use: src1/int-rep
|
|
|
|
constant: src2
|
|
|
|
literal: cc ;
|
2008-10-20 06:55:20 -04:00
|
|
|
|
2009-09-08 18:04:26 -04:00
|
|
|
INSN: _compare-float-unordered-branch
|
|
|
|
literal: label
|
|
|
|
use: src1/int-rep src2/int-rep
|
|
|
|
literal: cc ;
|
|
|
|
|
|
|
|
INSN: _compare-float-ordered-branch
|
2009-09-02 07:22:37 -04:00
|
|
|
literal: label
|
|
|
|
use: src1/int-rep src2/int-rep
|
|
|
|
literal: cc ;
|
2008-09-15 03:59:24 -04:00
|
|
|
|
2009-07-16 19:29:40 -04:00
|
|
|
! Overflowing arithmetic
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _fixnum-add
|
|
|
|
literal: label
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
INSN: _fixnum-sub
|
|
|
|
literal: label
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
|
|
|
|
|
|
|
INSN: _fixnum-mul
|
|
|
|
literal: label
|
|
|
|
def: dst/int-rep
|
|
|
|
use: src1/int-rep src2/int-rep ;
|
2009-07-16 19:29:40 -04:00
|
|
|
|
2009-09-27 20:28:20 -04:00
|
|
|
TUPLE: spill-slot { n integer } ;
|
|
|
|
C: <spill-slot> spill-slot
|
2009-06-02 19:23:47 -04:00
|
|
|
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _gc
|
|
|
|
temp: temp1 temp2
|
|
|
|
literal: data-values tagged-values uninitialized-locs ;
|
2009-06-02 19:23:47 -04:00
|
|
|
|
2008-10-19 02:10:21 -04:00
|
|
|
! These instructions operate on machine registers and not
|
|
|
|
! virtual registers
|
2009-09-02 07:22:37 -04:00
|
|
|
INSN: _spill
|
|
|
|
use: src
|
2009-09-27 20:28:20 -04:00
|
|
|
literal: rep dst ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
INSN: _reload
|
|
|
|
def: dst
|
2009-09-27 20:28:20 -04:00
|
|
|
literal: rep src ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
INSN: _spill-area-size
|
|
|
|
literal: n ;
|
|
|
|
|
|
|
|
UNION: ##allocation
|
|
|
|
##allot
|
|
|
|
##box-float
|
2009-09-03 03:33:07 -04:00
|
|
|
##box-vector
|
2009-09-02 07:22:37 -04:00
|
|
|
##box-alien
|
|
|
|
##box-displaced-alien
|
|
|
|
##integer>bignum ;
|
|
|
|
|
|
|
|
! For alias analysis
|
|
|
|
UNION: ##read ##slot ##slot-imm ;
|
|
|
|
UNION: ##write ##set-slot ##set-slot-imm ;
|
2009-07-16 03:17:58 -04:00
|
|
|
|
2009-08-30 05:52:01 -04:00
|
|
|
! Instructions that kill all live vregs but cannot trigger GC
|
|
|
|
UNION: partial-sync-insn
|
2009-09-02 07:22:37 -04:00
|
|
|
##unary-float-function
|
|
|
|
##binary-float-function ;
|
2009-08-30 05:52:01 -04:00
|
|
|
|
2009-07-16 03:17:58 -04:00
|
|
|
! Instructions that kill all live vregs
|
|
|
|
UNION: kill-vreg-insn
|
2009-09-02 07:22:37 -04:00
|
|
|
##call
|
|
|
|
##prologue
|
|
|
|
##epilogue
|
|
|
|
##alien-invoke
|
|
|
|
##alien-indirect
|
|
|
|
##alien-callback ;
|
2009-08-08 01:24:46 -04:00
|
|
|
|
2009-07-27 23:29:17 -04:00
|
|
|
! Instructions that have complex expansions and require that the
|
|
|
|
! output registers are not equal to any of the input registers
|
|
|
|
UNION: def-is-use-insn
|
2009-09-02 07:22:37 -04:00
|
|
|
##integer>bignum
|
|
|
|
##bignum>integer
|
2009-09-27 21:34:20 -04:00
|
|
|
##box-alien
|
|
|
|
##box-displaced-alien
|
2009-09-27 18:17:26 -04:00
|
|
|
##string-nth
|
2009-09-27 21:34:20 -04:00
|
|
|
##unbox-any-c-ptr ;
|
2009-09-02 07:22:37 -04:00
|
|
|
|
|
|
|
SYMBOL: vreg-insn
|
|
|
|
|
|
|
|
[
|
|
|
|
vreg-insn
|
|
|
|
insn-classes get [
|
|
|
|
"insn-slots" word-prop [ type>> { def use temp } memq? ] any?
|
|
|
|
] filter
|
|
|
|
define-union-class
|
2009-09-08 18:04:26 -04:00
|
|
|
] with-compilation-unit
|