[PATCH] D15426: AMDGPU/SI: Emit constant variables in the .hsatext section when targeting HSA
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 10 11:01:37 PST 2015
tstellarAMD created this revision.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.
http://reviews.llvm.org/D15426
Files:
lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
test/CodeGen/AMDGPU/global-constant.ll
Index: test/CodeGen/AMDGPU/global-constant.ll
===================================================================
--- test/CodeGen/AMDGPU/global-constant.ll
+++ test/CodeGen/AMDGPU/global-constant.ll
@@ -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) {
Index: lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
+++ lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
@@ -83,8 +83,5 @@
return DataGlobalProgramSection;
}
- if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GV))
- return RodataReadonlyAgentSection;
-
- return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
+ return AMDGPUTargetObjectFile::SelectSectionForGlobal(GV, Kind, Mang, TM);
}
Index: lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -126,8 +126,10 @@
void AMDGPUAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
+ // Symbols with PrivateLinkage aren't supposed to go into the symbol table,
+ // so they don't need any special handling.
if (TM.getTargetTriple().getOS() != Triple::AMDHSA ||
- GV->isDeclaration()) {
+ GV->isDeclaration() || GV->getLinkage() == GlobalValue::PrivateLinkage) {
AsmPrinter::EmitGlobalVariable(GV);
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15426.42450.patch
Type: text/x-patch
Size: 2296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151210/b36ecdaf/attachment.bin>
More information about the llvm-commits
mailing list