[PATCH] D85667: Reset PAL metadata when AMDGPU traget stream finishes
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 08:00:32 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeed6476a8744: Reset PAL metadata when AMDGPU traget stream finishes (authored by s-perron, committed by kuhar).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85667/new/
https://reviews.llvm.org/D85667
Files:
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
Index: llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
===================================================================
--- llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
+++ llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
@@ -106,6 +106,9 @@
// Set legacy PAL metadata format.
void setLegacy();
+ // Erase all PAL metadata.
+ void reset();
+
private:
// Return whether the blob type is legacy PAL metadata.
bool isLegacy() const;
Index: llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
+++ llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
@@ -773,3 +773,9 @@
BlobType = ELF::NT_AMD_AMDGPU_PAL_METADATA;
}
+// Erase all PAL metadata.
+void AMDGPUPALMetadata::reset() {
+ MsgPackDoc.clear();
+ Registers = MsgPackDoc.getEmptyNode();
+ HwStages = MsgPackDoc.getEmptyNode();
+}
Index: llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -168,10 +168,15 @@
// A hook for emitting stuff at the end.
// We use it for emitting the accumulated PAL metadata as directives.
+// The PAL metadata is reset after it is emitted.
void AMDGPUTargetAsmStreamer::finish() {
std::string S;
getPALMetadata()->toString(S);
OS << S;
+
+ // Reset the pal metadata so its data will not affect a compilation that
+ // reuses this object.
+ getPALMetadata()->reset();
}
void AMDGPUTargetAsmStreamer::EmitDirectiveAMDGCNTarget(StringRef Target) {
@@ -423,6 +428,7 @@
// A hook for emitting stuff at the end.
// We use it for emitting the accumulated PAL metadata as a .note record.
+// The PAL metadata is reset after it is emitted.
void AMDGPUTargetELFStreamer::finish() {
std::string Blob;
const char *Vendor = getPALMetadata()->getVendor();
@@ -432,6 +438,10 @@
return;
EmitNote(Vendor, MCConstantExpr::create(Blob.size(), getContext()), Type,
[&](MCELFStreamer &OS) { OS.emitBytes(Blob); });
+
+ // Reset the pal metadata so its data will not affect a compilation that
+ // reuses this object.
+ getPALMetadata()->reset();
}
void AMDGPUTargetELFStreamer::EmitNote(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85667.286024.patch
Type: text/x-patch
Size: 2371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200817/55f4a3da/attachment.bin>
More information about the llvm-commits
mailing list