aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorCooper Partin <coopp@microsoft.com>2024-03-21 14:43:15 -0700
committerGitHub <noreply@github.com>2024-03-21 14:43:15 -0700
commitcde54df39cab3a1d60a3e1862ab341609bee3cc3 (patch)
tree7f05cec03fc43b526a21304d3039bd555a015173 /llvm/lib/ObjectYAML
parent628068113710d501e88b63a1506d66dd20ce7e94 (diff)
downloadllvm-cde54df39cab3a1d60a3e1862ab341609bee3cc3.tar.gz
llvm-cde54df39cab3a1d60a3e1862ab341609bee3cc3.tar.bz2
llvm-cde54df39cab3a1d60a3e1862ab341609bee3cc3.zip
Add support for PSV EntryFunctionName (#84409)
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes #80175 --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/DXContainerEmitter.cpp3
-rw-r--r--llvm/lib/ObjectYAML/DXContainerYAML.cpp15
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index 09a5e41c7123..f3a518df3175 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -198,8 +198,9 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
if (!P.Info.has_value())
continue;
mcdxbc::PSVRuntimeInfo PSV;
- memcpy(&PSV.BaseData, &P.Info->Info, sizeof(dxbc::PSV::v2::RuntimeInfo));
+ memcpy(&PSV.BaseData, &P.Info->Info, sizeof(dxbc::PSV::v3::RuntimeInfo));
PSV.Resources = P.Info->Resources;
+ PSV.EntryName = P.Info->EntryName;
for (auto El : P.Info->SigInputElements)
PSV.InputElements.push_back(mcdxbc::PSVSignatureElement{
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index a6871e7855e4..38063670aee6 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -74,6 +74,16 @@ DXContainerYAML::PSVInfo::PSVInfo(const dxbc::PSV::v2::RuntimeInfo *P)
memcpy(&Info, P, sizeof(dxbc::PSV::v2::RuntimeInfo));
}
+DXContainerYAML::PSVInfo::PSVInfo(const dxbc::PSV::v3::RuntimeInfo *P,
+ StringRef StringTable)
+ : Version(3),
+ EntryName(StringTable.substr(P->EntryNameOffset,
+ StringTable.find('\0', P->EntryNameOffset) -
+ P->EntryNameOffset)) {
+ memset(&Info, 0, sizeof(Info));
+ memcpy(&Info, P, sizeof(dxbc::PSV::v3::RuntimeInfo));
+}
+
namespace yaml {
void MappingTraits<DXContainerYAML::VersionTuple>::mapping(
@@ -348,6 +358,11 @@ void DXContainerYAML::PSVInfo::mapInfoForVersion(yaml::IO &IO) {
IO.mapRequired("NumThreadsX", Info.NumThreadsX);
IO.mapRequired("NumThreadsY", Info.NumThreadsY);
IO.mapRequired("NumThreadsZ", Info.NumThreadsZ);
+
+ if (Version == 2)
+ return;
+
+ IO.mapRequired("EntryName", EntryName);
}
} // namespace llvm