public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] postscan_insn hook not called after input_asm
@ 2022-03-29 14:10 Paul Iannetta
  2022-04-07  7:55 ` [PING^1][PATCH] " Paul Iannetta
  2022-07-09 17:31 ` [PATCH] " Jeff Law
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Iannetta @ 2022-03-29 14:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

Hi,

While working on the Kalray port of gcc, I noticed that the hook TARGET_ASM_FINAL_POSTSCAN_INSN is not called after emitting an instruction coming from a basic asm block.  Here is a patch which fixes this behavior.

The following check:
```
$ find gcc/config/ -type f -exec grep "#define TARGET_ASM_FINAL" "{}" +
gcc/config/m68k/m68k.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN m68k_asm_final_postscan_insn
gcc/config/avr/avr.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN avr_asm_final_postscan_insn
gcc/config/mips/mips.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN mips_final_postscan_insn
```
reveals that m68k, avr and mips are the only affected targets upstream.

Paul Iannetta 
Kalray



[-- Attachment #2: 0001-postscan_insn-hook-not-called-after-input_asm.patch --]
[-- Type: application/mbox, Size: 1499 bytes --]

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

* Re: [PING^1][PATCH] postscan_insn hook not called after input_asm
  2022-03-29 14:10 [PATCH] postscan_insn hook not called after input_asm Paul Iannetta
@ 2022-04-07  7:55 ` Paul Iannetta
  2022-07-09 17:31 ` [PATCH] " Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Iannetta @ 2022-04-07  7:55 UTC (permalink / raw)
  To: Paul Iannetta; +Cc: gcc-patches

Hi,

I would like to draw your attention on this patch, it's a pretty tiny patch which does not affect many targets.

----- Original Message -----
From: "gcc-patches" <gcc-patches@gcc.gnu.org>
To: "gcc-patches" <gcc-patches@gcc.gnu.org>
Sent: Tuesday, March 29, 2022 4:10:16 PM
Subject: [PATCH] postscan_insn hook not called after input_asm

Hi,

While working on the Kalray port of gcc, I noticed that the hook TARGET_ASM_FINAL_POSTSCAN_INSN is not called after emitting an instruction coming from a basic asm block.  Here is a patch which fixes this behavior.

The following check:
```
$ find gcc/config/ -type f -exec grep "#define TARGET_ASM_FINAL" "{}" +
gcc/config/m68k/m68k.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN m68k_asm_final_postscan_insn
gcc/config/avr/avr.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN avr_asm_final_postscan_insn
gcc/config/mips/mips.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN mips_final_postscan_insn
```
reveals that m68k, avr and mips are the only affected targets upstream.

Paul Iannetta 
Kalray





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

* Re: [PATCH] postscan_insn hook not called after input_asm
  2022-03-29 14:10 [PATCH] postscan_insn hook not called after input_asm Paul Iannetta
  2022-04-07  7:55 ` [PING^1][PATCH] " Paul Iannetta
@ 2022-07-09 17:31 ` Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2022-07-09 17:31 UTC (permalink / raw)
  To: gcc-patches



On 3/29/2022 8:10 AM, Paul Iannetta via Gcc-patches wrote:
> Hi,
>
> While working on the Kalray port of gcc, I noticed that the hook TARGET_ASM_FINAL_POSTSCAN_INSN is not called after emitting an instruction coming from a basic asm block.  Here is a patch which fixes this behavior.
>
> The following check:
> ```
> $ find gcc/config/ -type f -exec grep "#define TARGET_ASM_FINAL" "{}" +
> gcc/config/m68k/m68k.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN m68k_asm_final_postscan_insn
> gcc/config/avr/avr.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN avr_asm_final_postscan_insn
> gcc/config/mips/mips.cc:#define TARGET_ASM_FINAL_POSTSCAN_INSN mips_final_postscan_insn
> ```
> reveals that m68k, avr and mips are the only affected targets upstream.
So I know it's been a while since you posted this patch.   Do you recall 
the motivation behind it?  ie, was there something your port is doing 
that required the post-scan hook to be called on an ASM?

I'm not objecting to the patch, I just want to understand better what 
drove you to write it in the first place.

IIRC you can't ask for attributes on an ASM, meaning that the m68k hook 
will probably abort with this change.   You may need to adjust the m68k 
implementation so that it  doesn't fault if presented with an ASM.   
Something like this at the start should do the trick.

if (recog_memoized (insn) < 0)
   {
     flags_operand1 = flags_operand2 = NULL_RTX;
     return;
   }



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

end of thread, other threads:[~2022-07-09 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29 14:10 [PATCH] postscan_insn hook not called after input_asm Paul Iannetta
2022-04-07  7:55 ` [PING^1][PATCH] " Paul Iannetta
2022-07-09 17:31 ` [PATCH] " Jeff Law

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).