4.2.2.7 Setting the Number of Instruction Outcomes

An individual instruction class has a specific number of instruction outcomes. An instruction belonging to the instruction class can return one of them. A returned outcome may affect further execution of an assembler program.

The number of instruction outcomes is non-negative. Special value 0 indicates that an instruction may analyze the outcome of the previous instruction invoked, return that outcome as its own outcome, or return the outcome equal to a non-negative value less than the maximum number of outcomes of all instruction classes in the instruction class set. The default number of outcomes is 1.

The purpose of the following function is to set the number of instruction outcomes on processing an event QSMM_EVT_INSTR_CLASS_INIT by the event handler of an instruction meta-class.

Function: int qsmm_set_mehcall_noutcome (qsmm_mehcall_t mehcall, qsmm_sig_t noutcome)

This function sets to noutcome the number of outcomes of an individual instruction class associated with an event QSMM_EVT_INSTR_CLASS_INIT sent to the event handler of an instruction meta-class, where mehcall is an argument of that event handler passing information about the event.

The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.

QSMM_ERR_INVAL

The argument noutcome is greater than QSMM_SIG_MAX.

QSMM_ERR_UNTIMELY

The context of calling this function is not the event handler of an instruction meta-class on processing an event QSMM_EVT_INSTR_CLASS_INIT.

Use the following function to get the number of outcomes of an individual instruction class associated with an event processed by the event handler of an instruction meta-class.

Function: int qsmm_get_mehcall_noutcome (qsmm_mehcall_t mehcall, qsmm_sig_t *noutcome_p)

This function retrieves the number of outcomes of an individual instruction class associated with an event sent to the event handler of an instruction meta-class, where mehcall is an argument of that event handler passing information about the event. The function supports events QSMM_EVT_INSTR_CLASS_INIT, QSMM_EVT_INSTR_CLASS_DONE, and QSMM_EVT_ACTIVATE. If noutcome_p is not NULL, the function sets *noutcome_p to a retrieved number of outcomes.

On success, the function returns a non-negative value:

>1

instruction class has multiple outcomes;

1

instruction class has single outcome 0;

0

instruction class can analyze the outcome of the previous instruction invoked and return an outcome less than the maximum number of outcomes of all instruction classes in the instruction class set; in this case, the retrieved number of outcomes is equal to 0.

If the context of calling this function is not the event handler of an instruction meta-class on processing an event QSMM_EVT_INSTR_CLASS_INIT, QSMM_EVT_INSTR_CLASS_DONE, or QSMM_EVT_ACTIVATE, the function returns negative error code QSMM_ERR_UNTIMELY.