This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Update doc/gimple.texi to reflect change from union to class hierarchy


Commits r205034 (de6bd75e3c9bc1efe8a6387d48eedaa4dafe622d) and r205428
(a90353203da18288cdac1b0b78fe7b22c69fe63f) eliminated the union
gimple_statement_d in favor of a C++ class hierarchy.

I forgot to update gimple.texi in those commits (sorry), which the
following patch belatedly addresses.  It removes an incorrect reference
to the union, replacing it with a diagram showing the C++ inheritance
hierarchy of gimple statement types, and how they relate to GSS_ and
GIMPLE_ values.

As noted in the "Compile-time gimple-checking" thread, I do want to make
changes to this hierarchy.  This unrelated patch simply updates the docs
to reflect the status quo in trunk (and 4.9).

I used @smallexample for the ASCII art.

Successfully generates HTML, info and pdf via appropriate make
invocations; example of resulting HTML can be seen at the bottom of:

http://dmalcolm.fedorapeople.org/gcc/2014-04-25/Tuple-representation.html

The diagram is split over pages 178-180 of the generated PDF:

http://dmalcolm.fedorapeople.org/gcc/2014-04-25/gccint.pdf

but I don't think there's a good way to avoid page breaks there.

Info page, fwiw:

http://dmalcolm.fedorapeople.org/gcc/2014-04-25/gccint.info

Bootstrap in progress [do pure doc fixes require a bootstrap?]

OK for trunk, assuming bootstraps? (and eventually for the 4.9 branch,
after a few days?)

Thanks
Dave

commit 792a8f512bf51b2210d5f418101d8611c74ecac4
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Fri Apr 25 12:40:36 2014 -0400

    Add a class hierarchy diagram to gimple.texi
    
    gcc/
    	* doc/gimple.texi: Replace the description of the now-defunct
    	union gimple_statement_d with a diagram showing the
    	gimple_statement_base class hierarchy and its relationships to
    	the GSS_ and GIMPLE_ enums.

diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index 9bb16e8..9dc320c 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -287,35 +287,130 @@ reduce memory utilization further by removing these sets).
 @end itemize
 
 All the other tuples are defined in terms of these three basic
-ones. Each tuple will add some fields. The main gimple type
-is defined to be the union of all these structures (@code{GTY} markers
-elided for clarity):
+ones. Each tuple will add some fields.
+
+The following diagram shows the C++ inheritance hierarchy of statement
+kinds, along with their relationships to @code{GSS_} values (layouts) and
+@code{GIMPLE_} values (codes):
 
 @smallexample
