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.
6 .. index:: GIMPLE_ASSIGN
11 .. function:: gassign *gimple_build_assign (tree lhs, tree rhs)
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.
25 .. function:: gassign *gimple_build_assign (tree lhs, enum tree_code subcode, tree op1, tree op2, tree op3)
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
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
36 .. function:: gassign *gimple_build_assign (tree lhs, enum tree_code subcode, tree op1, tree op2)
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.
42 .. function:: gassign *gimple_build_assign (tree lhs, enum tree_code subcode, tree op1)
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.
48 .. function:: gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
50 Build a new ``GIMPLE_ASSIGN`` tuple and append it to the end of
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.
57 This function returns the newly created ``GIMPLE_ASSIGN`` tuple.
59 .. function:: enum tree_code gimple_assign_rhs_code (gimple g)
61 Return the code of the expression computed on the ``RHS`` of
62 assignment statement ``G``.
64 .. function:: enum gimple_rhs_class gimple_assign_rhs_class (gimple g)
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``.
70 .. function:: tree gimple_assign_lhs (gimple g)
72 Return the ``LHS`` of assignment statement ``G``.
74 .. function:: tree * gimple_assign_lhs_ptr (gimple g)
76 Return a pointer to the ``LHS`` of assignment statement ``G``.
78 .. function:: tree gimple_assign_rhs1 (gimple g)
80 Return the first operand on the ``RHS`` of assignment statement ``G``.
82 .. function:: tree * gimple_assign_rhs1_ptr (gimple g)
84 Return the address of the first operand on the ``RHS`` of assignment
87 .. function:: tree gimple_assign_rhs2 (gimple g)
89 Return the second operand on the ``RHS`` of assignment statement ``G``.
91 .. function:: tree * gimple_assign_rhs2_ptr (gimple g)
93 Return the address of the second operand on the ``RHS`` of assignment
96 .. function:: tree gimple_assign_rhs3 (gimple g)
98 Return the third operand on the ``RHS`` of assignment statement ``G``.
100 .. function:: tree * gimple_assign_rhs3_ptr (gimple g)
102 Return the address of the third operand on the ``RHS`` of assignment
105 .. function:: void gimple_assign_set_lhs (gimple g, tree lhs)
107 Set ``LHS`` to be the ``LHS`` operand of assignment statement ``G``.
109 .. function:: void gimple_assign_set_rhs1 (gimple g, tree rhs)
111 Set ``RHS`` to be the first operand on the ``RHS`` of assignment
114 .. function:: void gimple_assign_set_rhs2 (gimple g, tree rhs)
116 Set ``RHS`` to be the second operand on the ``RHS`` of assignment
119 .. function:: void gimple_assign_set_rhs3 (gimple g, tree rhs)
121 Set ``RHS`` to be the third operand on the ``RHS`` of assignment
124 .. function:: bool gimple_assign_cast_p (const_gimple s)
126 Return true if ``S`` is a type-cast assignment.