[PATCH] D110036: [TargetInfo][LangOpts] Refactor target info and language options adjustment.

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 8 05:56:23 PST 2021


Anastasia added a comment.

Just to elaborate on the problem that is being solved. We have ended up with cycling dependencies between `LangOptions` and `TargetInfo` i.e. some language options became dependent on the target and vice versa.

The quick solution has always been to mutate the target after its creation even though it has been intended to be immutable. While mutating the target some language options are being modified too.

So the approach suggested here eliminates this design flaw by adding a special member to `LangOptions` to allow resetting the options after the target has been created based on the property of the target.

The approach seems reasonable to me and there are probably not so many good alternatives. In the past, we have discussed that adjusting target settings can be eliminated by adding a special triple component for OpenCL. However, it serves a similar purpose as suggested here but seems like a larger conceptual change and some redundancy too. I am also not sure whether it is going to fit the needs for OpenCL 3 features and also use cases from all other targets...

I would suggest writing an RFC into cfe-dev about this and see if there are any other opinions.

Thanks for looking into this long design issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110036



More information about the cfe-commits mailing list