Sebastien Le Duc via llvm-dev
2020-Jun-24 14:25 UTC
[llvm-dev] Target specific named address spaces
Hi, Is there a way to implement named address spaces with clang/llvm as it is possible with gcc ? We would like to have our own named address space that would be recognized by the frontend. Thanks in advance! Regards, Sebastien
Bevin Hansson via llvm-dev
2020-Jun-25 08:27 UTC
[llvm-dev] Target specific named address spaces
Hi Sebastien, Clang does have support for numbered address spaces via the __attribute__((address_space(N))) syntax. These address spaces map down to addrspace() in LLVM IR, and addrspaces in LLVM IR have arbitrary semantics unknown to LLVM itself. However, there is no way to define custom address space keywords without adding them explicitly to the lexing and parsing, and there is also no way for a target to express how its address spaces are supposed to be related (subspaces, conversions etc). I have an initial patch to add support for target AS compatibility here (https://reviews.llvm.org/D62574) but hit some snags and have not had the bandwidth to finish it. I don't think a lot of people really require this, so it's hard to justify working on it. / Bevin ________________________________ From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Sebastien Le Duc via llvm-dev <llvm-dev at lists.llvm.org> Sent: Wednesday, June 24, 2020 4:25 PM To: 'llvm-dev' <llvm-dev at lists.llvm.org> Subject: [llvm-dev] Target specific named address spaces Hi, Is there a way to implement named address spaces with clang/llvm as it is possible with gcc ? We would like to have our own named address space that would be recognized by the frontend. Thanks in advance! Regards, Sebastien _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org https://protect2.fireeye.com/v1/url?k=a0d845e1-fe699e81-a0d8057a-86e2237f51fb-f0cf30ff10e310fb&q=1&e=323d117c-3292-4e7a-a026-cd25d5184e09&u=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200625/6dc21372/attachment.html>
Ronan KERYELL via llvm-dev
2020-Jun-30 19:17 UTC
[llvm-dev] Target specific named address spaces
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Sebastien Le Duc via llvm-dev <llvm-dev at lists.llvm.org> Sent: > Hi, Is there a way to implement named address spaces with > clang/llvm as it is possible with gcc ? > We would like to have our own named address space that would > be recognized by the frontend.>>>>> On Thu, 25 Jun 2020 08:27:10 +0000, Bevin Hansson via llvm-dev <llvm-dev at lists.llvm.org> said:Bevin> Hi Sebastien, Clang does have support for numbered address Bevin> spaces via the __attribute__((address_space(N))) Bevin> syntax. These address spaces map down to addrspace() in LLVM Bevin> IR, and addrspaces in LLVM IR have arbitrary semantics Bevin> unknown to LLVM itself. In the meantime, I wonder whether something like #define __mppa_cluster __attribute__((address_space(42))) plus a few LLVM-only passes could not do most of the job while avoiding diving into Clang... Then you have some decent minimal __mppa_cluster named address space. :-) Otherwise, if you can use C++, you can also use wrapper classes to add address spaces around some data types, such as mppa::cluster<int> v; to declare some int variable inside your MPPA cluster (just an imaginative example to give the idea). I used to do this in SYCL and also OpenCL C++ was using this trick https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_Cxx.html#address-spaces-library At some point if the C++ proposal about the . (dot) operator overloading lands, it should be easier to implement this way. -- Ronan KERYELL
Seemingly Similar Threads
- [RFC] Saturating left shift intrinsics
- Problem of getNumOperands() for CallInst
- ModulePass cannot be registered as EarlyAsPossible
- [DebugInfo] DIBuilder missing interface to generate DWARF info for packed_decimal basic type.
- [LLVMdev] RFC: Machine Level IR text-based serialization format