Page MenuHomePhabricator

[HLSL][clang][Driver] Parse target profile early to update Driver::TargetTriple.
ClosedPublic

Authored by python3kgae on May 13 2022, 2:38 PM.

Details

Summary

This is to avoid err_target_unknown_abi which is caused by use default TargetTriple instead of shader model target triple.

Diff Detail

Event Timeline

python3kgae created this revision.May 13 2022, 2:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 2:38 PM
Herald added a subscriber: Anastasia. · View Herald Transcript
python3kgae requested review of this revision.May 13 2022, 2:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 2:38 PM
beanz added inline comments.May 17 2022, 3:54 PM
clang/lib/Driver/ToolChains/HLSL.h
32–33

I don't like using an empty string as a sentinel for an error. Since this is no longer overriding an existing method, we should change it. Probably the easiest change is to llvm::Optional. Then you can return None in the failure cases.

Use llvm::Optional.

beanz added inline comments.May 31 2022, 9:30 AM
clang/lib/Driver/Driver.cpp
1242

The -T flag is required for DXCMode, so the else of this should emit an error. That also means the code above that explicitly sets the OS to ShaderModel can be removed too.

Add check for no -T option.

beanz accepted this revision.May 31 2022, 11:14 AM

LGTM.

This revision is now accepted and ready to land.May 31 2022, 11:14 AM