Next: , Previous: , Up: Assembler Instructions   [Contents][Index]


5.3.3 choice Instruction Block

This instruction block has the format

        choice
        case    ...
        case    ...
        ...
        end     choice

It consists of a choice instruction, at least one case instruction, and an end choice instruction. The instructions case and end choice must not have location labels assigned.

Each case instruction must have one of the following forms:

        case    number, loc_label
        case    var_name, loc_label

These case instructions specify control transfer to a location label loc_label with probability number or with profile probability stored in a variable var_name. The parameter number must be in the range 0 to 1 inclusive. The assembler supports fixed-point and exponential notations for number. If a choice instruction has a location label assigned, then you must not use this location label as the second argument of case instructions in the choice instruction block.

The choice instruction block effectively sets profile probabilities in the action emission matrix or state transition matrix. If an stt instruction precedes a particular choice instruction block, this instruction block sets profile probabilities in the action emission matrix. If an stt instruction does not precede a particular choice instruction block, this instruction block sets profile probabilities in the state transition matrix. See stt Instruction, for more information.

If the assembler expects a user instruction at a particular location but encounters a choice instruction block at this location, the assembler implicitly inserts a nop instruction before the choice instruction block and treats it as possible transitions to states made after the invocation of this nop instruction.

In contrast to a contiguous block of jprob instructions, a choice instruction block allows you to specify jump probabilities in a direct way. Let us consider a choice instruction block like this:

        choice
        case    prob1, L1
        case    prob2, L2
        case    prob3, L3
        end     choice

The probabilities of jumps to various destinations are the following:

Jump destinationProbability value
The location label L1prob1
The location label L2prob2
The location label L3prob3
An instruction following the choice instruction block1-prob1-prob2-prob3

Compare this example to the example with a block of jprob instructions in jprob Instruction.


Next: , Previous: , Up: Assembler Instructions   [Contents][Index]