On Fri, Dec 14 2018 2:52:17 EET Segher Boessenkool wrote:
> You need a few tweaks to what you committed.  Or just one perhaps: if
> flag_pic is not set, you should not check PIC_OFFSET_TABLE_REGNUM, it is
> meaningless in that case.  I'm not sure if you need to check whether the
> register is fixed or not.
The flag_pic flag is already checked by the PIC_OFFSET_TABLE_REGNUM macro. It 
will return INVALID_REGNUM if flag_pic is false, so no error will be printed.

Note that the PIC_OFFSET_TABLE_REGNUM behaviour is not changed by my patch. I 
merely moved the existing check into a separate function.

> 
> But there are many more regs than just the PIC reg and the stack pointer
> that you would want to similarly warn about, because overwriting those
> registers is just as fatal: the frame pointer, the program counter, etc.
> _Most_ fixed registers, but not _all_.
> 
> So maybe it should be a target hook?  OTOH that is a lot of work for such
> a trivial warning, that isn't very useful anyway (a better warning for
> any asm is: "Are you sure?" :-) )
I'll think about a more generic solution. But in light of the several filed 
PRs I think it's worth having a simple check for SP.

Regards,
Dimitar

Reply via email to