[PATCH] D38747: AMDGPU/NFC: Move AMDGPU specific note types to ELF.h
Konstantin Zhuravlyov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 10 11:30:03 PDT 2017
kzhuravl created this revision.
Herald added subscribers: dstuttard, yaxunl, nhaehnle, wdng, arsenm.
https://reviews.llvm.org/D38747
Files:
include/llvm/BinaryFormat/ELF.h
lib/Target/AMDGPU/AMDGPUPTNote.h
lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
@@ -78,8 +78,7 @@
class AMDGPUTargetELFStreamer final : public AMDGPUTargetStreamer {
MCStreamer &Streamer;
- void EmitAMDGPUNote(const MCExpr *DescSize,
- AMDGPU::ElfNote::NoteType Type,
+ void EmitAMDGPUNote(const MCExpr *DescSize, unsigned NoteType,
function_ref<void(MCELFStreamer &)> EmitDesc);
public:
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -128,7 +128,7 @@
}
void AMDGPUTargetELFStreamer::EmitAMDGPUNote(
- const MCExpr *DescSZ, ElfNote::NoteType Type,
+ const MCExpr *DescSZ, unsigned NoteType,
function_ref<void(MCELFStreamer &)> EmitDesc) {
auto &S = getStreamer();
auto &Context = S.getContext();
@@ -140,7 +140,7 @@
ElfNote::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
S.EmitIntValue(NameSZ, 4); // namesz
S.EmitValue(DescSZ, 4); // descz
- S.EmitIntValue(Type, 4); // type
+ S.EmitIntValue(NoteType, 4); // type
S.EmitBytes(StringRef(ElfNote::NoteName, NameSZ)); // name
S.EmitValueToAlignment(4, 0, 1, 0); // padding 0
EmitDesc(S); // desc
@@ -225,7 +225,7 @@
EmitAMDGPUNote(
DescSZ,
- ElfNote::NT_AMDGPU_HSA_CODE_OBJECT_METADATA,
+ ELF::NT_AMD_AMDGPU_HSA_METADATA,
[&](MCELFStreamer &OS) {
OS.EmitLabel(DescBegin);
OS.EmitBytes(HSAMetadataString);
@@ -239,7 +239,7 @@
const PALMD::Metadata &PALMetadata) {
EmitAMDGPUNote(
MCConstantExpr::create(PALMetadata.size() * sizeof(uint32_t), getContext()),
- ElfNote::NT_AMDGPU_PAL_METADATA,
+ ELF::NT_AMD_AMDGPU_PAL_METADATA,
[&](MCELFStreamer &OS){
for (auto I : PALMetadata)
OS.EmitIntValue(I, sizeof(uint32_t));
Index: lib/Target/AMDGPU/AMDGPUPTNote.h
===================================================================
--- lib/Target/AMDGPU/AMDGPUPTNote.h
+++ lib/Target/AMDGPU/AMDGPUPTNote.h
@@ -25,7 +25,7 @@
const char NoteName[] = "AMD";
-// TODO: Move this enum to include/llvm/Support so it can be used in tools?
+// TODO: Remove this file once we drop code object v2.
enum NoteType{
NT_AMDGPU_HSA_RESERVED_0 = 0,
NT_AMDGPU_HSA_CODE_OBJECT_VERSION = 1,
@@ -37,9 +37,6 @@
NT_AMDGPU_HSA_RESERVED_7 = 7,
NT_AMDGPU_HSA_RESERVED_8 = 8,
NT_AMDGPU_HSA_RESERVED_9 = 9,
- NT_AMDGPU_HSA_CODE_OBJECT_METADATA = 10,
- NT_AMD_AMDGPU_ISA = 11,
- NT_AMDGPU_PAL_METADATA = 12,
NT_AMDGPU_HSA_HLDEBUG_DEBUG = 101,
NT_AMDGPU_HSA_HLDEBUG_TARGET = 102
};
Index: include/llvm/BinaryFormat/ELF.h
===================================================================
--- include/llvm/BinaryFormat/ELF.h
+++ include/llvm/BinaryFormat/ELF.h
@@ -1369,6 +1369,14 @@
NT_GNU_GOLD_VERSION = 4,
};
+// AMDGPU specific notes.
+enum {
+ // Note types with values between 0 and 9 (inclusive) are reserved.
+ NT_AMD_AMDGPU_HSA_METADATA = 10,
+ NT_AMD_AMDGPU_ISA = 11,
+ NT_AMD_AMDGPU_PAL_METADATA = 12
+};
+
enum {
GNU_ABI_TAG_LINUX = 0,
GNU_ABI_TAG_HURD = 1,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38747.118435.patch
Type: text/x-patch
Size: 3608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171010/24252880/attachment.bin>
More information about the llvm-commits
mailing list