On 11/19/18 8:18 AM, bala mani wrote:
> Hi,
> 
> 
> 
> I am looking at this issue:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86628

Hi.

Good!

> 
> 
> 
> For this issue, i want to debug "match.pd". I am a beginner for GCC. Could
> you please guide me how to debug this file?

So as you probably know, there are patterns defined in match.pd. Then we 
generate
objdir/gcc/gimple-match.c and objdir/gcc/generic-match.c files out of it.
If you know which pattern you want to debug, you can find a directive line
in the generated files, e.g. :

...
static bool
gimple_simplify_FLOOR_DIV_EXPR (gimple_match_op *res_op, gimple_seq *seq,
                 tree (*valueize)(tree) ATTRIBUTE_UNUSED,
                 code_helper ARG_UNUSED (code), tree ARG_UNUSED (type)
, tree op0, tree op1)
{
  if (integer_onep (op1))
    {
      {
/* #line 252 "../../gcc/match.pd" */
        tree captures[1] ATTRIBUTE_UNUSED = { op0 };
        if (gimple_simplify_42 (res_op, seq, valueize, type, captures, 
FLOOR_DIV_EXPR))
          return true;
      }
    }
  if (integer_zerop (op0))
...

as seen, 'line 252' comes from match.pd:252:

/* X * 1, X / 1 -> X.  */
(for op (mult trunc_div ceil_div floor_div round_div exact_div)
  (simplify
    (op @0 integer_onep)
    (non_lvalue @0)))

So you can either put a breakpoint on a line in generated files, or you can also
put a breakpoint on match.pd:252, as it's annotated in the generated file.

There's a nice tutorial how to debug GCC:
https://dmalcolm.fedorapeople.org/gcc/newbies-guide/debugging.html

Martin

> 
> 
> 
> Thanks,
> 
> Bala
> 

Reply via email to