]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gccint/gimple/adding-a-new-gimple-statement-code.rst
sphinx: copy files from texi2rst-generated repository
[thirdparty/gcc.git] / gcc / doc / gccint / gimple / adding-a-new-gimple-statement-code.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:: Adding a new GIMPLE statement code
7
8 .. _adding-a-new-gimple-statement-code:
9
10 Adding a new GIMPLE statement code
11 **********************************
12
13 The first step in adding a new GIMPLE statement code, is
14 modifying the file ``gimple.def``, which contains all the GIMPLE
15 codes. Then you must add a corresponding gimple subclass
16 located in ``gimple.h``. This in turn, will require you to add a
17 corresponding ``GTY`` tag in ``gsstruct.def``, and code to handle
18 this tag in ``gss_for_code`` which is located in ``gimple.cc``.
19
20 In order for the garbage collector to know the size of the
21 structure you created in ``gimple.h``, you need to add a case to
22 handle your new GIMPLE statement in ``gimple_size`` which is located
23 in ``gimple.cc``.
24
25 You will probably want to create a function to build the new
26 gimple statement in ``gimple.cc``. The function should be called
27 ``gimple_build_new-tuple-name``, and should return the new tuple
28 as a pointer to the appropriate gimple subclass.
29
30 If your new statement requires accessors for any members or
31 operands it may have, put simple inline accessors in
32 ``gimple.h`` and any non-trivial accessors in ``gimple.cc`` with a
33 corresponding prototype in ``gimple.h``.
34
35 You should add the new statement subclass to the class hierarchy diagram
36 in ``gimple.texi``.