choice Instruction Block ¶This instruction block has the format
choice
case ...
case ...
...
end choice
or
arr_def choice
case ...
case ...
...
end choice
or
arr_def choice
case ...
case ...
...
arr_def end choice
It consists of a choice instruction, at least one case instruction, and an end choice instruction.
The instruction block can declare a probabilities array arr_def, where arr_def is a data label.
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
var_def case number, loc_label
case var_use, loc_label
The case instructions specify control transfer to a location label loc_label with probability number or with profile probability stored in a previously defined variable var_use.
A data label var_def defines a probability variable var_def with initial value number.
The parameter number must be in the range 0 to 1 inclusive.
The assembler supports fixed-point and exponential notation for number.
If a choice instruction has a location label assigned, you must not use the 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:
stt instruction precedes a particular choice instruction block, it sets profile probabilities in the action emission matrix;
stt instruction does not precede a particular choice instruction block, and the state transition matrix has the restriction to define only deterministic state transitions, the instruction block sets profile probabilities in the action emission matrix;
stt instruction does not precede a particular choice instruction block, and the state transition matrix does not have the restriction to define only deterministic state transitions, the instruction block sets profile probabilities in the state transition matrix.
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 Destination | Probability Value |
|---|---|
The location label L1 | prob1 |
The location label L2 | prob2 |
The location label L3 | prob3 |
An instruction following the choice instruction block | 1−prob1−prob2−prob3 |
Compare this example to the example with a block of jprob instructions in jprob Instruction.