Next: , Previous: , Up: Defining Instruction Meta-classes   [Contents][Index]


4.2.2.7 Setting the Number of Instruction Outcomes

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

The number of instruction outcomes must be non-negative. Special value 0 indicates that an instruction may analyze the outcome of previous instruction invoked, use that outcome as its own outcome, or change it to a non-negative value less than the maximum number of outcomes of instruction classes in the instruction class set. The default number of outcomes of every instruction class 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_eh_noutcome (qsmm_t model, int noutcome)

This function sets the number of outcomes of an instruction class associated with a processed event. You can call this function from the event handler of a corresponding instruction meta-class of a multinode model on processing an event QSMM_EVT_INSTR_CLASS_INIT.

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 negative.

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 instruction class associated with an event processed by the event handler of an instruction meta-class.

Function: int qsmm_get_eh_noutcome (qsmm_t model)

This function returns the number of outcomes of an instruction class associated with a processed event. You can call this function from the event handler of an instruction meta-class of a multinode model on processing an event QSMM_EVT_INSTR_CLASS_INIT, QSMM_EVT_INSTR_CLASS_DONE, or QSMM_EVT_ACTIVATE.

On success, the function returns a non-negative value. 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.


Next: , Previous: , Up: Defining Instruction Meta-classes   [Contents][Index]