aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2022-08-24 14:46:04 -0500
committerChris Bieneman <chris.bieneman@me.com>2022-08-25 11:17:54 -0500
commit22c477f934c4d1fa3f7d782d32a3e151f581c686 (patch)
tree4f9c8056fd04823b5f1162aa9211fbf02482bb70 /clang/lib/CodeGen/CodeGenFunction.cpp
parent9e37b1e5a0c15f36c5642406d5aa02a657a0b19c (diff)
downloadllvm-22c477f934c4d1fa3f7d782d32a3e151f581c686.zip
llvm-22c477f934c4d1fa3f7d782d32a3e151f581c686.tar.gz
llvm-22c477f934c4d1fa3f7d782d32a3e151f581c686.tar.bz2
[HLSL] Initial codegen for SV_GroupIndex
Semantic parameters aren't passed as actual parameters, instead they are populated from intrinsics which are generally lowered to reads from dedicated hardware registers. This change modifies clang CodeGen to emit the intrinsic calls and populate the parameter's LValue with the result of the intrinsic call for SV_GroupIndex. The result of this is to make the actual passed argument ignored, which will make it easy to clean up later in an IR pass. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D131203
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 061e0bf..81c687e 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -16,6 +16,7 @@
#include "CGCXXABI.h"
#include "CGCleanup.h"
#include "CGDebugInfo.h"
+#include "CGHLSLRuntime.h"
#include "CGOpenMPRuntime.h"
#include "CodeGenModule.h"
#include "CodeGenPGO.h"
@@ -1137,6 +1138,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
if (getLangOpts().OpenMP && CurCodeDecl)
CGM.getOpenMPRuntime().emitFunctionProlog(*this, CurCodeDecl);
+ // Handle emitting HLSL entry functions.
+ if (D && D->hasAttr<HLSLShaderAttr>())
+ CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
+
EmitFunctionProlog(*CurFnInfo, CurFn, Args);
if (isa_and_nonnull<CXXMethodDecl>(D) &&