The #pragma reg_killed_by directive specifies a set of volatile registers that may be altered (killed) by the specified function. This pragma can only be used on functions that are defined using #pragma mc_func.
.-,------------------------. V | >>-#--pragma--reg_killed_by--function----+----------------------+-+->< '-regid--+-----------+-' '- ---regid-'
where:
function | The function previously defined using the #pragma mc_func. |
regid | The symbolic name(s) of either a single register or a range of registers
to be altered by the named function. A range of registers
is identified by providing the symbolic names of both starting and ending
registers, separated by a dash. If no registers are specified, no registers
will be altered by the specified function.
The symbolic name is made up of two parts. The first part is the register class name, specified using a sequence of one or more characters in the range of "a" to "z" and/or "A" to "Z". The second part is a integral number in the range of unsigned int. This number identifies a specific register number within a register class. Some register classes do not require that a register number be specified, and an error will result if you try to do so. If regid is not specified, no volatile registers will be killed by the named function. |
Registers | |
Class and [register numbers] | Description and usage |
ctr | Count register (CTR) |
cr[0-7] | Condition register (CR)
|
fp[0-31] | Floating point registers (FPR)
|
fs | Floating point status and control register (FPSCR) |
lr | Link register (LR) |
gr[0-31] | General purpose registers (GPR)
|
vr[0-31] | Vector registers (VMX processors only) |
xer | Fixed point exception (XER) |
Ordinarily, code generated for functions specified by #pragma mc_func may alter any or all volatile registers available on your system. You can use #pragma reg_killed_by to explicitly list a specific set of volatile registers to be altered by such functions. Registers not in this list will not be altered.
Registers specified by regid must meet the following requirements:
If any of these requirements are not met, an error is issued and the pragma is ignored.
The following example shows how to use #pragma reg_killed_by to list a specific set of volatile registers to be used by the function defined by #pragma mc_func.
int add_logical(int, int); #pragma mc_func add_logical {"7c632014" "7c630194"} /* addc r3 <- r3, r4 */ /* addze r3 <- r3, carry bit */ #pragma reg_killed_by add_logical gr3, xer /* only gpr3 and the xer are altered by this function */ main() { int i,j,k; i = 4; k = -4; j = add_logical(i,k); printf("\n\nresult = %d\n\n",j); }
Related information