[PATCH] D124753: [HLSL] Set main as default entry.
Xiang Li via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 27 11:30:58 PDT 2022
python3kgae updated this revision to Diff 432606.
python3kgae marked 2 inline comments as done.
python3kgae added a comment.
Use default value of MarshallingInfoString.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124753/new/
https://reviews.llvm.org/D124753
Files:
clang/include/clang/Driver/Options.td
clang/test/CodeGenHLSL/entry_default.hlsl
Index: clang/test/CodeGenHLSL/entry_default.hlsl
===================================================================
--- /dev/null
+++ clang/test/CodeGenHLSL/entry_default.hlsl
@@ -0,0 +1,28 @@
+// RUN: %clang --driver-mode=dxc -Tcs_6_1 -fcgl -Fo - %s | FileCheck %s
+// RUN: %clang --driver-mode=dxc -Efoo -Tcs_6_1 -fcgl -Fo - %s | FileCheck %s --check-prefix=NOTMAIN
+
+// Make sure main is default entry.
+// Make sure not mangle entry.
+// CHECK:define void @main() [[MAIN_ATTR:#[0-9]]]
+// CHECK:define void @_Z3foov() [[FOO_ATTR:#[0-9]]]
+// Make sure only main has dx.shader attribute.
+// CHECK:[[MAIN_ATTR]]
+// CHECK:"dx.shader"="compute"
+// CHECK-SAME:}
+// CHECK:[[FOO_ATTR]]
+// CHECK-NOT:"dx.shader"="compute"
+[numthreads(1, 1, 1)] void main() {
+
+}
+
+// NOTMAIN:define void @main() [[MAIN_ATTR:#[0-9]]]
+// NOTMAIN:define void @foo() [[FOO_ATTR:#[0-9]]]
+// Make sure only foo has dx.shader attribute.
+// NOTMAIN:[[MAIN_ATTR]]
+// NOTMAIN-NOT:"dx.shader"="compute"
+// NOTMAIN-SAME:}
+// NOTMAIN:[[FOO_ATTR]]
+// NOTMAIN-SAME:"dx.shader"="compute"
+[numthreads(1, 1, 1)] void foo() {
+
+}
\ No newline at end of file
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6810,5 +6810,5 @@
def hlsl_entrypoint : Option<["--", "/", "-"], "E", KIND_JOINED_OR_SEPARATE>,
Group<dxc_Group>,
Flags<[DXCOption, CC1Option, NoXarchOption]>,
- MarshallingInfoString<TargetOpts<"HLSLEntry">>,
+ MarshallingInfoString<TargetOpts<"HLSLEntry">, "\"main\"">,
HelpText<"Entry point name">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124753.432606.patch
Type: text/x-patch
Size: 1752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220527/6c767faa/attachment.bin>
More information about the cfe-commits
mailing list