1 USING: accessors assocs compiler compiler.cfg
2 compiler.cfg.debugger compiler.cfg.instructions compiler.cfg.mr
3 compiler.cfg.registers compiler.codegen compiler.units
4 cpu.architecture hashtables kernel namespaces sequences
5 tools.test vectors words layouts literals math arrays
7 IN: compiler.tests.low-level-ir
9 : compile-cfg ( cfg -- word )
11 [ build-mr generate code>> ] dip
12 [ associate >alist modify-code-heap ] keep ;
14 : compile-test-cfg ( -- word )
19 : compile-test-bb ( insns -- result )
20 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
23 T{ ##replace f V int-regs 0 D 0 }
30 0 get 1 get 1vector >>successors drop
31 1 get 2 get 1vector >>successors drop
33 execute( -- result ) ;
38 T{ ##load-immediate f V int-regs 0 5 }
44 T{ ##load-reference f V int-regs 0 "hello" }
48 ! make sure slot access works when the destination is
52 T{ ##load-immediate f V int-regs 1 $[ 2 cell log2 shift ] }
53 T{ ##load-reference f V int-regs 0 { t f t } }
54 T{ ##slot f V int-regs 0 V int-regs 0 V int-regs 1 $[ array tag-number ] V int-regs 2 }
60 T{ ##load-reference f V int-regs 0 { t f t } }
61 T{ ##slot-imm f V int-regs 0 V int-regs 0 2 $[ array tag-number ] V int-regs 2 }
67 T{ ##load-immediate f V int-regs 1 $[ 2 cell log2 shift ] }
68 T{ ##load-reference f V int-regs 0 { t f t } }
69 T{ ##set-slot f V int-regs 0 V int-regs 0 V int-regs 1 $[ array tag-number ] V int-regs 2 }
76 T{ ##load-reference f V int-regs 0 { t f t } }
77 T{ ##set-slot-imm f V int-regs 0 V int-regs 0 2 $[ array tag-number ] }
84 T{ ##load-immediate f V int-regs 0 4 }
85 T{ ##shl f V int-regs 0 V int-regs 0 V int-regs 0 }
91 T{ ##load-immediate f V int-regs 0 4 }
92 T{ ##shl-imm f V int-regs 0 V int-regs 0 3 }
98 T{ ##load-reference f V int-regs 1 B{ 31 67 52 } }
99 T{ ##unbox-any-c-ptr f V int-regs 0 V int-regs 1 V int-regs 2 }
100 T{ ##alien-unsigned-1 f V int-regs 0 V int-regs 0 }
101 T{ ##shl-imm f V int-regs 0 V int-regs 0 3 }
107 T{ ##load-reference f V int-regs 0 "hello world" }
108 T{ ##load-immediate f V int-regs 1 3 }
109 T{ ##string-nth f V int-regs 0 V int-regs 0 V int-regs 1 V int-regs 2 }
110 T{ ##shl-imm f V int-regs 0 V int-regs 0 3 }
116 T{ ##load-immediate f V int-regs 0 16 }
117 T{ ##add-imm f V int-regs 0 V int-regs 0 -8 }
121 ! These are def-is-use-insns
128 T{ ##load-immediate f V int-regs 0 100 }
129 T{ ##integer>bignum f V int-regs 0 V int-regs 0 V int-regs 1 }
135 T{ ##load-reference f V int-regs 0 ALIEN: 8 }
136 T{ ##unbox-any-c-ptr f V int-regs 0 V int-regs 0 V int-regs 1 }