This is the mail archive of the
mailing list for the GCC project.
Re: [PING] Target hook for rewriting inline asm constraints
> I'm not an FE or ME maintainer but I took a look anyway.
> Wouldn't the C++ FE need a similar patch? And, if so, why do this
> work in the front ends rather than somewhere more generic?
Yes, the C++ FE also needs to call that hook. I've focused on C with
my first patch since this is the most obvious user of inline
assemblies, but you are right this has to be extended.
I've tried at first to implement this as a more generic hook in the
middle end, but dealing with this in recog and reload turned out to be
way more complicated.
> Or, if the
> FE is really the way to go, perhaps a helper function in c-common.c
> would be better.
Ok that might be a good idea.
> I saw a few coding standard violations in the code.
> * Repeated use of strlen in the loop (use an output index)
> * Assignments in conditional expressions (frowned on by GNU standards;
> in any case the comma operators seemed gratuitous to me)
> * No braces around body of do-while.
I've simply copied the loop reload and recog are using. See
find_reloads and constrain_operands. I wasn't aware that this isn't
considered good style. I can certainly change that.
> * Hard-coded lengths without bounds checking (this one is questionable
> I suppose)
It would be difficult to harden that code against back end hooks
returning huge strings. I'm not sure thats worth the effort. But
I'll try to address this.