• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%default { "func":"MterpDoPackedSwitch" }
2    /*
3     * Handle a packed-switch or sparse-switch instruction.  In both cases
4     * we decode it and hand it off to a helper function.
5     *
6     * We don't really expect backward branches in a switch statement, but
7     * they're perfectly legal, so we check for them here.
8     *
9     * for: packed-switch, sparse-switch
10     */
11    /* op vAA, +BBBBBBBB */
12    .extern $func
13    lh      a0, 2(rPC)                  # a0 <- bbbb (lo)
14    lh      a1, 4(rPC)                  # a1 <- BBBB (hi)
15    srl     a3, rINST, 8                # a3 <- AA
16    ins     a0, a1, 16, 16              # a0 <- BBBBbbbb
17    GET_VREG a1, a3                     # a1 <- vAA
18    dlsa    a0, a0, rPC, 1              # a0 <- PC + BBBBbbbb*2
19    jal     $func                       # v0 <- code-unit branch offset
20    move    rINST, v0
21    b       MterpCommonTakenBranchNoFlags
22