Address spaces

Hey, I’m adding a custom address space for a project I’m working on to act as a way to pass information down from the middle end down to code generation in aarch64. I’ve searched through the aarch64 backend code for uses of address spaces, and it seems it doesn’t treat different ones too differently - the only examples are optimizations that don’t fire on address spaces that aren’t zero. When I mark a pointer as a different address space, this isn’t intended to change any of it’s semantics from the compiler’s perspective, and I have been working to modify the backend such that when it checks if a pointer is in address space 0, it also checks if it is my new address space, as any optimization that would fire on an address space 0 pointer should have no reason not to fire on this new address space.

I did notice though in the AArch64FastISel.cpp file at line 583, there is a comment saying that fast instruction select is disabled for ‘special’ address spaces, that being any address space above 255. This gives me a few questions:

  1. What is fast instruction selection and what are the implications if it can’t be used on code where I’ve changed the address spaces of pointers?
  2. What are the special and ‘normal’ address spaces?
  3. Does it matter what address space I use in aarch64 for my custom work, outside of address space 0? It seems as if I may want to make sure I chose one above 255.
  4. If I did designate my new address space as ‘special’, would this really actually make it incompatible with the fast instruction selector? Like I said above, I’ve been changing backend specific optimisaitons to support this new address space, would I want to avoid doing the same here?

Thanks.

FastISel is just an alternative instruction selection path that doesn’t try to handle everything. If it’s not handled, it will fall back to SelectionDAG which handles everything. There’s only possible compile time impact from it falling back. It’s also semi-deprecated and being replaced with GlobalISel.

The address space interpretation is a contract between frontends and the target. AArch64 could choose to pass through a given range of address spaces for software users

1 Like

The address space interpretation is a contract between frontends and the target. AArch64 could choose to pass through a given range of address spaces for software users

This was my interpretation yes. But does it do anything specific with the ‘special’ address spaces that you know of?