5.3.2. __value_in_regs

In C and C++, one way of returning multiple values from a function is to use a structure. Normally, structures are returned on the stack, with all the associated expense this entails.

To reduce memory traffic and reduce code size, the compiler enables you to return multiple values from a function through the registers. Up to four words can be returned from a function in a struct by qualifying the function with __value_in_regs. For example:

typedef struct s_coord { int x;	 int y;	 } coord;	
coord reflect(int x1, int y1) __value_in_regs;

You can use __value_in_regs anywhere where you have to return multiple values from a function. Examples include:

See __value_in_regs in the Compiler Reference Guide for more information about __value_in_regs.

Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0205J
Non-ConfidentialID101213