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