[PATCH] D25746: [AMDGPU] Make note record name a static const member of target streamer.
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 12:12:30 PDT 2016
kzhuravl updated this revision to Diff 75193.
kzhuravl added a comment.
Bring up to date with trunk
https://reviews.llvm.org/D25746
Files:
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
@@ -71,6 +71,7 @@
NT_AMDGPU_HSA_HLDEBUG_TARGET = 102
};
+ static const char *NoteName;
MCStreamer &Streamer;
public:
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -86,6 +86,8 @@
// AMDGPUTargetELFStreamer
//===----------------------------------------------------------------------===//
+const char *AMDGPUTargetELFStreamer::NoteName = "AMD";
+
AMDGPUTargetELFStreamer::AMDGPUTargetELFStreamer(MCStreamer &S)
: AMDGPUTargetStreamer(S), Streamer(S) { }
@@ -100,15 +102,14 @@
MCSectionELF *Note =
OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
- unsigned NameSZ = 4;
-
OS.PushSection();
OS.SwitchSection(Note);
- OS.EmitIntValue(NameSZ, 4); // namesz
- OS.EmitIntValue(8, 4); // descz
- OS.EmitIntValue(NT_AMDGPU_HSA_CODE_OBJECT_VERSION, 4); // type
- OS.EmitBytes(StringRef("AMD", NameSZ)); // name
- OS.EmitIntValue(Major, 4); // desc
+ OS.EmitIntValue(strlen(NoteName) + 1, 4); // namesz
+ OS.EmitIntValue(8, 4); // descz
+ OS.EmitIntValue(NT_AMDGPU_HSA_CODE_OBJECT_VERSION, 4); // type
+ OS.EmitBytes(StringRef(NoteName, strlen(NoteName) + 1)); // name
+ OS.EmitValueToAlignment(4);
+ OS.EmitIntValue(Major, 4); // desc
OS.EmitIntValue(Minor, 4);
OS.EmitValueToAlignment(4);
OS.PopSection();
@@ -124,20 +125,20 @@
MCSectionELF *Note =
OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
- unsigned NameSZ = 4;
uint16_t VendorNameSize = VendorName.size() + 1;
uint16_t ArchNameSize = ArchName.size() + 1;
unsigned DescSZ = sizeof(VendorNameSize) + sizeof(ArchNameSize) +
sizeof(Major) + sizeof(Minor) + sizeof(Stepping) +
VendorNameSize + ArchNameSize;
OS.PushSection();
OS.SwitchSection(Note);
- OS.EmitIntValue(NameSZ, 4); // namesz
- OS.EmitIntValue(DescSZ, 4); // descsz
- OS.EmitIntValue(NT_AMDGPU_HSA_ISA, 4); // type
- OS.EmitBytes(StringRef("AMD", 4)); // name
- OS.EmitIntValue(VendorNameSize, 2); // desc
+ OS.EmitIntValue(strlen(NoteName) + 1, 4); // namesz
+ OS.EmitIntValue(DescSZ, 4); // descsz
+ OS.EmitIntValue(NT_AMDGPU_HSA_ISA, 4); // type
+ OS.EmitBytes(StringRef(NoteName, strlen(NoteName) + 1)); // name
+ OS.EmitValueToAlignment(4);
+ OS.EmitIntValue(VendorNameSize, 2); // desc
OS.EmitIntValue(ArchNameSize, 2);
OS.EmitIntValue(Major, 4);
OS.EmitIntValue(Minor, 4);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25746.75193.patch
Type: text/x-patch
Size: 3220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161019/86fb772e/attachment.bin>
More information about the llvm-commits
mailing list