[llvm] [SPIRV][NFC] Refactor pointer creation in GlobalRegistery (PR #134429)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 05:48:12 PDT 2025


================
@@ -540,13 +548,32 @@ class SPIRVGlobalRegistry : public SPIRVIRMapping {
                                        unsigned NumElements, MachineInstr &I,
                                        const SPIRVInstrInfo &TII);
 
+  // Returns a pointer to a SPIR-V pointer type with the given base type and
+  // storage class. The base type will be translated to a SPIR-V type, and the
+  // appropriate layout decorations will be added to the base type.
   SPIRVType *getOrCreateSPIRVPointerType(
-      SPIRVType *BaseType, MachineIRBuilder &MIRBuilder,
+      Type *BaseType, MachineIRBuilder &MIRBuilder,
       SPIRV::StorageClass::StorageClass SClass = SPIRV::StorageClass::Function);
   SPIRVType *getOrCreateSPIRVPointerType(
-      SPIRVType *BaseType, MachineInstr &I, const SPIRVInstrInfo &TII,
+      Type *BaseType, MachineInstr &I,
       SPIRV::StorageClass::StorageClass SClass = SPIRV::StorageClass::Function);
 
+  // Returns a pointer to a SPIR-V pointer type with the given base type and
+  // storage class. It is the responsibility of the caller to make sure the
+  // decorations on the base type are valid for the given storage class. For
+  // example, it has the correct offset and stride decorations.
+  SPIRVType *getOrCreateSPIRVPointerType(
+      SPIRVType *BaseType, MachineIRBuilder &MIRBuilder,
+      SPIRV::StorageClass::StorageClass SClass = SPIRV::StorageClass::Function);
----------------
Keenuts wrote:

Same here, default values are never used.

https://github.com/llvm/llvm-project/pull/134429


More information about the llvm-commits mailing list