SWITCH - construct a jump table.

Usage:

switch offset,reg,[(lablist)][,FLOAT]

Examples:

switch -1,al,(lab2,lab3)       go to lab2 if al==2
switch 0,x0                    Nargs in x0
ldq    defalt                  Fill in default second arg

Where:

offset
is a fixed value to add to the switch index in "reg" when indexing into the jump table.
reg
is the register used to index into the jump table.
lablist
is a list of labels starting code segments.
FLOAT
If specified, the generated code is position-independent, but AR0 is clobbered to compute the final index ("offset" + contents of "reg").

Description:

This macro is used to construct a jump table. It is normally used to do processing for default arguments. If "lablist" is supplied, it is used to generate a table of addresses that are indirected through with an indexed transfer. The first label is considered to have index 1.

If no "lablist" is supplied, the jump is into a sequence of single instructions immediately following the SWITCH macro. The instruction immediately following the SWITCH is considered to have an index of 1.

Copyright © 1996, Thinkage Ltd.