================ @@ -120,6 +120,46 @@ inline bool isConstantAddressSpace(unsigned AS) { return false; } } + +namespace DWARFAS { +enum : unsigned { + GLOBAL = 0, + GENERIC = 1, + REGION = 2, + LOCAL = 3, + PRIVATE_LANE = 5, + PRIVATE_WAVE = 6, + DEFAULT = GLOBAL, +}; +} // namespace DWARFAS + +/// If @p LLVMAddressSpace has a corresponding DWARF encoding, +/// return it; otherwise return the sentinel value -1 to indicate +/// no such mapping exists. +/// +/// This maps private/scratch to the focused lane view. +/// +/// These mappings must be kept in sync with llvm/docs/AMDGPUUsage.rst +/// table "AMDGPU DWARF Address Space Mapping". +/// +/// Note: This could return std::optional<int> but that would require +/// an extra #include. +inline int mapToDWARFAddrSpace(unsigned LLVMAddrSpace) { ---------------- arsenm wrote:
```suggestion constexpr int mapToDWARFAddrSpace(unsigned LLVMAddrSpace) { ``` https://github.com/llvm/llvm-project/pull/153883 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits