]> git.ipfire.org Git - thirdparty/gcc.git/blob
9850d895e632bb94b631bc00edab49cf6ef1cbed
[thirdparty/gcc.git] /
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: return values in registers, values, returned by functions, scalars, returned as values
7
8 .. _scalar-return:
9
10 How Scalar Function Values Are Returned
11 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
13 This section discusses the macros that control returning scalars as
14 values---values that can fit in registers.
15
16 .. include:: ../tm.rst.in
17 :start-after: [TARGET_FUNCTION_VALUE]
18 :end-before: [TARGET_FUNCTION_VALUE]
19
20
21 .. c:macro:: FUNCTION_VALUE (valtype, func)
22
23 This macro has been deprecated. Use ``TARGET_FUNCTION_VALUE`` for
24 a new target instead.
25
26 .. c:macro:: LIBCALL_VALUE (mode)
27
28 A C expression to create an RTX representing the place where a library
29 function returns a value of mode :samp:`{mode}`.
30
31 Note that 'library function' in this context means a compiler
32 support routine, used to perform arithmetic, whose name is known
33 specially by the compiler and was not mentioned in the C code being
34 compiled.
35
36 .. include:: ../tm.rst.in
37 :start-after: [TARGET_LIBCALL_VALUE]
38 :end-before: [TARGET_LIBCALL_VALUE]
39
40
41 .. c:macro:: FUNCTION_VALUE_REGNO_P (regno)
42
43 A C expression that is nonzero if :samp:`{regno}` is the number of a hard
44 register in which the values of called function may come back.
45
46 A register whose use for returning values is limited to serving as the
47 second of a pair (for a value of type ``double``, say) need not be
48 recognized by this macro. So for most machines, this definition
49 suffices:
50
51 .. code-block:: c++
52
53 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
54
55 If the machine has register windows, so that the caller and the called
56 function use different registers for the return value, this macro
57 should recognize only the caller's register numbers.
58
59 This macro has been deprecated. Use ``TARGET_FUNCTION_VALUE_REGNO_P``
60 for a new target instead.
61
62 .. include:: ../tm.rst.in
63 :start-after: [TARGET_FUNCTION_VALUE_REGNO_P]
64 :end-before: [TARGET_FUNCTION_VALUE_REGNO_P]
65
66
67 .. c:macro:: APPLY_RESULT_SIZE
68
69 Define this macro if :samp:`untyped_call` and :samp:`untyped_return`
70 need more space than is implied by ``FUNCTION_VALUE_REGNO_P`` for
71 saving and restoring an arbitrary return value.
72
73 .. include:: ../tm.rst.in
74 :start-after: [TARGET_OMIT_STRUCT_RETURN_REG]
75 :end-before: [TARGET_OMIT_STRUCT_RETURN_REG]
76
77
78 .. include:: ../tm.rst.in
79 :start-after: [TARGET_RETURN_IN_MSB]
80 :end-before: [TARGET_RETURN_IN_MSB]