1 /* { dg-require-effective-target indirect_jumps } */
2 /* { dg-require-effective-target label_values } */
3
4 typedef int c_int;
5 union c_insn
6 {
7 void (*op) ();
8 c_int *mem;
9 c_int imm;
10 };
11 static union c_insn c_stack[((0x100 + 4) * 4)];
12 static struct c_ident *c_funcs;
13 static void (*c_op_bz) ();
14 static void c_direct (union c_insn *addr);
c_compile(int (* ext_getchar)(),void (* ext_rewind)(),struct c_ident * externs)15 c_compile (int (*ext_getchar) (), void (*ext_rewind) (),
16 struct c_ident *externs)
17 {
18 c_direct (((void *) 0));
19 }
20 static void
c_direct(union c_insn * addr)21 c_direct (union c_insn *addr)
22 {
23 union c_insn *pc = addr;
24 union c_insn *sp = c_stack;
25 c_int imm = 0;
26 static void *ops[] = {
27 &&op_index, &&op_assign, &&op_add_a, &&op_sub_a, &&op_mul_a, &&op_div_a,
28 &&op_mod_a, &&op_or_a, &&op_xor_a, &&op_and_a, &&op_shl_a, &&op_shr_a,
29 };
30 {
31 c_op_bz = &&op_bz;
32 }
33 goto *(pc++)->op;
34 op_bz:if (imm)
35 {
36 }
37 op_push_imm_imm:(sp - 2)->imm = imm;
38 goto *(pc - 1)->op;
39 op_index:imm = *((sp - 3)->mem += imm);
40 op_assign:*(sp - 3)->mem = imm;
41 op_add_a:imm = *(sp - 3)->mem += imm;
42 op_sub_a:imm = *(sp - 3)->mem -= imm;
43 op_mul_a:imm = *(sp - 3)->mem *= imm;
44 op_div_a:imm = *(sp - 3)->mem /= imm;
45 op_mod_a:imm = *(sp - 3)->mem %= imm;
46 op_or_a:imm = *(sp - 3)->mem |= imm;
47 op_xor_a:imm = *(sp - 3)->mem ^= imm;
48 op_and_a:imm = *(sp - 3)->mem &= imm;
49 op_shl_a:imm = *(sp - 3)->mem <<= imm;
50 op_shr_a:imm = *(sp - 3)->mem >>= imm;
51 }
52