Getting The Return Or Frame Address Of A Function; Using Vector Instructions Through Built-In Functions - Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions

Using the gnu compiler collection (gcc)
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING GCC:
Table of Contents

Advertisement

178

6.44. Getting the Return or Frame Address of a Function

These functions may be used to get information about the callers of a function.
void *
__builtin_return_address
of the current function, or of one of its callers. The
the call stack. A value of
return address of the caller of the current function, and so forth. When inlining the expected behavior
is that the function will return the address of the function that will be returned to. To work around this
behavior use the
noinline
The
argument must be a constant integer.
level
On some machines it may be impossible to determine the return address of any function other than
the current one; in such cases, or when the top of the stack has been reached, this function will return
or a random value. In addition,
0
of the stack has been reached.
This function should only be used with a nonzero argument for debugging purposes.
void *
__builtin_frame_address
__builtin_return_address
return address of the function. Calling
frame address of the current function, a value of
current function, and so forth.
The frame is the area on the stack which holds local variables and saved registers. The frame address
is normally the address of the first word pushed on to the stack by the function. However, the exact
definition depends upon the processor and the calling convention. If the processor has a dedicated
frame pointer register, and the function has a frame, then
the value of the frame pointer register.
On some machines it may be impossible to determine the frame address of any function other than the
current one; in such cases, or when the top of the stack has been reached, this function will return
the first frame pointer is properly initialized by the startup code.
This function should only be used with a nonzero argument for debugging purposes.

6.45. Using vector instructions through built-in functions

On some targets, the instruction set contains SIMD vector instructions that operate on multiple values
contained in one large register at the same time. For example, on the i386 the MMX, 3Dnow! and SSE
extensions can be used this way.
The first step in using these extensions is to provide the necessary data types. This should be done
using an appropriate
typedef int v4si __attribute__ ((mode(V4SI)));
The base type
is effectively ignored by the compiler, the actual properties of the new type
int
are defined by the
__attribute__
have the form
;
V
n
nB
of the individual elements. The following can be used as base modes:
QI
An integer that is as wide as the smallest addressable unit, usually 8 bits.
HI
An integer, twice as wide as a QI mode integer, usually 16 bits.
(unsigned int
yields the return address of the current function, a value of
0
function attribute.
__builtin_frame_address
(unsigned int
, but it returns the address of the function frame rather than the
__builtin_frame_address
:
typedef
. It defines the machine mode to be used; for vector types these
should be the number of elements in the vector, and
Chapter 6. Extensions to the C Language Family
) This function returns the return address
level
argument is number of frames to scan up
level
may be used to determine if the top
)
This function is similar to
level
yields the frame address of the caller of the
1
__builtin_frame_address
yields the
1
with a value of
yields the
0
will return
should be the base mode
B
if
0
v4si

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Enterprise linux 3

Table of Contents