diff options
author | Hafiz Abid Qadeer <abidh@codesourcery.com> | 2021-05-28 18:06:57 +0100 |
---|---|---|
committer | Hafiz Abid Qadeer <abidh@codesourcery.com> | 2021-06-30 17:51:17 +0100 |
commit | b5bb7f328d56cccfb85932ff586138e5a4ef1436 (patch) | |
tree | ca188cb532bf8dbd4f8781553a68d0d37ccdbfd0 /gcc | |
parent | 22f201e4b32a4f8bc1e6462ee19643edae5d25a3 (diff) | |
download | gcc-b5bb7f328d56cccfb85932ff586138e5a4ef1436.zip gcc-b5bb7f328d56cccfb85932ff586138e5a4ef1436.tar.gz gcc-b5bb7f328d56cccfb85932ff586138e5a4ef1436.tar.bz2 |
[amdgcn] Add hook for DWARF address spaces.
Map GCN address spaces to the proposed DWARF address spaces defined by AMD at
https://llvm.org/docs/AMDGPUUsage.html#amdgpu-dwarf-address-class-mapping-table
gcc/
* config/gcn/gcn.c: Include dwarf2.h.
(gcn_addr_space_debug): New function.
(TARGET_ADDR_SPACE_DEBUG): New hook.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/gcn/gcn.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index a999897..6d02a4a 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -50,6 +50,7 @@ #include "varasm.h" #include "intl.h" #include "rtl-iter.h" +#include "dwarf2.h" /* This file should be included last. */ #include "target-def.h" @@ -1497,6 +1498,32 @@ gcn_addr_space_convert (rtx op, tree from_type, tree to_type) gcc_unreachable (); } +/* Implement TARGET_ADDR_SPACE_DEBUG. + + Return the dwarf address space class for each hardware address space. */ + +static int +gcn_addr_space_debug (addr_space_t as) +{ + switch (as) + { + case ADDR_SPACE_DEFAULT: + case ADDR_SPACE_FLAT: + case ADDR_SPACE_SCALAR_FLAT: + case ADDR_SPACE_FLAT_SCRATCH: + return DW_ADDR_none; + case ADDR_SPACE_GLOBAL: + return 1; // DW_ADDR_LLVM_global + case ADDR_SPACE_LDS: + return 3; // DW_ADDR_LLVM_group + case ADDR_SPACE_SCRATCH: + return 4; // DW_ADDR_LLVM_private + case ADDR_SPACE_GDS: + return 0x8000; // DW_ADDR_AMDGPU_region + } + gcc_unreachable (); +} + /* Implement REGNO_MODE_CODE_OK_FOR_BASE_P via gcn.h @@ -6391,6 +6418,8 @@ gcn_dwarf_register_span (rtx rtl) #undef TARGET_ADDR_SPACE_ADDRESS_MODE #define TARGET_ADDR_SPACE_ADDRESS_MODE gcn_addr_space_address_mode +#undef TARGET_ADDR_SPACE_DEBUG +#define TARGET_ADDR_SPACE_DEBUG gcn_addr_space_debug #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \ gcn_addr_space_legitimate_address_p |