Specifications

Table Of Contents
Altera Corporation 7–9
October 2007 Nios II Processor Reference Handbook
Application Binary Interface
Example 7–2. Example: function a() calls function b(), which returns a struct.
/* b() computes a structure-type result and returns it
*/
STRUCT b(int i, int j)
{
...
return result;
}
void a(...)
{
...
value = b(i, j);
}
In this example, as long as the result type is no larger than 8 bytes, b()
will return its result in r2 and r3.
If the return type is larger than 8 bytes, the Nios II C/C++ compiler treats
this program as if a() had passed a pointer to b(). The example below
shows how the Nios II C/C++ compiler sees the code above.
Example 7–3. void b(STRUCT *p_result, int i, int j)
{
...
*p_result = result;
}
void a(...)
{
STRUCT value;
...
b(*value, i, j);
}
Referenced
Documents
This chapter references the following documents:
Programming Model chapter of the Nios II Processor Reference Handbook