llvm.org GIT mirror llvm / d7ef3da
AMDGPU/SI: Emit global variable sizes when targeting HSA Reviewers: arsenm Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D15952 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257173 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 4 years ago
2 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
147147 TS->EmitAMDGPUHsaProgramScopeGlobal(GV->getName());
148148 }
149149
150 MCSymbolELF *GVSym = cast(getSymbol(GV));
150151 const DataLayout &DL = getDataLayout();
152
153 // Emit the size
154 uint64_t Size = DL.getTypeAllocSize(GV->getType()->getElementType());
155 OutStreamer->emitELFSize(GVSym, MCConstantExpr::create(Size, OutContext));
151156 OutStreamer->PushSection();
152157 OutStreamer->SwitchSection(
153158 getObjFileLowering().SectionForGlobal(GV, *Mang, TM));
154 MCSymbol *GVSym = getSymbol(GV);
155159 const Constant *C = GV->getInitializer();
156160 OutStreamer->EmitLabel(GVSym);
157161 EmitGlobalConstant(DL, C);
1616 }
1717
1818 ; ASM: .amdgpu_hsa_module_global internal_global
19 ; ASM: .size internal_global_program, 4
1920 ; ASM: .hsadata_global_program
2021 ; ASM: internal_global_program:
2122 ; ASM: .long 0
2223
2324 ; ASM: .amdgpu_hsa_module_global common_global
25 ; ASM: .size common_global_program, 4
2426 ; ASM: .hsadata_global_program
2527 ; ASM: common_global_program:
2628 ; ASM: .long 0
2729
2830 ; ASM: .amdgpu_hsa_program_global external_global
31 ; ASM: .size external_global_program, 4
2932 ; ASM: .hsadata_global_program
3033 ; ASM: external_global_program:
3134 ; ASM: .long 0
3235
3336 ; ASM: .amdgpu_hsa_module_global internal_global
37 ; ASM: .size internal_global_agent, 4
3438 ; ASM: .hsadata_global_agent
3539 ; ASM: internal_global_agent:
3640 ; ASM: .long 0
3741
3842 ; ASM: .amdgpu_hsa_module_global common_global
43 ; ASM: .size common_global_agent, 4
3944 ; ASM: .hsadata_global_agent
4045 ; ASM: common_global_agent:
4146 ; ASM: .long 0
4247
4348 ; ASM: .amdgpu_hsa_program_global external_global
49 ; ASM: .size external_global_agent, 4
4450 ; ASM: .hsadata_global_agent
4551 ; ASM: external_global_agent:
4652 ; ASM: .long 0
4753
4854 ; ASM: .amdgpu_hsa_module_global internal_readonly
55 ; ASM: .size internal_readonly, 4
4956 ; ASM: .hsatext
5057 ; ASM: internal_readonly:
5158 ; ASM: .long 0
5259
5360 ; ASM: .amdgpu_hsa_program_global external_readonly
61 ; ASM: .size external_readonly, 4
5462 ; ASM: .hsatext
5563 ; ASM: external_readonly:
5664 ; ASM: .long 0
7886
7987 ; ELF: Symbol {
8088 ; ELF: Name: common_global_agent
89 ; ELF: Size: 4
8190 ; ELF: Binding: Local
8291 ; ELF: Section: .hsadata_global_agent
8392 ; ELF: }
8493
8594 ; ELF: Symbol {
8695 ; ELF: Name: common_global_program
96 ; ELF: Size: 4
8797 ; ELF: Binding: Local
8898 ; ELF: Section: .hsadata_global_program
8999 ; ELF: }
90100
91101 ; ELF: Symbol {
92102 ; ELF: Name: internal_global_agent
103 ; ELF: Size: 4
93104 ; ELF: Binding: Local
94105 ; ELF: Type: Object
95106 ; ELF: Section: .hsadata_global_agent
97108
98109 ; ELF: Symbol {
99110 ; ELF: Name: internal_global_program
111 ; ELF: Size: 4
100112 ; ELF: Binding: Local
101113 ; ELF: Type: Object
102114 ; ELF: Section: .hsadata_global_program
104116
105117 ; ELF: Symbol {
106118 ; ELF: Name: internal_readonly
119 ; ELF: Size: 4
107120 ; ELF: Binding: Local
108121 ; ELF: Type: Object
109122 ; ELF: Section: .hsatext
111124
112125 ; ELF: Symbol {
113126 ; ELF: Name: external_global_agent
127 ; ELF: Size: 4
114128 ; ELF: Binding: Global
115129 ; ELF: Type: Object
116130 ; ELF: Section: .hsadata_global_agent
118132
119133 ; ELF: Symbol {
120134 ; ELF: Name: external_global_program
135 ; ELF: Size: 4
121136 ; ELF: Binding: Global
122137 ; ELF: Type: Object
123138 ; ELF: Section: .hsadata_global_program
125140
126141 ; ELF: Symbol {
127142 ; ELF: Name: external_readonly
143 ; ELF: Size: 4
128144 ; ELF: Binding: Global
129145 ; ELF: Type: Object
130146 ; ELF: Section: .hsatext