1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

assembly/disassembly support for br-if-nargs-*

* module/language/assembly/compile-bytecode.scm (write-bytecode): Handle
  br-if-nargs compilation.

* module/language/assembly/decompile-bytecode.scm (decode-load-program):
  And decompile them nicely as well.

* module/language/assembly/disassemble.scm (code-annotation): And,
  present the disassembly if br-if-nargs-* nicely.
This commit is contained in:
Andy Wingo 2009-10-25 12:41:48 +01:00
parent df435c8307
commit 8b65211204
3 changed files with 9 additions and 0 deletions

View file

@ -42,6 +42,8 @@
(define (br-instruction? x)
(memq x '(br br-if br-if-not br-if-eq br-if-not-eq br-if-null br-if-not-null)))
(define (br-nargs-instruction? x)
(memq x '(br-if-nargs-ne br-if-nargs-lt br-if-nargs-gt)))
(define (bytes->s24 a b c)
(let ((x (+ (ash a 16) (ash b 8) c)))
@ -84,6 +86,8 @@
(pmatch exp
((,br ,rel1 ,rel2 ,rel3) (guard (br-instruction? br))
(lp (cons `(,br ,(ensure-label rel1 rel2 rel3)) out)))
((,br ,hi ,lo ,rel1 ,rel2 ,rel3) (guard (br-nargs-instruction? br))
(lp (cons `(,br ,hi ,lo ,(ensure-label rel1 rel2 rel3)) out)))
((mv-call ,n ,rel1 ,rel2 ,rel3)
(lp (cons `(mv-call ,n ,(ensure-label rel1 rel2 rel3)) out)))
(else