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;
  }


Reply via email to