-union gimple_statement_d
-@{
-  struct gimple_statement_base gsbase;
-  struct gimple_statement_with_ops gsops;
-  struct gimple_statement_with_memory_ops gsmem;
-  struct gimple_statement_omp omp;
-  struct gimple_statement_bind gimple_bind;
-  struct gimple_statement_catch gimple_catch;
-  struct gimple_statement_eh_filter gimple_eh_filter;
-  struct gimple_statement_phi gimple_phi;
-  struct gimple_statement_resx gimple_resx;
-  struct gimple_statement_try gimple_try;
-  struct gimple_statement_wce gimple_wce;
-  struct gimple_statement_asm gimple_asm;
-  struct gimple_statement_omp_critical gimple_omp_critical;
-  struct gimple_statement_omp_for gimple_omp_for;
-  struct gimple_statement_omp_parallel gimple_omp_parallel;
-  struct gimple_statement_omp_task gimple_omp_task;
-  struct gimple_statement_omp_sections gimple_omp_sections;
-  struct gimple_statement_omp_single gimple_omp_single;
-  struct gimple_statement_omp_continue gimple_omp_continue;
-  struct gimple_statement_omp_atomic_load gimple_omp_atomic_load;
-  struct gimple_statement_omp_atomic_store gimple_omp_atomic_store;
-@};
++- gimple_statement_base
+     |    layout: GSS_BASE
+     |    used for 4 codes: GIMPLE_ERROR_MARK
+     |                      GIMPLE_NOP
+     |                      GIMPLE_OMP_SECTIONS_SWITCH
+     |                      GIMPLE_PREDICT
+     |
+     + gimple_statement_with_ops_base
+     |   |    (no GSS layout)
+     |   |
+     |   + gimple_statement_with_ops
+     |   |        layout: GSS_WITH_OPS
+     |   |        Used for 5 codes: GIMPLE_COND
+     |   |                          GIMPLE_DEBUG
+     |   |                          GIMPLE_GOTO
+     |   |                          GIMPLE_LABEL
+     |   |                          GIMPLE_SWITCH
+     |   |
+     |   + gimple_statement_with_memory_ops_base
+     |       |    layout: GSS_WITH_MEM_OPS_BASE
+     |       |
+     |       + gimple_statement_with_memory_ops
+     |       |        layout: GSS_WITH_MEM_OPS.
+     |       |        used for codes GIMPLE_ASSIGN and GIMPLE_RETURN.
+     |       |
+     |       + gimple_statement_call
+     |       |        layout: GSS_CALL, code: GIMPLE_CALL
+     |       |
+     |       + gimple_statement_asm
+     |       |        layout: GSS_ASM, code: GIMPLE_ASM
+     |       |
+     |       + gimple_statement_transaction
+     |                layout: GSS_TRANSACTION, code: GIMPLE_TRANSACTION
+     |
+     + gimple_statement_omp
+     |   |    layout: GSS_OMP.  Used for code GIMPLE_OMP_SECTION
+     |   |
+     |   + gimple_statement_omp_critical
+     |   |        layout: GSS_OMP_CRITICAL, code: GIMPLE_OMP_CRITICAL
+     |   |
+     |   + gimple_statement_omp_for
+     |   |        layout: GSS_OMP_FOR, code: GIMPLE_OMP_FOR
+     |   |
+     |   + gimple_statement_omp_parallel_layout
+     |   |   |    layout: GSS_OMP_PARALLEL_LAYOUT
+     |   |   |
+     |   |   + gimple_statement_omp_taskreg
+     |   |   |   |
+     |   |   |   + gimple_statement_omp_parallel
+     |   |   |   |        code: GIMPLE_OMP_PARALLEL
+     |   |   |   |
+     |   |   |   + gimple_statement_omp_task
+     |   |   |            code: GIMPLE_OMP_TASK
+     |   |   |
+     |   |   + gimple_statement_omp_target
+     |   |            code: GIMPLE_OMP_TARGET
+     |   |
+     |   + gimple_statement_omp_sections
+     |   |        layout: GSS_OMP_SECTIONS, code: GIMPLE_OMP_SECTIONS
+     |   |
+     |   + gimple_statement_omp_single_layout
+     |       |    layout: GSS_OMP_SINGLE_LAYOUT
+     |       |
+     |       + gimple_statement_omp_single
+     |       |        code: GIMPLE_OMP_SINGLE
+     |       |
+     |       + gimple_statement_omp_teams
+     |                code: GIMPLE_OMP_TEAMS
+     |
+     + gimple_statement_bind
+     |        layout: GSS_BIND, code: GIMPLE_BIND
+     |
+     + gimple_statement_catch
+     |        layout: GSS_CATCH, code: GIMPLE_CATCH
+     |
+     + gimple_statement_eh_filter
+     |        layout: GSS_EH_FILTER, code: GIMPLE_EH_FILTER
+     |
+     + gimple_statement_eh_else
+     |        layout: GSS_EH_ELSE, code: GIMPLE_EH_ELSE
+     |
+     + gimple_statement_eh_mnt
+     |        layout: GSS_EH_MNT, code: GIMPLE_EH_MUST_NOT_THROW
+     |
+     + gimple_statement_phi
+     |        layout: GSS_PHI, code: GIMPLE_PHI
+     |
+     + gimple_statement_eh_ctrl
+     |   |    layout: GSS_EH_CTRL
+     |   |
+     |   + gimple_statement_resx
+     |   |        code: GIMPLE_RESX
+     |   |
+     |   + gimple_statement_eh_dispatch
+     |            code: GIMPLE_EH_DISPATCH
+     |
+     + gimple_statement_try
+     |        layout: GSS_TRY, code: GIMPLE_TRY
+     |
+     + gimple_statement_wce
+     |        layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR
+     |
+     + gimple_statement_omp_continue
+     |        layout: GSS_OMP_CONTINUE, code: GIMPLE_OMP_CONTINUE
+     |
+     + gimple_statement_omp_atomic_load
+     |        layout: GSS_OMP_ATOMIC_LOAD, code: GIMPLE_OMP_ATOMIC_LOAD
+     |
+     + gimple_statement_omp_atomic_store_layout
+         |    layout: GSS_OMP_ATOMIC_STORE_LAYOUT,
+         |    code: GIMPLE_OMP_ATOMIC_STORE
+         |
+         + gimple_statement_omp_atomic_store
+         |        code: GIMPLE_OMP_ATOMIC_STORE
+         |
+         + gimple_statement_omp_return
+                  code: GIMPLE_OMP_RETURN
 @end smallexample
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]