[PATCH] D77056: RFC: [Sema][SVE] Allow non-member operators for SVE types

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 11:56:54 PDT 2020


rsandifo-arm added a comment.

In D77056#1950358 <https://reviews.llvm.org/D77056#1950358>, @efriedma wrote:

> I'm concerned we're going to run into trouble if two people define different SVE "libraries", and you try to link both of them into the same program.  If you're not careful, you end up with ODR violations.  The scope of this is sort of restricted in normal C++: class and enumerated types sort of have an informal "owner", and people tend to respect that.  I mean, you could say it's the user's own fault if they break ODR, but we're essentially making a trap here.  Maybe it would make sense to require that SVE operators are defined in a namespace?  That would make the user think about the issue.


Thanks for the suggestion.  Requiring  a namespace sounds like a good plan -- will give it some more thought.

> We're also basically committing to never building these operators into the compiler, for all sizeless types for all targets.

I guess this brings up the question of when we should introduce a specific isSizelessSVEBuiltinType() query.  One option would to be wait until there's at least one type that isSizelessBuiltinType but isn't an SVE type.  Another would be to introduce  it when a feature seems too SVE-specific.  If you think this qualifies for the latter then I can add the query now.

For AArch64, it would always be possible in future to provide a standard header file that defines certain operators for SVE types.  One way of implementing the header file would be to use magic attributes that get the compiler to fill in the implementation.  (Or it could perhaps just use a pragma to "enable" built-in operators, but that sounds riskier.)

> It would probably make sense to send this to cfe-dev, to get more perspectives on the language change.

OK.  I'll address your comments first and then post there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77056/new/

https://reviews.llvm.org/D77056





More information about the cfe-commits mailing list