[PATCH] D135595: [HLSL] Add utility to convert environment to stage

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 15:50:19 PDT 2022


python3kgae added a comment.

In D135595#3847158 <https://reviews.llvm.org/D135595#3847158>, @beanz wrote:

> In D135595#3847056 <https://reviews.llvm.org/D135595#3847056>, @python3kgae wrote:
>
>> Backend needs the same thing.
>> Is it possible to move this to llvm and share it between frontend and backend?
>
> This translates the triple to a clang-defined enum... so strictly speaking no, that isn't possible.
>
> Can you elaborate on the context where the backend needs this? I suspect in the backend we need a similar but not quite the same utility. Specifically, I think we need to translate the environment value to an unsigned integer. For all cases where an enum makes sense we should be using the Environment value in the backend.

I think most use cases could be covered by switch and make default go llvm_unreachable.
It would be helpful to have util functions like isGraphics (which return true for graphics shader like vs/ps),  isRay( which return true on ray tracing entry functions).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135595



More information about the cfe-commits mailing list