JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: C User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction to the C Compiler

2.  C-Compiler Implementation-Specific Information

3.  Parallelizing C Code

4.  lint Source Code Checker

5.  Type-Based Alias Analysis

6.  Transitioning to ISO C

7.  Converting Applications for a 64-Bit Environment

8.  cscope: Interactively Examining a C Program

A.  Compiler Options Grouped by Functionality

B.  C Compiler Options Reference

C.  Implementation-Defined ISO/IEC C99 Behavior

D.  Supported Features of C99

E.  Implementation-Defined ISO/IEC C90 Behavior

F.  ISO C Data Representations

F.1 Storage Allocation

F.2 Data Representations

F.2.1 Integer Representations

F.2.2 Floating-Point Representations

F.2.3 Exceptional Values

F.2.4 Hexadecimal Representation of Selected Numbers

F.2.5 Pointer Representation

F.2.6 Array Storage

F.2.7 Arithmetic Operations on Exceptional Values

F.3 Argument-Passing Mechanism

F.3.1 32-Bit SPARC

F.3.2 64-Bit SPARC

F.3.3 x86/x64

G.  Performance Tuning

H.  The Differences Between K&R Solaris Studio C and Solaris Studio ISO C

Index

F.3 Argument-Passing Mechanism

This section describes how arguments are passed in ISO C.

F.3.1 32-Bit SPARC

Functions return integer results in register %o0, float results in register %f0, and double results in registers %f0 and %f1.

long long integers are passed in registers with the higher word order in %oN, and the lower order word in %o(N+1). In-register results are returned in %o0 and %o1, with similar ordering.

All arguments, except doubles and long doubles, are passed as four-byte values. A double is passed as an eight-byte value. The first six four-byte values (double counts as 8) are passed in registers %o0 through %o5. The rest are passed onto the stack. Structures are passed by making a copy of the structure and passing a pointer to the copy. A long double is passed in the same manner as a structure.

Registers described are as seen by the caller.

F.3.2 64-Bit SPARC

All integral arguments are passed as eight-byte values.

Floating-point arguments are passed in floating-point registers when possible.

F.3.3 x86/x64

Intel 386 psABI and AMD64 psABI are observed.

Functions return results in the following registers:

Table F-21 Registers Used by x86 Functions to Return Types

Register
Type Returned
int
%eax
long long
%edx and %eax
float, double, and long double
%st(0)
float _Complex
%eax for the real part and %edx for the imaginary part
double _Complex and long double _Complex
The same as a struct that contains two elements of the corresponding floating point type.

Refer to the AMD64 psABI for details at http://www.x86-64.org/documentation/abi.pdf

All arguments except structs, unions, long longs, doubles and long doubles are passed as four-byte values; a long long is passed as an eight-byte value, a double is passed as an eight-byte value, and a long double is passed as a 12-byte value.

structs and unions are copied onto the stack. The size is rounded up to a multiple of four bytes. Functions returning structs and unions are passed a hidden first argument, pointing to the location into which the returned struct or union is stored.

Upon return from a function, it is the responsibility of the caller to pop arguments from the stack, except for the extra argument for struct and union returns that is popped by the called function.