[llvm] r334521 - AMDHSA/NFC: Code object v3 updates (additional):
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 11:33:51 PDT 2018
Author: kzhuravl
Date: Tue Jun 12 11:33:51 2018
New Revision: 334521
URL: http://llvm.org/viewvc/llvm-project?rev=334521&view=rev
Log:
AMDHSA/NFC: Code object v3 updates (additional):
- Move section selection and alignment to AMDGPUAsmPrinter
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
llvm/trunk/test/CodeGen/AMDGPU/code-object-v3.ll
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp?rev=334521&r1=334520&r2=334521&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp Tue Jun 12 11:33:51 2018
@@ -220,10 +220,26 @@ void AMDGPUAsmPrinter::EmitFunctionBodyE
TM.getTargetTriple().getOS() != Triple::AMDHSA)
return;
+ auto &Streamer = getTargetStreamer()->getStreamer();
+ auto &Context = Streamer.getContext();
+ auto &ObjectFileInfo = *Context.getObjectFileInfo();
+ auto &ReadOnlySection = *ObjectFileInfo.getReadOnlySection();
+
+ Streamer.PushSection();
+ Streamer.SwitchSection(&ReadOnlySection);
+
+ // CP microcode requires the kernel descriptor to be allocated on 64 byte
+ // alignment.
+ Streamer.EmitValueToAlignment(64, 0, 1, 0);
+ if (ReadOnlySection.getAlignment() < 64)
+ ReadOnlySection.setAlignment(64);
+
SmallString<128> KernelName;
getNameWithPrefix(KernelName, &MF->getFunction());
getTargetStreamer()->EmitAmdhsaKernelDescriptor(
KernelName, getAmdhsaKernelDescriptor(*MF, CurrentProgramInfo));
+
+ Streamer.PopSection();
}
void AMDGPUAsmPrinter::EmitFunctionEntryLabel() {
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp?rev=334521&r1=334520&r2=334521&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp Tue Jun 12 11:33:51 2018
@@ -374,17 +374,6 @@ void AMDGPUTargetELFStreamer::EmitAmdhsa
const amdhsa::kernel_descriptor_t &KernelDescriptor) {
auto &Streamer = getStreamer();
auto &Context = Streamer.getContext();
- auto &ObjectFileInfo = *Context.getObjectFileInfo();
- auto &ReadOnlySection = *ObjectFileInfo.getReadOnlySection();
-
- Streamer.PushSection();
- Streamer.SwitchSection(&ReadOnlySection);
-
- // CP microcode requires the kernel descriptor to be allocated on 64 byte
- // alignment.
- Streamer.EmitValueToAlignment(64, 0, 1, 0);
- if (ReadOnlySection.getAlignment() < 64)
- ReadOnlySection.setAlignment(64);
MCSymbolELF *KernelDescriptorSymbol = cast<MCSymbolELF>(
Context.getOrCreateSymbol(Twine(KernelName) + Twine(".kd")));
@@ -419,6 +408,4 @@ void AMDGPUTargetELFStreamer::EmitAmdhsa
sizeof(KernelDescriptor) -
offsetof(amdhsa::kernel_descriptor_t, kernel_code_entry_byte_offset) -
sizeof(KernelDescriptor.kernel_code_entry_byte_offset)));
-
- Streamer.PopSection();
}
Modified: llvm/trunk/test/CodeGen/AMDGPU/code-object-v3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/code-object-v3.ll?rev=334521&r1=334520&r2=334521&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/code-object-v3.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/code-object-v3.ll Tue Jun 12 11:33:51 2018
@@ -1,6 +1,16 @@
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -mattr=+code-object-v3 < %s | FileCheck --check-prefixes=ALL-ASM,OSABI-AMDHSA-ASM %s
; RUN: llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -mattr=+code-object-v3 < %s | llvm-readobj -elf-output-style=GNU -notes -relocations -sections -symbols | FileCheck --check-prefixes=ALL-ELF,OSABI-AMDHSA-ELF %s
+; ALL-ASM-LABEL: {{^}}fadd:
+; OSABI-AMDHSA-ASM: s_endpgm
+; OSABI-AMDHSA-ASM: .section .rodata,#alloc
+; OSABI-AMDHSA-ASM: .p2align 6
+
+; ALL-ASM-LABEL: {{^}}fsub:
+; OSABI-AMDHSA-ASM: s_endpgm
+; OSABI-AMDHSA-ASM: .section .rodata,#alloc
+; OSABI-AMDHSA-ASM: .p2align 6
+
; OSABI-AMDHSA-ASM-NOT: .hsa_code_object_version
; OSABI-AMDHSA-ASM-NOT: .hsa_code_object_isa
; OSABI-AMDHSA-ASM-NOT: .amd_amdgpu_isa
More information about the llvm-commits
mailing list