llvm.org GIT mirror llvm / a0adb8d
AMDGPU: Emit R_AMDGPU_ABS32_{HI,LO} for scratch buffer relocations Reviewers: arsenm, rafael, kzhuravl Subscribers: rafael, arsenm, llvm-commits, kzhuravl Differential Revision: http://reviews.llvm.org/D21400 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273166 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 4 years ago
3 changed file(s) with 29 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2020 AMDGPUELFObjectWriter(bool Is64Bit, bool HasRelocationAddend);
2121 protected:
2222 unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
23 const MCFixup &Fixup, bool IsPCRel) const override {
24 return Fixup.getKind();
25 }
26
23 const MCFixup &Fixup, bool IsPCRel) const override;
2724 };
2825
2926
3633 ELF::EM_AMDGPU,
3734 HasRelocationAddend) { }
3835
36 unsigned AMDGPUELFObjectWriter::getRelocType(MCContext &Ctx,
37 const MCValue &Target,
38 const MCFixup &Fixup,
39 bool IsPCRel) const {
40 // SCRATCH_RSRC_DWORD[01] is a special global variable that represents
41 // the scratch buffer.
42 if (Target.getSymA()->getSymbol().getName() == "SCRATCH_RSRC_DWORD0")
43 return ELF::R_AMDGPU_ABS32_LO;
44 if (Target.getSymA()->getSymbol().getName() == "SCRATCH_RSRC_DWORD1")
45 return ELF::R_AMDGPU_ABS32_HI;
46
47 llvm_unreachable("unhandled relocation type");
48 }
49
3950
4051 MCObjectWriter *llvm::createAMDGPUELFObjectWriter(bool Is64Bit,
4152 bool HasRelocationAddend,
77 ; ALL-LABEL: {{^}}large_alloca_compute_shader:
88
99 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
10 ; GCN-DAG: ; fixup A - offset: 4, value: SCRATCH_RSRC_DWORD0, kind: FK_Data_4
10 ; GCN-DAG: ; fixup A - offset: 4, value: SCRATCH_RSRC_DWORD0
1111 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
12 ; GCN-DAG: ; fixup A - offset: 4, value: SCRATCH_RSRC_DWORD1, kind: FK_Data_4
12 ; GCN-DAG: ; fixup A - offset: 4, value: SCRATCH_RSRC_DWORD1
1313 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, -1
1414 ; CI-DAG: s_mov_b32 s{{[0-9]+}}, 0xe8f000
1515 ; VI-DAG: s_mov_b32 s{{[0-9]+}}, 0xe80000
0 // RUN: llvm-mc -filetype=obj -triple amdgcn-- -mcpu=kaveri -show-encoding %s | llvm-readobj -relocations | FileCheck %s
1
2 // CHECK: Relocations [
3 // CHECK: R_AMDGPU_ABS32_LO SCRATCH_RSRC_DWORD0 0x0
4 // CHECK: R_AMDGPU_ABS32_HI SCRATCH_RSRC_DWORD1 0x0
5 // CHECK: ]
6
7 kernel:
8 s_mov_b32 s0, SCRATCH_RSRC_DWORD0
9 s_mov_b32 s1, SCRATCH_RSRC_DWORD1
10
11 .globl SCRATCH_RSRC_DWORD0