[RFC,V4,0/5] Support for CTF in GCC

Message ID 1563408480-4665-1-git-send-email-indu.bhagat@oracle.com
Headers show
Series
  • Support for CTF in GCC
Related show

Message

Indu Bhagat July 18, 2019, 12:07 a.m.
Hello,

I have made some progress on the patch set that adds support for CTF generation
in GCC. I am sharing the current status so that those interested can review
and/or try it out.

For a brief summary of the individual patches in this set, please see previous
posting https://gcc.gnu.org/ml/gcc-patches/2019-06/msg01710.html

[Changes from V3]

1. Patch 3 has inform () instead of warning () when frontend in not C.

2. Patch 4 has evolved. Apart from some bug fixes, some key features that have
   been implemented are :

   - CTF function and object index sub-sections
     A CTF section has a close association with the symbol table in that the
     entries in the func-info and obj-info need to be in the same order as
     entries in the symbol table.
     Since the compiler does not know the order of the entries in the symbol
     table, these new sub-sections allow a clean handshake between the compiler
     and the rest of the toolchain. The compiler only makes sure the entries in 
     the func-info and the func-info-index are in sync; and similarly that the
     entries in the obj-info and obj-info-index are in sync.

     A CTF consumer will use these indexes if present.

     Here is the binutils posting for adding these sub-sections to the CTF
     section https://sourceware.org/ml/binutils/2019-07/msg00157.html
   
   - Skip types when CTF lacks representation for them.
     CTF does not have representation for VECTOR_TYPE, Complex Integer type,
     Non IEEE float type, FIXED_POINT type and finally those enum constants
     that are not representable with a signed 32-bit integer.

     All these cases are skipped for CTF generation.  A type with type ID = 0
     is used for such declarations.  All these cases are tagged with a
     TBD_CTF_REPRESENTATION_LIMIT in the source files at this time.

     A new testcase testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c has been
     added that non-exhaustively lists specimens of types that are currently
     being skipped by the compiler for CTF generation.

     Having noted these skipped types for now, we will be working on a
     representation for them. Also, a careful perusal of the GNU C extensions
     in context of CTF representation is needed.

   - CTF CU name
     Each CTF section now holds a reference to the CU name in the CTF string
     table.

Testing :

Apart from the usual bootstrap and regression testing on x86_64/linux and
sparc64/linux, I have now compiled more codebases with -gt.  With this patch
set, I was able to use -gt for compiling gcc libraries, and also run dg.exp
suite with -gt.

( PS : Linker support for CTF is being actively worked on as well
 https://sourceware.org/ml/binutils/2019-07/msg00159.html. This current GCC
 patch set has the ctf.h in sync with the afore-mentioned binutils patch set. )

Thanks

Indu Bhagat (5):
  Add new function lang_GNU_GIMPLE
  Add CTF command line options : -gtLEVEL
  Setup for CTF generation and emission
  CTF generation for a single compilation unit
  Update CTF testsuite

 gcc/ChangeLog                                      |   97 +
 gcc/Makefile.in                                    |    5 +
 gcc/cgraphunit.c                                   |   12 +-
 gcc/common.opt                                     |    9 +
 gcc/ctfcreate.c                                    |  531 ++++++
 gcc/ctfout.c                                       | 1924 ++++++++++++++++++++
 gcc/ctfout.h                                       |  364 ++++
 gcc/ctfutils.c                                     |  198 ++
 gcc/doc/invoke.texi                                |   16 +
 gcc/flag-types.h                                   |   13 +
 gcc/gengtype.c                                     |    4 +-
 gcc/langhooks.c                                    |    9 +
 gcc/langhooks.h                                    |    1 +
 gcc/opts.c                                         |   26 +
 gcc/passes.c                                       |    7 +-
 gcc/testsuite/ChangeLog                            |   41 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c             |    6 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c             |   10 +
 .../gcc.dg/debug/ctf/ctf-anonymous-struct-1.c      |   23 +
 .../gcc.dg/debug/ctf/ctf-anonymous-union-1.c       |   26 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c       |   31 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c       |   39 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c   |   30 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c   |   39 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c     |   22 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c   |   44 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c   |   30 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c   |   41 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c        |   21 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c        |   26 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c       |   16 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c     |   36 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c     |   16 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c  |   25 +
 .../gcc.dg/debug/ctf/ctf-function-pointers-1.c     |   24 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c   |   34 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c         |   17 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c  |   29 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c    |   26 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c    |   11 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c  |   33 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c   |   26 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c      |   25 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c      |   30 +
 .../gcc.dg/debug/ctf/ctf-struct-array-1.c          |   36 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c     |   23 +
 .../gcc.dg/debug/ctf/ctf-typedef-struct-1.c        |   12 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c       |   14 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c   |   25 +
 gcc/testsuite/gcc.dg/debug/ctf/ctf.exp             |   41 +
 gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c          |    7 +
 gcc/toplev.c                                       |   18 +
 include/ChangeLog                                  |    9 +
 include/ctf.h                                      |  509 ++++++
 54 files changed, 4681 insertions(+), 6 deletions(-)
 create mode 100644 gcc/ctfcreate.c
 create mode 100644 gcc/ctfout.c
 create mode 100644 gcc/ctfout.h
 create mode 100644 gcc/ctfutils.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf.exp
 create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c
 create mode 100644 include/ctf.h

-- 
1.8.3.1