Skip to content

Commit e80e8ea

Browse files
VyacheslavLevytskyysys-ce-bb
authored andcommitted
Document contract between LLVM IR producer and the translator wrt. global variable declarations (#2267)
Global variable declarations are not permitted to have no address space or addrspace(0). This PR is to document this contract. Original commit: KhronosGroup/SPIRV-LLVM-Translator@e66cfea
1 parent a68b9fe commit e80e8ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm-spirv/docs/SPIRVRepresentationInLLVM.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,16 @@ Calling convention
392392
A function with ``spir_kernel`` calling convention will be translated as an entry
393393
point of the SPIR-V module.
394394

395+
Global variables
396+
----------------
397+
398+
A global variable resides in an address space, and the default address space
399+
in LLVM is zero. The SPIR-V storage class represented by the zero LLVM IR
400+
address spaces is Function. However, SPIR-V global variable declarations are
401+
``OpVariable`` instructions whose Storage Class cannot be ``Function``. This
402+
means that global variable declarations must always have an address space
403+
specified and that address space cannot be ``0``.
404+
395405
Function metadata
396406
-----------------
397407

0 commit comments

Comments
 (0)