[llvm] r226970 - R600/SI: Emit .hsa.version section for amdhsa OS
Tom Stellard
thomas.stellard at amd.com
Fri Jan 23 15:59:08 PST 2015
Author: tstellar
Date: Fri Jan 23 17:59:08 2015
New Revision: 226970
URL: http://llvm.org/viewvc/llvm-project?rev=226970&view=rev
Log:
R600/SI: Emit .hsa.version section for amdhsa OS
Modified:
llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp
llvm/trunk/test/CodeGen/R600/hsa.ll
Modified: llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp?rev=226970&r1=226969&r2=226970&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp Fri Jan 23 17:59:08 2015
@@ -118,7 +118,6 @@ bool AMDGPUAsmPrinter::runOnMachineFunct
const AMDGPUSubtarget &STM = TM.getSubtarget<AMDGPUSubtarget>();
SIProgramInfo KernelInfo;
if (STM.isAmdHsaOS()) {
- OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
getSIProgramInfo(KernelInfo, MF);
EmitAmdKernelCodeT(MF, KernelInfo);
OutStreamer.EmitCodeAlignment(2 << (MF.getAlignment() - 1));
@@ -511,6 +510,19 @@ void AMDGPUAsmPrinter::EmitAmdKernelCode
header.wavefront_size = STM.getWavefrontSize();
+ const MCSectionELF *VersionSection = OutContext.getELFSection(".hsa.version",
+ ELF::SHT_PROGBITS, 0, SectionKind::getReadOnly());
+ OutStreamer.SwitchSection(VersionSection);
+ OutStreamer.EmitBytes(Twine("HSA Code Unit:" +
+ Twine(header.hsail_version_major) + "." +
+ Twine(header.hsail_version_minor) + ":" +
+ "AMD:" +
+ Twine(header.amd_code_version_major) + "." +
+ Twine(header.amd_code_version_minor) + ":" +
+ "GFX8.1:0").str());
+
+ OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
+
if (isVerbose()) {
OutStreamer.emitRawComment("amd_code_version_major = " +
Twine(header.amd_code_version_major), false);
Modified: llvm/trunk/test/CodeGen/R600/hsa.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/hsa.ll?rev=226970&r1=226969&r2=226970&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/R600/hsa.ll (original)
+++ llvm/trunk/test/CodeGen/R600/hsa.ll Fri Jan 23 17:59:08 2015
@@ -1,6 +1,8 @@
; RUN: llc < %s -mtriple=r600--amdhsa -mcpu=kaveri | FileCheck --check-prefix=HSA %s
; HSA: {{^}}simple:
+; HSA: .section .hsa.version
+; HSA-NEXT: .ascii "HSA Code Unit:0.0:AMD:0.1:GFX8.1:0"
; Make sure we are setting the ATC bit:
; HSA: s_mov_b32 s[[HI:[0-9]]], 0x100f000
; HSA: buffer_store_dword v{{[0-9]+}}, s[0:[[HI]]], 0
More information about the llvm-commits
mailing list