[llvm] r255689 - AMDGPU/SI: Emit constant variables in the .hsatext section when targeting HSA
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 15 14:39:36 PST 2015
Author: tstellar
Date: Tue Dec 15 16:39:36 2015
New Revision: 255689
URL: http://llvm.org/viewvc/llvm-project?rev=255689&view=rev
Log:
AMDGPU/SI: Emit constant variables in the .hsatext section when targeting HSA
Reviewers: arsenm
Subscribers: arsenm, llvm-commits
Differential Revision: http://reviews.llvm.org/D15426
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
llvm/trunk/test/CodeGen/AMDGPU/global-constant.ll
llvm/trunk/test/CodeGen/AMDGPU/hsa-globals.ll
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp?rev=255689&r1=255688&r2=255689&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp Tue Dec 15 16:39:36 2015
@@ -126,8 +126,12 @@ static bool isModuleLinkage(const Global
void AMDGPUAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
- if (TM.getTargetTriple().getOS() != Triple::AMDHSA ||
- GV->isDeclaration()) {
+ if (TM.getTargetTriple().getOS() != Triple::AMDHSA) {
+ AsmPrinter::EmitGlobalVariable(GV);
+ return;
+ }
+
+ if (GV->isDeclaration() || GV->getLinkage() == GlobalValue::PrivateLinkage) {
AsmPrinter::EmitGlobalVariable(GV);
return;
}
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp?rev=255689&r1=255688&r2=255689&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp Tue Dec 15 16:39:36 2015
@@ -83,8 +83,5 @@ MCSection *AMDGPUHSATargetObjectFile::Se
return DataGlobalProgramSection;
}
- if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GV))
- return RodataReadonlyAgentSection;
-
- return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
+ return AMDGPUTargetObjectFile::SelectSectionForGlobal(GV, Kind, Mang, TM);
}
Modified: llvm/trunk/test/CodeGen/AMDGPU/global-constant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/global-constant.ll?rev=255689&r1=255688&r2=255689&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/global-constant.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/global-constant.ll Tue Dec 15 16:39:36 2015
@@ -1,4 +1,5 @@
-; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
+; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOHSA %s
+; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=HSA %s
@readonly = private unnamed_addr addrspace(2) constant [4 x float] [float 0.0, float 1.0, float 2.0, float 3.0]
@readonly2 = private unnamed_addr addrspace(2) constant [4 x float] [float 4.0, float 5.0, float 6.0, float 7.0]
@@ -10,7 +11,8 @@
; GCN: s_getpc_b64 s{{\[}}[[PC1_LO:[0-9]+]]:[[PC1_HI:[0-9]+]]{{\]}}
; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC1_LO]], readonly
; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC1_HI]], 0
-; GCN: .text
+; NOHSA: .text
+; HSA: .hsatext
; GCN: readonly:
; GCN: readonly2:
define void @main(i32 %index, float addrspace(1)* %out) {
Modified: llvm/trunk/test/CodeGen/AMDGPU/hsa-globals.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/hsa-globals.ll?rev=255689&r1=255688&r2=255689&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/hsa-globals.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/hsa-globals.ll Tue Dec 15 16:39:36 2015
@@ -47,12 +47,12 @@ define void @test() {
; ASM: .long 0
; ASM: .amdgpu_hsa_module_global internal_readonly
-; ASM: .hsarodata_readonly_agent
+; ASM: .hsatext
; ASM: internal_readonly:
; ASM: .long 0
; ASM: .amdgpu_hsa_program_global external_readonly
-; ASM: .hsarodata_readonly_agent
+; ASM: .hsatext
; ASM: external_readonly:
; ASM: .long 0
@@ -77,15 +77,6 @@ define void @test() {
; ELF: ]
; ELF: }
-; ELF: Section {
-; ELF: Name: .hsarodata_readonly_agent
-; ELF: Type: SHT_PROGBITS (0x1)
-; ELF: Flags [ (0xA00002)
-; ELF: SHF_ALLOC (0x2)
-; ELF: SHF_AMDGPU_HSA_AGENT (0x800000)
-; ELF: SHF_AMDGPU_HSA_READONLY (0x200000)
-; ELF: ]
-
; ELF: Symbol {
; ELF: Name: common_global_agent
; ELF: Binding: Local
@@ -116,7 +107,7 @@ define void @test() {
; ELF: Name: internal_readonly
; ELF: Binding: Local
; ELF: Type: Object
-; ELF: Section: .hsarodata_readonly_agent
+; ELF: Section: .hsatext
; ELF: }
; ELF: Symbol {
@@ -137,5 +128,5 @@ define void @test() {
; ELF: Name: external_readonly
; ELF: Binding: Global
; ELF: Type: Object
-; ELF: Section: .hsarodata_readonly_agent
+; ELF: Section: .hsatext
; ELF: }
More information about the llvm-commits
mailing list