This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PING Fwd: [patch] implement generic debug() for vectors and hash sets
- From: Jeff Law <law at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 19 Nov 2017 15:45:36 -0700
- Subject: Re: PING Fwd: [patch] implement generic debug() for vectors and hash sets
- Authentication-results: sourceware.org; auth=none
- References: <CAGm3qMWSp34AbxpXXO+RdcS0zy+q-KcNMCdoU7pW+tqGvcDGXg@mail.gmail.com> <f6b5ec65-2f51-c66d-acc1-af182e3ca2fb@redhat.com>
On 10/23/2017 03:44 AM, Aldy Hernandez wrote:
>
>
>
> -------- Forwarded Message --------
> Subject: [patch] implement generic debug() for vectors and hash sets
> Date: Mon, 16 Oct 2017 09:52:51 -0400
> From: Aldy Hernandez <aldyh@redhat.com>
> To: gcc-patches <gcc-patches@gcc.gnu.org>
>
> We have a generic mechanism for dumping types from the debugger with:
>
> (gdb) call debug(some_type)
>
> However, even though most types are implemented, we have no canonical
> way of dumping vectors or hash sets.
>
> The attached patch fixes this oversight. With it you can call
> debug(vec<>) and debug(hash_set<>) with the following types: rtx,
> tree, basic_block, edge, rtx_insn. More can be added simply by adding
> a debug_slim(your_type) overload and calling:
>
> DEFINE_DEBUG_VEC (your_type)
> DEFINE_DEBUG_HASH_SET (your_type)
>
> Here is an example of how things look with this patch:
>
> vec of edges:
> [0] = <edge 0x0x7f3f81c0d700 (6 -> 10)>
>
> vec of bbs:
> [0] = <basic_block 0x7f3f81ac9410 (6)>
> [1] = <basic_block 0x7f3f81ac96e8 (10)>
>
> vec of trees:
> [0] = <integer_type 0x7f3f81ad55e8 int>
> [1] = <integer_type 0x7f3f81ad5498 short int>
> [2] = <integer_cst 0x7f3f81ada078 0>
>
> vec of rtx:
> [0] = (reg:SI 87)
> [1] = (reg:SI 87)
>
> hash of bbs:
> <basic_block 0x7f3f81ac96e8 (10)>
> <basic_block 0x7f3f81ac9410 (6)>
>
> OK for mainline?
>
>
> curr.patch
>
>
> gcc/
>
> * vec.h (debug_helper): New function.
> (DEFINE_DEBUG_VEC): New macro.
> * hash-set.h (debug_helper): New function.
> (DEFINE_DEBUG_HASH_SET): New macro.
> * cfg.c (debug_slim (edge)): New function.
> Call DEFINE_DEBUG_VEC for edges.
> Call DEFINE_DEBUG_HASH_SET for edges.
> * cfghooks.c (debug_slim (basic_block)): New function.
> Call DEFINE_DEBUG_VEC for basic blocks.
> Call DEFINE_DEBUG_HASH_SET for basic blocks.
> * print-tree.c (debug_slim): New function to handle trees.
> Call DEFINE_DEBUG_VEC for trees.
> Call DEFINE_DEBUG_HASH_SET for trees.
> (debug (vec<tree, va_gc>) &): Remove.
> (debug (<vec<tree, va_gc>) *): Remove.
> * print-rtl.c (debug_slim): New function to handle const_rtx.
> Call DEFINE_DEBUG_VEC for rtx_def.
> Call DEFINE_DEBUG_VEC for rtx_insn.
> Call DEFINE_DEBUG_HASH_SET for rtx_def.
> Call DEFINE_DEBUG_HASH_SET for rtx_insn.
> * sel-sched-dump.c (debug (vec<rtx_insn *> &): Remove.
> (debug (vec<rtx_insn *> *ptr): Remove.
> (debug_insn_vector): Remove.
> * stor-layout.c (debug_rli): Call debug() instead of debug_vec_tree.
OK.
jeff