Home | History | Annotate | Line # | Download | only in topics
      1  1.7  mrg .. Copyright (C) 2014-2022 Free Software Foundation, Inc.
      2  1.1  mrg    Originally contributed by David Malcolm <dmalcolm (a] redhat.com>
      3  1.1  mrg 
      4  1.1  mrg    This is free software: you can redistribute it and/or modify it
      5  1.1  mrg    under the terms of the GNU General Public License as published by
      6  1.1  mrg    the Free Software Foundation, either version 3 of the License, or
      7  1.1  mrg    (at your option) any later version.
      8  1.1  mrg 
      9  1.1  mrg    This program is distributed in the hope that it will be useful, but
     10  1.1  mrg    WITHOUT ANY WARRANTY; without even the implied warranty of
     11  1.1  mrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12  1.1  mrg    General Public License for more details.
     13  1.1  mrg 
     14  1.1  mrg    You should have received a copy of the GNU General Public License
     15  1.1  mrg    along with this program.  If not, see
     16  1.7  mrg    <https://www.gnu.org/licenses/>.
     17  1.1  mrg 
     18  1.1  mrg .. default-domain:: cpp
     19  1.1  mrg 
     20  1.1  mrg Expressions
     21  1.1  mrg ===========
     22  1.1  mrg 
     23  1.1  mrg Rvalues
     24  1.1  mrg -------
     25  1.1  mrg .. class:: gccjit::rvalue
     26  1.1  mrg 
     27  1.1  mrg A :class:`gccjit::rvalue` is an expression that can be computed.  It is a
     28  1.1  mrg subclass of :class:`gccjit::object`, and is a thin wrapper around
     29  1.1  mrg :c:type:`gcc_jit_rvalue *` from the C API.
     30  1.1  mrg 
     31  1.1  mrg It can be simple, e.g.:
     32  1.1  mrg 
     33  1.1  mrg   * an integer value e.g. `0` or `42`
     34  1.1  mrg   * a string literal e.g. `"Hello world"`
     35  1.1  mrg   * a variable e.g. `i`.  These are also lvalues (see below).
     36  1.1  mrg 
     37  1.1  mrg or compound e.g.:
     38  1.1  mrg 
     39  1.1  mrg   * a unary expression e.g. `!cond`
     40  1.1  mrg   * a binary expression e.g. `(a + b)`
     41  1.1  mrg   * a function call e.g. `get_distance (&player_ship, &target)`
     42  1.1  mrg   * etc.
     43  1.1  mrg 
     44  1.1  mrg Every rvalue has an associated type, and the API will check to ensure
     45  1.1  mrg that types match up correctly (otherwise the context will emit an error).
     46  1.1  mrg 
     47  1.1  mrg .. function:: gccjit::type gccjit::rvalue::get_type ()
     48  1.1  mrg 
     49  1.1  mrg   Get the type of this rvalue.
     50  1.1  mrg 
     51  1.1  mrg 
     52  1.1  mrg Simple expressions
     53  1.1  mrg ******************
     54  1.1  mrg 
     55  1.1  mrg .. function:: gccjit::rvalue \
     56  1.1  mrg               gccjit::context::new_rvalue (gccjit::type numeric_type, \
     57  1.1  mrg                                            int value) const
     58  1.1  mrg 
     59  1.1  mrg    Given a numeric type (integer or floating point), build an rvalue for
     60  1.1  mrg    the given constant :c:type:`int` value.
     61  1.1  mrg 
     62  1.1  mrg .. function:: gccjit::rvalue \
     63  1.1  mrg               gccjit::context::new_rvalue (gccjit::type numeric_type, \
     64  1.1  mrg                                            long value) const
     65  1.1  mrg 
     66  1.1  mrg    Given a numeric type (integer or floating point), build an rvalue for
     67  1.1  mrg    the given constant :c:type:`long` value.
     68  1.1  mrg 
     69  1.1  mrg .. function::  gccjit::rvalue \
     70  1.1  mrg                gccjit::context::zero (gccjit::type numeric_type) const
     71  1.1  mrg 
     72  1.1  mrg    Given a numeric type (integer or floating point), get the rvalue for
     73  1.1  mrg    zero.  Essentially this is just a shortcut for:
     74  1.1  mrg 
     75  1.1  mrg    .. code-block:: c++
     76  1.1  mrg 
     77  1.1  mrg       ctxt.new_rvalue (numeric_type, 0)
     78  1.1  mrg 
     79  1.1  mrg .. function::  gccjit::rvalue \
     80  1.1  mrg                gccjit::context::one (gccjit::type numeric_type) const
     81  1.1  mrg 
     82  1.1  mrg    Given a numeric type (integer or floating point), get the rvalue for
     83  1.1  mrg    one.  Essentially this is just a shortcut for:
     84  1.1  mrg 
     85  1.1  mrg    .. code-block:: c++
     86  1.1  mrg 
     87  1.1  mrg       ctxt.new_rvalue (numeric_type, 1)
     88  1.1  mrg 
     89  1.1  mrg .. function::  gccjit::rvalue \
     90  1.1  mrg                gccjit::context::new_rvalue (gccjit::type numeric_type, \
     91  1.1  mrg                                             double value) const
     92  1.1  mrg 
     93  1.1  mrg    Given a numeric type (integer or floating point), build an rvalue for
     94  1.1  mrg    the given constant :c:type:`double` value.
     95  1.1  mrg 
     96  1.1  mrg .. function:: gccjit::rvalue \
     97  1.1  mrg               gccjit::context::new_rvalue (gccjit::type pointer_type, \
     98  1.1  mrg                                            void *value) const
     99  1.1  mrg 
    100  1.1  mrg    Given a pointer type, build an rvalue for the given address.
    101  1.1  mrg 
    102  1.1  mrg .. function:: gccjit::rvalue \
    103  1.1  mrg               gccjit::context::new_rvalue (const std::string &value) const
    104  1.1  mrg 
    105  1.1  mrg    Generate an rvalue of type :c:data:`GCC_JIT_TYPE_CONST_CHAR_PTR` for
    106  1.1  mrg    the given string.  This is akin to a string literal.
    107  1.1  mrg 
    108  1.4  mrg Vector expressions
    109  1.4  mrg ******************
    110  1.4  mrg 
    111  1.4  mrg .. function:: gccjit::rvalue \
    112  1.4  mrg 	      gccjit::context::new_rvalue (gccjit::type vector_type, \
    113  1.4  mrg 	                                   std::vector<gccjit::rvalue> elements) const
    114  1.4  mrg 
    115  1.4  mrg    Given a vector type, and a vector of scalar rvalue elements, generate a
    116  1.4  mrg    vector rvalue.
    117  1.4  mrg 
    118  1.4  mrg    The number of elements needs to match that of the vector type.
    119  1.1  mrg 
    120  1.1  mrg Unary Operations
    121  1.1  mrg ****************
    122  1.1  mrg 
    123  1.1  mrg .. function:: gccjit::rvalue  \
    124  1.1  mrg               gccjit::context::new_unary_op (enum gcc_jit_unary_op, \
    125  1.1  mrg                                              gccjit::type result_type, \
    126  1.1  mrg                                              gccjit::rvalue rvalue, \
    127  1.1  mrg                                              gccjit::location loc)
    128  1.1  mrg 
    129  1.1  mrg    Build a unary operation out of an input rvalue.
    130  1.1  mrg 
    131  1.1  mrg    Parameter ``loc`` is optional.
    132  1.1  mrg 
    133  1.1  mrg    This is a thin wrapper around the C API's
    134  1.1  mrg    :c:func:`gcc_jit_context_new_unary_op` and the available unary
    135  1.1  mrg    operations are documented there.
    136  1.1  mrg 
    137  1.1  mrg There are shorter ways to spell the various specific kinds of unary
    138  1.1  mrg operation:
    139  1.1  mrg 
    140  1.1  mrg .. function:: gccjit::rvalue \
    141  1.1  mrg               gccjit::context::new_minus (gccjit::type result_type, \
    142  1.1  mrg                                           gccjit::rvalue a, \
    143  1.1  mrg                                           gccjit::location loc)
    144  1.1  mrg 
    145  1.1  mrg    Negate an arithmetic value; for example:
    146  1.1  mrg 
    147  1.1  mrg    .. code-block:: c++
    148  1.1  mrg 
    149  1.1  mrg       gccjit::rvalue negpi = ctxt.new_minus (t_double, pi);
    150  1.1  mrg 
    151  1.1  mrg    builds the equivalent of this C expression:
    152  1.1  mrg 
    153  1.1  mrg    .. code-block:: c
    154  1.1  mrg 
    155  1.1  mrg       -pi
    156  1.1  mrg 
    157  1.1  mrg .. function:: gccjit::rvalue \
    158  1.1  mrg               new_bitwise_negate (gccjit::type result_type, \
    159  1.1  mrg                                   gccjit::rvalue a, \
    160  1.1  mrg                                   gccjit::location loc)
    161  1.1  mrg 
    162  1.1  mrg    Bitwise negation of an integer value (one's complement); for example:
    163  1.1  mrg 
    164  1.1  mrg    .. code-block:: c++
    165  1.1  mrg 
    166  1.1  mrg       gccjit::rvalue mask = ctxt.new_bitwise_negate (t_int, a);
    167  1.1  mrg 
    168  1.1  mrg    builds the equivalent of this C expression:
    169  1.1  mrg 
    170  1.1  mrg    .. code-block:: c
    171  1.1  mrg 
    172  1.1  mrg       ~a
    173  1.1  mrg 
    174  1.1  mrg .. function:: gccjit::rvalue \
    175  1.1  mrg               new_logical_negate (gccjit::type result_type, \
    176  1.1  mrg                                   gccjit::rvalue a, \
    177  1.1  mrg                                   gccjit::location loc)
    178  1.1  mrg 
    179  1.1  mrg    Logical negation of an arithmetic or pointer value; for example:
    180  1.1  mrg 
    181  1.1  mrg    .. code-block:: c++
    182  1.1  mrg 
    183  1.1  mrg       gccjit::rvalue guard = ctxt.new_logical_negate (t_bool, cond);
    184  1.1  mrg 
    185  1.1  mrg    builds the equivalent of this C expression:
    186  1.1  mrg 
    187  1.1  mrg    .. code-block:: c
    188  1.1  mrg 
    189  1.1  mrg       !cond
    190  1.1  mrg 
    191  1.1  mrg 
    192  1.1  mrg The most concise way to spell them is with overloaded operators:
    193  1.1  mrg 
    194  1.1  mrg .. function:: gccjit::rvalue operator- (gccjit::rvalue a)
    195  1.1  mrg 
    196  1.1  mrg    .. code-block:: c++
    197  1.1  mrg 
    198  1.1  mrg      gccjit::rvalue negpi = -pi;
    199  1.1  mrg 
    200  1.1  mrg 
    201  1.1  mrg .. function:: gccjit::rvalue operator~ (gccjit::rvalue a)
    202  1.1  mrg 
    203  1.1  mrg    .. code-block:: c++
    204  1.1  mrg 
    205  1.1  mrg       gccjit::rvalue mask = ~a;
    206  1.1  mrg 
    207  1.1  mrg .. function:: gccjit::rvalue operator! (gccjit::rvalue a)
    208  1.1  mrg 
    209  1.1  mrg    .. code-block:: c++
    210  1.1  mrg 
    211  1.1  mrg       gccjit::rvalue guard = !cond;
    212  1.1  mrg 
    213  1.1  mrg 
    214  1.1  mrg Binary Operations
    215  1.1  mrg *****************
    216  1.1  mrg 
    217  1.1  mrg .. function:: gccjit::rvalue\
    218  1.1  mrg               gccjit::context::new_binary_op (enum gcc_jit_binary_op, \
    219  1.1  mrg                                               gccjit::type result_type, \
    220  1.1  mrg                                               gccjit::rvalue a, \
    221  1.1  mrg                                               gccjit::rvalue b, \
    222  1.1  mrg                                               gccjit::location loc)
    223  1.1  mrg 
    224  1.1  mrg    Build a binary operation out of two constituent rvalues.
    225  1.1  mrg 
    226  1.1  mrg    Parameter ``loc`` is optional.
    227  1.1  mrg 
    228  1.1  mrg    This is a thin wrapper around the C API's
    229  1.1  mrg    :c:func:`gcc_jit_context_new_binary_op` and the available binary
    230  1.1  mrg    operations are documented there.
    231  1.1  mrg 
    232  1.1  mrg There are shorter ways to spell the various specific kinds of binary
    233  1.1  mrg operation:
    234  1.1  mrg 
    235  1.1  mrg .. function:: gccjit::rvalue \
    236  1.1  mrg               gccjit::context::new_plus (gccjit::type result_type, \
    237  1.1  mrg                                          gccjit::rvalue a, gccjit::rvalue b, \
    238  1.1  mrg                                          gccjit::location loc)
    239  1.1  mrg 
    240  1.1  mrg .. function:: gccjit::rvalue \
    241  1.1  mrg               gccjit::context::new_minus (gccjit::type result_type, \
    242  1.1  mrg                                           gccjit::rvalue a, gccjit::rvalue b, \
    243  1.1  mrg                                           gccjit::location loc)
    244  1.1  mrg 
    245  1.1  mrg .. function:: gccjit::rvalue \
    246  1.1  mrg               gccjit::context::new_mult (gccjit::type result_type, \
    247  1.1  mrg                                          gccjit::rvalue a, gccjit::rvalue b, \
    248  1.1  mrg                                          gccjit::location loc)
    249  1.1  mrg 
    250  1.1  mrg .. function:: gccjit::rvalue \
    251  1.1  mrg               gccjit::context::new_divide (gccjit::type result_type, \
    252  1.1  mrg                                            gccjit::rvalue a, gccjit::rvalue b, \
    253  1.1  mrg                                            gccjit::location loc)
    254  1.1  mrg 
    255  1.1  mrg .. function:: gccjit::rvalue \
    256  1.1  mrg               gccjit::context::new_modulo (gccjit::type result_type, \
    257  1.1  mrg                                            gccjit::rvalue a, gccjit::rvalue b, \
    258  1.1  mrg                                            gccjit::location loc)
    259  1.1  mrg 
    260  1.1  mrg .. function:: gccjit::rvalue \
    261  1.1  mrg               gccjit::context::new_bitwise_and (gccjit::type result_type, \
    262  1.1  mrg                                                 gccjit::rvalue a, gccjit::rvalue b, \
    263  1.1  mrg                                                 gccjit::location loc)
    264  1.1  mrg 
    265  1.1  mrg .. function:: gccjit::rvalue \
    266  1.1  mrg               gccjit::context::new_bitwise_xor (gccjit::type result_type, \
    267  1.1  mrg                                                 gccjit::rvalue a, gccjit::rvalue b, \
    268  1.1  mrg                                                 gccjit::location loc)
    269  1.1  mrg 
    270  1.1  mrg .. function:: gccjit::rvalue \
    271  1.1  mrg               gccjit::context::new_bitwise_or (gccjit::type result_type, \
    272  1.1  mrg                                                gccjit::rvalue a, gccjit::rvalue b, \
    273  1.1  mrg                                                gccjit::location loc)
    274  1.1  mrg 
    275  1.1  mrg .. function:: gccjit::rvalue \
    276  1.1  mrg               gccjit::context::new_logical_and (gccjit::type result_type, \
    277  1.1  mrg                                                 gccjit::rvalue a, gccjit::rvalue b, \
    278  1.1  mrg                                                 gccjit::location loc)
    279  1.1  mrg 
    280  1.1  mrg .. function:: gccjit::rvalue \
    281  1.1  mrg               gccjit::context::new_logical_or (gccjit::type result_type, \
    282  1.1  mrg                                                gccjit::rvalue a, gccjit::rvalue b, \
    283  1.1  mrg                                                gccjit::location loc)
    284  1.1  mrg 
    285  1.1  mrg The most concise way to spell them is with overloaded operators:
    286  1.1  mrg 
    287  1.1  mrg .. function:: gccjit::rvalue operator+ (gccjit::rvalue a, gccjit::rvalue b)
    288  1.1  mrg 
    289  1.1  mrg    .. code-block:: c++
    290  1.1  mrg 
    291  1.1  mrg       gccjit::rvalue sum = a + b;
    292  1.1  mrg 
    293  1.1  mrg .. function:: gccjit::rvalue operator- (gccjit::rvalue a, gccjit::rvalue b)
    294  1.1  mrg 
    295  1.1  mrg    .. code-block:: c++
    296  1.1  mrg 
    297  1.1  mrg       gccjit::rvalue diff = a - b;
    298  1.1  mrg 
    299  1.1  mrg .. function:: gccjit::rvalue operator* (gccjit::rvalue a, gccjit::rvalue b)
    300  1.1  mrg 
    301  1.1  mrg    .. code-block:: c++
    302  1.1  mrg 
    303  1.1  mrg       gccjit::rvalue prod = a * b;
    304  1.1  mrg 
    305  1.1  mrg .. function:: gccjit::rvalue operator/ (gccjit::rvalue a, gccjit::rvalue b)
    306  1.1  mrg 
    307  1.1  mrg    .. code-block:: c++
    308  1.1  mrg 
    309  1.1  mrg       gccjit::rvalue result = a / b;
    310  1.1  mrg 
    311  1.1  mrg .. function:: gccjit::rvalue operator% (gccjit::rvalue a, gccjit::rvalue b)
    312  1.1  mrg 
    313  1.1  mrg    .. code-block:: c++
    314  1.1  mrg 
    315  1.1  mrg       gccjit::rvalue mod = a % b;
    316  1.1  mrg 
    317  1.1  mrg .. function:: gccjit::rvalue operator& (gccjit::rvalue a, gccjit::rvalue b)
    318  1.1  mrg 
    319  1.1  mrg    .. code-block:: c++
    320  1.1  mrg 
    321  1.1  mrg       gccjit::rvalue x = a & b;
    322  1.1  mrg 
    323  1.1  mrg .. function:: gccjit::rvalue operator^ (gccjit::rvalue a, gccjit::rvalue b)
    324  1.1  mrg 
    325  1.1  mrg    .. code-block:: c++
    326  1.1  mrg 
    327  1.1  mrg       gccjit::rvalue x = a ^ b;
    328  1.1  mrg 
    329  1.1  mrg .. function:: gccjit::rvalue operator| (gccjit::rvalue a, gccjit::rvalue b)
    330  1.1  mrg 
    331  1.1  mrg    .. code-block:: c++
    332  1.1  mrg 
    333  1.1  mrg       gccjit::rvalue x = a | b;
    334  1.1  mrg 
    335  1.1  mrg .. function:: gccjit::rvalue operator&& (gccjit::rvalue a, gccjit::rvalue b)
    336  1.1  mrg 
    337  1.1  mrg    .. code-block:: c++
    338  1.1  mrg 
    339  1.1  mrg       gccjit::rvalue cond = a && b;
    340  1.1  mrg 
    341  1.1  mrg .. function:: gccjit::rvalue operator|| (gccjit::rvalue a, gccjit::rvalue b)
    342  1.1  mrg 
    343  1.1  mrg    .. code-block:: c++
    344  1.1  mrg 
    345  1.1  mrg       gccjit::rvalue cond = a || b;
    346  1.1  mrg 
    347  1.1  mrg These can of course be combined, giving a terse way to build compound
    348  1.1  mrg expressions:
    349  1.1  mrg 
    350  1.1  mrg    .. code-block:: c++
    351  1.1  mrg 
    352  1.1  mrg       gccjit::rvalue discriminant = (b * b) - (four * a * c);
    353  1.1  mrg 
    354  1.1  mrg 
    355  1.1  mrg Comparisons
    356  1.1  mrg ***********
    357  1.1  mrg 
    358  1.1  mrg .. function:: gccjit::rvalue \
    359  1.1  mrg               gccjit::context::new_comparison (enum gcc_jit_comparison,\
    360  1.1  mrg                                                gccjit::rvalue a, \
    361  1.1  mrg                                                gccjit::rvalue b, \
    362  1.1  mrg                                                gccjit::location loc)
    363  1.1  mrg 
    364  1.1  mrg    Build a boolean rvalue out of the comparison of two other rvalues.
    365  1.1  mrg 
    366  1.1  mrg    Parameter ``loc`` is optional.
    367  1.1  mrg 
    368  1.1  mrg    This is a thin wrapper around the C API's
    369  1.1  mrg    :c:func:`gcc_jit_context_new_comparison` and the available kinds
    370  1.1  mrg    of comparison are documented there.
    371  1.1  mrg 
    372  1.1  mrg There are shorter ways to spell the various specific kinds of binary
    373  1.1  mrg operation:
    374  1.1  mrg 
    375  1.1  mrg .. function:: gccjit::rvalue \
    376  1.1  mrg               gccjit::context::new_eq (gccjit::rvalue a, gccjit::rvalue b, \
    377  1.1  mrg                                        gccjit::location loc)
    378  1.1  mrg 
    379  1.1  mrg .. function:: gccjit::rvalue \
    380  1.1  mrg               gccjit::context::new_ne (gccjit::rvalue a, gccjit::rvalue b, \
    381  1.1  mrg                                        gccjit::location loc)
    382  1.1  mrg 
    383  1.1  mrg .. function:: gccjit::rvalue \
    384  1.1  mrg               gccjit::context::new_lt (gccjit::rvalue a, gccjit::rvalue b, \
    385  1.1  mrg                                        gccjit::location loc)
    386  1.1  mrg 
    387  1.1  mrg .. function:: gccjit::rvalue \
    388  1.1  mrg               gccjit::context::new_le (gccjit::rvalue a, gccjit::rvalue b, \
    389  1.1  mrg                                        gccjit::location loc)
    390  1.1  mrg 
    391  1.1  mrg .. function:: gccjit::rvalue \
    392  1.1  mrg               gccjit::context::new_gt (gccjit::rvalue a, gccjit::rvalue b, \
    393  1.1  mrg                                        gccjit::location loc)
    394  1.1  mrg 
    395  1.1  mrg .. function:: gccjit::rvalue \
    396  1.1  mrg               gccjit::context::new_ge (gccjit::rvalue a, gccjit::rvalue b, \
    397  1.1  mrg                                        gccjit::location loc)
    398  1.1  mrg 
    399  1.1  mrg The most concise way to spell them is with overloaded operators:
    400  1.1  mrg 
    401  1.1  mrg .. function:: gccjit::rvalue \
    402  1.1  mrg               operator== (gccjit::rvalue a, gccjit::rvalue b)
    403  1.1  mrg 
    404  1.1  mrg    .. code-block:: c++
    405  1.1  mrg 
    406  1.1  mrg       gccjit::rvalue cond = (a == ctxt.zero (t_int));
    407  1.1  mrg 
    408  1.1  mrg .. function:: gccjit::rvalue \
    409  1.1  mrg               operator!= (gccjit::rvalue a, gccjit::rvalue b)
    410  1.1  mrg 
    411  1.1  mrg    .. code-block:: c++
    412  1.1  mrg 
    413  1.1  mrg       gccjit::rvalue cond = (i != j);
    414  1.1  mrg 
    415  1.1  mrg .. function:: gccjit::rvalue \
    416  1.1  mrg               operator< (gccjit::rvalue a, gccjit::rvalue b)
    417  1.1  mrg 
    418  1.1  mrg    .. code-block:: c++
    419  1.1  mrg 
    420  1.1  mrg       gccjit::rvalue cond = i < n;
    421  1.1  mrg 
    422  1.1  mrg .. function:: gccjit::rvalue \
    423  1.1  mrg               operator<= (gccjit::rvalue a, gccjit::rvalue b)
    424  1.1  mrg 
    425  1.1  mrg    .. code-block:: c++
    426  1.1  mrg 
    427  1.1  mrg       gccjit::rvalue cond = i <= n;
    428  1.1  mrg 
    429  1.1  mrg .. function:: gccjit::rvalue \
    430  1.1  mrg               operator> (gccjit::rvalue a, gccjit::rvalue b)
    431  1.1  mrg 
    432  1.1  mrg    .. code-block:: c++
    433  1.1  mrg 
    434  1.1  mrg       gccjit::rvalue cond = (ch > limit);
    435  1.1  mrg 
    436  1.1  mrg .. function:: gccjit::rvalue \
    437  1.1  mrg               operator>= (gccjit::rvalue a, gccjit::rvalue b)
    438  1.1  mrg 
    439  1.1  mrg    .. code-block:: c++
    440  1.1  mrg 
    441  1.1  mrg       gccjit::rvalue cond = (score >= ctxt.new_rvalue (t_int, 100));
    442  1.1  mrg 
    443  1.1  mrg .. TODO: beyond this point
    444  1.1  mrg 
    445  1.1  mrg Function calls
    446  1.1  mrg **************
    447  1.1  mrg .. function:: gcc_jit_rvalue *\
    448  1.1  mrg               gcc_jit_context_new_call (gcc_jit_context *ctxt,\
    449  1.1  mrg                                         gcc_jit_location *loc,\
    450  1.1  mrg                                         gcc_jit_function *func,\
    451  1.1  mrg                                         int numargs , gcc_jit_rvalue **args)
    452  1.1  mrg 
    453  1.1  mrg    Given a function and the given table of argument rvalues, construct a
    454  1.1  mrg    call to the function, with the result as an rvalue.
    455  1.1  mrg 
    456  1.1  mrg    .. note::
    457  1.1  mrg 
    458  1.1  mrg       :func:`gccjit::context::new_call` merely builds a
    459  1.1  mrg       :class:`gccjit::rvalue` i.e. an expression that can be evaluated,
    460  1.1  mrg       perhaps as part of a more complicated expression.
    461  1.1  mrg       The call *won't* happen unless you add a statement to a function
    462  1.1  mrg       that evaluates the expression.
    463  1.1  mrg 
    464  1.1  mrg       For example, if you want to call a function and discard the result
    465  1.1  mrg       (or to call a function with ``void`` return type), use
    466  1.1  mrg       :func:`gccjit::block::add_eval`:
    467  1.1  mrg 
    468  1.1  mrg       .. code-block:: c++
    469  1.1  mrg 
    470  1.1  mrg          /* Add "(void)printf (arg0, arg1);".  */
    471  1.1  mrg          block.add_eval (ctxt.new_call (printf_func, arg0, arg1));
    472  1.1  mrg 
    473  1.4  mrg Function pointers
    474  1.4  mrg *****************
    475  1.4  mrg 
    476  1.4  mrg .. function:: gccjit::rvalue \
    477  1.4  mrg 	      gccjit::function::get_address (gccjit::location loc)
    478  1.4  mrg 
    479  1.4  mrg    Get the address of a function as an rvalue, of function pointer
    480  1.4  mrg    type.
    481  1.4  mrg 
    482  1.1  mrg Type-coercion
    483  1.1  mrg *************
    484  1.1  mrg 
    485  1.1  mrg .. function:: gccjit::rvalue \
    486  1.1  mrg               gccjit::context::new_cast (gccjit::rvalue rvalue,\
    487  1.1  mrg                                          gccjit::type type, \
    488  1.1  mrg                                          gccjit::location loc)
    489  1.1  mrg 
    490  1.1  mrg    Given an rvalue of T, construct another rvalue of another type.
    491  1.1  mrg 
    492  1.1  mrg    Currently only a limited set of conversions are possible:
    493  1.1  mrg 
    494  1.1  mrg      * int <-> float
    495  1.1  mrg      * int <-> bool
    496  1.1  mrg      * P*  <-> Q*, for pointer types P and Q
    497  1.1  mrg 
    498  1.1  mrg Lvalues
    499  1.1  mrg -------
    500  1.1  mrg 
    501  1.1  mrg .. class:: gccjit::lvalue
    502  1.1  mrg 
    503  1.1  mrg An lvalue is something that can of the *left*-hand side of an assignment:
    504  1.1  mrg a storage area (such as a variable).  It is a subclass of
    505  1.1  mrg :class:`gccjit::rvalue`, where the rvalue is computed by reading from the
    506  1.1  mrg storage area.
    507  1.1  mrg 
    508  1.1  mrg It iss a thin wrapper around :c:type:`gcc_jit_lvalue *` from the C API.
    509  1.1  mrg 
    510  1.1  mrg .. function:: gccjit::rvalue \
    511  1.1  mrg               gccjit::lvalue::get_address (gccjit::location loc)
    512  1.1  mrg 
    513  1.1  mrg    Take the address of an lvalue; analogous to:
    514  1.1  mrg 
    515  1.1  mrg    .. code-block:: c
    516  1.1  mrg 
    517  1.1  mrg      &(EXPR)
    518  1.1  mrg 
    519  1.1  mrg    in C.
    520  1.1  mrg 
    521  1.1  mrg    Parameter "loc" is optional.
    522  1.1  mrg 
    523  1.1  mrg Global variables
    524  1.1  mrg ****************
    525  1.1  mrg 
    526  1.1  mrg .. function:: gccjit::lvalue \
    527  1.1  mrg               gccjit::context::new_global (enum gcc_jit_global_kind,\
    528  1.1  mrg                                            gccjit::type type, \
    529  1.1  mrg                                            const char *name, \
    530  1.1  mrg                                            gccjit::location loc)
    531  1.1  mrg 
    532  1.1  mrg    Add a new global variable of the given type and name to the context.
    533  1.1  mrg 
    534  1.1  mrg    This is a thin wrapper around :c:func:`gcc_jit_context_new_global` from
    535  1.1  mrg    the C API; the "kind" parameter has the same meaning as there.
    536  1.1  mrg 
    537  1.1  mrg Working with pointers, structs and unions
    538  1.1  mrg -----------------------------------------
    539  1.1  mrg 
    540  1.1  mrg .. function:: gccjit::lvalue \
    541  1.1  mrg               gccjit::rvalue::dereference (gccjit::location loc)
    542  1.1  mrg 
    543  1.1  mrg    Given an rvalue of pointer type ``T *``, dereferencing the pointer,
    544  1.1  mrg    getting an lvalue of type ``T``.  Analogous to:
    545  1.1  mrg 
    546  1.1  mrg    .. code-block:: c++
    547  1.1  mrg 
    548  1.1  mrg      *(EXPR)
    549  1.1  mrg 
    550  1.1  mrg    in C.
    551  1.1  mrg 
    552  1.1  mrg    Parameter "loc" is optional.
    553  1.1  mrg 
    554  1.1  mrg If you don't need to specify the location, this can also be expressed using
    555  1.1  mrg an overloaded operator:
    556  1.1  mrg 
    557  1.1  mrg .. function:: gccjit::lvalue \
    558  1.1  mrg               gccjit::rvalue::operator* ()
    559  1.1  mrg 
    560  1.1  mrg    .. code-block:: c++
    561  1.1  mrg 
    562  1.1  mrg       gccjit::lvalue content = *ptr;
    563  1.1  mrg 
    564  1.1  mrg Field access is provided separately for both lvalues and rvalues:
    565  1.1  mrg 
    566  1.1  mrg .. function:: gccjit::lvalue \
    567  1.1  mrg               gccjit::lvalue::access_field (gccjit::field field, \
    568  1.1  mrg                                             gccjit::location loc)
    569  1.1  mrg 
    570  1.1  mrg    Given an lvalue of struct or union type, access the given field,
    571  1.1  mrg    getting an lvalue of the field's type.  Analogous to:
    572  1.1  mrg 
    573  1.1  mrg    .. code-block:: c++
    574  1.1  mrg 
    575  1.1  mrg       (EXPR).field = ...;
    576  1.1  mrg 
    577  1.1  mrg    in C.
    578  1.1  mrg 
    579  1.1  mrg .. function:: gccjit::rvalue \
    580  1.1  mrg               gccjit::rvalue::access_field (gccjit::field field, \
    581  1.1  mrg                                             gccjit::location loc)
    582  1.1  mrg 
    583  1.1  mrg    Given an rvalue of struct or union type, access the given field
    584  1.1  mrg    as an rvalue.  Analogous to:
    585  1.1  mrg 
    586  1.1  mrg    .. code-block:: c++
    587  1.1  mrg 
    588  1.1  mrg       (EXPR).field
    589  1.1  mrg 
    590  1.1  mrg    in C.
    591  1.1  mrg 
    592  1.1  mrg .. function:: gccjit::lvalue \
    593  1.1  mrg               gccjit::rvalue::dereference_field (gccjit::field field, \
    594  1.1  mrg                                                  gccjit::location loc)
    595  1.1  mrg 
    596  1.1  mrg    Given an rvalue of pointer type ``T *`` where T is of struct or union
    597  1.1  mrg    type, access the given field as an lvalue.  Analogous to:
    598  1.1  mrg 
    599  1.1  mrg    .. code-block:: c++
    600  1.1  mrg 
    601  1.1  mrg       (EXPR)->field
    602  1.1  mrg 
    603  1.1  mrg    in C, itself equivalent to ``(*EXPR).FIELD``.
    604  1.1  mrg 
    605  1.1  mrg .. function:: gccjit::lvalue \
    606  1.1  mrg               gccjit::context::new_array_access (gccjit::rvalue ptr, \
    607  1.1  mrg                                                  gccjit::rvalue index, \
    608  1.1  mrg                                                  gccjit::location loc)
    609  1.1  mrg 
    610  1.1  mrg    Given an rvalue of pointer type ``T *``, get at the element `T` at
    611  1.1  mrg    the given index, using standard C array indexing rules i.e. each
    612  1.1  mrg    increment of ``index`` corresponds to ``sizeof(T)`` bytes.
    613  1.1  mrg    Analogous to:
    614  1.1  mrg 
    615  1.1  mrg    .. code-block:: c++
    616  1.1  mrg 
    617  1.1  mrg       PTR[INDEX]
    618  1.1  mrg 
    619  1.1  mrg    in C (or, indeed, to ``PTR + INDEX``).
    620  1.1  mrg 
    621  1.1  mrg    Parameter "loc" is optional.
    622  1.1  mrg 
    623  1.1  mrg For array accesses where you don't need to specify a :class:`gccjit::location`,
    624  1.1  mrg two overloaded operators are available:
    625  1.1  mrg 
    626  1.1  mrg     gccjit::lvalue gccjit::rvalue::operator[] (gccjit::rvalue index)
    627  1.1  mrg 
    628  1.1  mrg     .. code-block:: c++
    629  1.1  mrg 
    630  1.1  mrg        gccjit::lvalue element = array[idx];
    631  1.1  mrg 
    632  1.1  mrg     gccjit::lvalue gccjit::rvalue::operator[] (int index)
    633  1.1  mrg 
    634  1.1  mrg     .. code-block:: c++
    635  1.1  mrg 
    636  1.1  mrg        gccjit::lvalue element = array[0];
    637