add some more info from tamarin opcode list, mark missing opcodes #s
[swf2.git] / compile / low-level.lisp
blobe751207d34037ee37fac27d51d7a9a8fcb51faf8
1 (in-package :avm2-compiler)
3 ;;;; misc low level operators, mostly just renaming asm opcodes
4 ;;; might not actually need most of these now, use %asm instead?
6 (defmacro define-0ary-ops (&body ops)
7 `(progn
8 ,@(loop for i in ops
9 collect `(defmethod scompile-cons ((car (eql ',(car i))) cdr)
10 (declare (ignore cdr))
11 '((,(second i)))))))
13 (define-0ary-ops
14 (%break :breakpoint)
15 (%nop :nop)
16 (%pop :pop)
17 (%dup :dup)
18 (%swap :swap)
19 (%push-null :push-null)
22 (defmacro define-unary-ops (&body ops)
23 `(progn
24 ,@(loop for i in ops
25 collect `(defmethod scompile-cons ((car (eql ',(car i))) cdr)
26 (append
27 (scompile (first cdr))
28 '((,(second i))))))))
30 (define-unary-ops
31 (throw throw)
32 (%1- :negate)
33 (%1++ :increment)
34 (%1-- :decrement)
35 (type-of :type-of)
36 (not :not)
37 (lognot :bit-not)
38 (%to-integer :convert-integer)
39 (%to-double :convert-double)
40 (%to-string :convert-string)
43 (define-special %1/ (value)
44 (append
45 '((:push-byte 1))
46 (scompile value)
47 '((:divide))))
48 ;; (scompile '(%1/ 1.234))
50 (defmacro define-binops (&body ops)
51 `(progn
52 ,@(loop for i in ops
53 collect `(defmethod scompile-cons ((car (eql ',(car i))) cdr)
54 (append
55 (scompile (first cdr))
56 (scompile (second cdr))
57 '((,(second i))))))))
59 (define-binops
60 (mod :modulo)
61 (lsh :lshift)
62 (rsh :rshift)
63 (ursh :unsigned-rshift)
64 (equal :equals) ;; fixme: decide if these are mapped correctly
65 (eq :strict-equals) ;; fixme: decide if these are mapped correctly
67 (instance-of :instance-of)
69 (%2< :less-than)
70 (%2<= :less-equals)
71 (%2> :greater-than)
72 (%2>= :greater-equals)
74 (%2+ :add)
75 (%2- :subtract)
76 (%2* :multiply)
77 (%2/ :divide)
78 (%2logand :bit-and)
79 (%2logor :bit-or)
80 (%2logxor :bit-xor)