10.19 __value_in_regs

The __value_in_regs qualifier instructs the compiler to return a structure of up to four integer words in integer registers or up to four floats or doubles in floating-point registers rather than using memory.

__value_in_regs is a function qualifier. It affects the type of a function.

Syntax

__value_in_regs return-type function-name([argument-list]);

Where:

return-type

is the type of a structure of up to four words in size.

Usage

Declaring a function __value_in_regs can be useful when calling functions that return more than one result.

Restrictions

A C++ function cannot return a __value_in_regs structure if the structure requires copy constructing.

If a virtual function declared as __value_in_regs is to be overridden, the overriding function must also be declared as __value_in_regs. If the functions do not match, the compiler generates an error.

Errors

Where the structure returned in a function qualified by __value_in_regs is too big, a warning is produced and the __value_in_regs structure is then ignored.

Examples

typedef struct int64_struct
{
    unsigned int lo;
    unsigned int hi;
} int64_struct;
__value_in_regs extern 
    int64_struct mul64(unsigned a, unsigned b);
Related concepts
5.16 Returning structures from functions through registers
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.