public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to debug .md file?
       [not found] <519748466.234078.1528182881564.ref@mail.yahoo.com>
@ 2018-06-05  8:17 ` DeepaBallari via gcc
  2018-06-05 12:58   ` Martin Liška
  0 siblings, 1 reply; 2+ messages in thread
From: DeepaBallari via gcc @ 2018-06-05  8:17 UTC (permalink / raw)
  To: gcc

Hello,I'm a newbie to GCC.Have done some changes to .md file(specifically peephole.md) and the changes are not taking place.How to debug the .md file ?
Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to debug .md file?
  2018-06-05  8:17 ` How to debug .md file? DeepaBallari via gcc
@ 2018-06-05 12:58   ` Martin Liška
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liška @ 2018-06-05 12:58 UTC (permalink / raw)
  To: DeepaBallari, gcc

On 06/05/2018 09:14 AM, DeepaBallari via gcc wrote:
> Hello,I'm a newbie to GCC.Have done some changes to .md file(specifically peephole.md) and the changes are not taking place.How to debug the .md file ?
> Thanks!
> 

Hi.

.md files are transformed using gen* tools into C files. There's small example (from insn-recog.c):

131239  static rtx_insn *
131240  peephole2_3 (rtx x1 ATTRIBUTE_UNUSED,
131241          rtx_insn *insn ATTRIBUTE_UNUSED,
131242          int *pmatch_len_ ATTRIBUTE_UNUSED)
131243  {
131244    rtx * const operands ATTRIBUTE_UNUSED = &recog_data.operand[0];
131245    rtx x2, x3, x4, x5, x6, x7, x8;
131246    rtx_insn *res ATTRIBUTE_UNUSED;
131247    x2 = PATTERN (peep2_next_insn (1));
131248    if (GET_CODE (x2) != SET)
131249      return NULL;
131250    x3 = XEXP (x2, 1);
131251    if (GET_CODE (x3) != SUBREG
131252        || maybe_ne (SUBREG_BYTE (x3), 0)
131253        || GET_MODE (x3) != E_SImode)
131254      return NULL;
131255    x4 = XEXP (x2, 0);
131256    if (GET_CODE (x4) != ZERO_EXTRACT
131257        || GET_MODE (x4) != E_SImode)
131258      return NULL;
131259    x5 = XEXP (x4, 1);
131260    if (x5 != const_int_rtx[MAX_SAVED_CONST_INT + 8])
131261      return NULL;
131262    x6 = XEXP (x4, 2);
131263    if (x6 != const_int_rtx[MAX_SAVED_CONST_INT + 8])
131264      return NULL;
131265    x7 = XEXP (x4, 0);
131266    operands[2] = x7;
131267    if (!ext_register_operand (operands[2], E_VOIDmode))
131268      return NULL;
131269    x8 = XEXP (x3, 0);
131270    if (!rtx_equal_p (x8, operands[0])
131271        || !
131272  #line 3125 "../../gcc/config/i386/i386.md"
131273  (TARGET_64BIT
131274     && peep2_reg_dead_p (2, operands[0])))
131275      return NULL;
131276    *pmatch_len_ = 1;
131277    return gen_peephole2_5 (insn, operands);
131278  }

As you can see, there are '#line' directives. These should be debugable in GDB:
$ break i386.md:3125.

Alternative approach is to put gcc_unreachable into a peephole and then you should
be able to debug that. Note that I would recommend to automatically load ./gcc/gdbhooks.py file.

Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-05 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <519748466.234078.1528182881564.ref@mail.yahoo.com>
2018-06-05  8:17 ` How to debug .md file? DeepaBallari via gcc
2018-06-05 12:58   ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).