]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gccint/gimple/tuple-specific-accessors/gimpleassign.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / gimple / tuple-specific-accessors / gimpleassign.rst
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:: GIMPLE_ASSIGN
7
8 GIMPLE_ASSIGN
9 ^^^^^^^^^^^^^
10
11 .. function:: gassign *gimple_build_assign (tree lhs, tree rhs)
12
13 Build a ``GIMPLE_ASSIGN`` statement. The left-hand side is an lvalue
14 passed in lhs. The right-hand side can be either a unary or
15 binary tree expression. The expression tree rhs will be
16 flattened and its operands assigned to the corresponding operand
17 slots in the new statement. This function is useful when you
18 already have a tree expression that you want to convert into a
19 tuple. However, try to avoid building expression trees for the
20 sole purpose of calling this function. If you already have the
21 operands in separate trees, it is better to use
22 ``gimple_build_assign`` with ``enum tree_code`` argument and separate
23 arguments for each operand.
24
25 .. function:: gassign *gimple_build_assign (tree lhs, enum tree_code subcode, tree op1, tree op2, tree op3)
26
27 This function is similar to two operand ``gimple_build_assign``,
28 but is used to build a ``GIMPLE_ASSIGN`` statement when the operands of the
29 right-hand side of the assignment are already split into
30 different operands.
31
32 The left-hand side is an lvalue passed in lhs. Subcode is the
33 ``tree_code`` for the right-hand side of the assignment. Op1, op2 and op3
34 are the operands.
35
36 .. function:: gassign *gimple_build_assign (tree lhs, enum tree_code subcode, tree op1, tree op2)
37
38 Like the above 5 operand ``gimple_build_assign``, but with the last
39 argument ``NULL`` - this overload should not be used for
40 ``GIMPLE_TERNARY_RHS`` assignments.
41
42 .. function:: gassign *gimple_build_assign (tree lhs, enum tree_code subcode, tree op1)
43
44 Like the above 4 operand ``gimple_build_assign``, but with the last
45 argument ``NULL`` - this overload should be used only for
46 ``GIMPLE_UNARY_RHS`` and ``GIMPLE_SINGLE_RHS`` assignments.
47
48 .. function:: gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
49
50 Build a new ``GIMPLE_ASSIGN`` tuple and append it to the end of
51 ``*SEQ_P``.
52
53 ``DST`` / ``SRC`` are the destination and source respectively. You can
54 pass ungimplified trees in ``DST`` or ``SRC``, in which
55 case they will be converted to a gimple operand if necessary.
56
57 This function returns the newly created ``GIMPLE_ASSIGN`` tuple.
58
59 .. function:: enum tree_code gimple_assign_rhs_code (gimple g)
60
61 Return the code of the expression computed on the ``RHS`` of
62 assignment statement ``G``.
63
64 .. function:: enum gimple_rhs_class gimple_assign_rhs_class (gimple g)
65
66 Return the gimple rhs class of the code for the expression
67 computed on the rhs of assignment statement ``G``. This will never
68 return ``GIMPLE_INVALID_RHS``.
69
70 .. function:: tree gimple_assign_lhs (gimple g)
71
72 Return the ``LHS`` of assignment statement ``G``.
73
74 .. function:: tree * gimple_assign_lhs_ptr (gimple g)
75
76 Return a pointer to the ``LHS`` of assignment statement ``G``.
77
78 .. function:: tree gimple_assign_rhs1 (gimple g)
79
80 Return the first operand on the ``RHS`` of assignment statement ``G``.
81
82 .. function:: tree * gimple_assign_rhs1_ptr (gimple g)
83
84 Return the address of the first operand on the ``RHS`` of assignment
85 statement ``G``.
86
87 .. function:: tree gimple_assign_rhs2 (gimple g)
88
89 Return the second operand on the ``RHS`` of assignment statement ``G``.
90
91 .. function:: tree * gimple_assign_rhs2_ptr (gimple g)
92
93 Return the address of the second operand on the ``RHS`` of assignment
94 statement ``G``.
95
96 .. function:: tree gimple_assign_rhs3 (gimple g)
97
98 Return the third operand on the ``RHS`` of assignment statement ``G``.
99
100 .. function:: tree * gimple_assign_rhs3_ptr (gimple g)
101
102 Return the address of the third operand on the ``RHS`` of assignment
103 statement ``G``.
104
105 .. function:: void gimple_assign_set_lhs (gimple g, tree lhs)
106
107 Set ``LHS`` to be the ``LHS`` operand of assignment statement ``G``.
108
109 .. function:: void gimple_assign_set_rhs1 (gimple g, tree rhs)
110
111 Set ``RHS`` to be the first operand on the ``RHS`` of assignment
112 statement ``G``.
113
114 .. function:: void gimple_assign_set_rhs2 (gimple g, tree rhs)
115
116 Set ``RHS`` to be the second operand on the ``RHS`` of assignment
117 statement ``G``.
118
119 .. function:: void gimple_assign_set_rhs3 (gimple g, tree rhs)
120
121 Set ``RHS`` to be the third operand on the ``RHS`` of assignment
122 statement ``G``.
123
124 .. function:: bool gimple_assign_cast_p (const_gimple s)
125
126 Return true if ``S`` is a type-cast assignment.