Functions in non-default address space.

void foo (void) {}

In PIC16, functions resides in a different address space (program memory), how to change the default address space for GlobalAddress "foo" in clang for a particular target?

- Sanjiv

You shouldn't need to do anything outside the LLVM backend, I think;
the backend should take care of putting functions in an appropriate
section, no?

As far as I know, LLVM doesn't support putting functions in alternate
address spaces, so we can't really add it to clang.

-Eli

Eli Friedman wrote:

  

void foo (void) {}

In PIC16, functions resides in a different address space (program
memory), how to change the default address space for GlobalAddress "foo"
in clang for a particular target?
    
You shouldn't need to do anything outside the LLVM backend, I think;
the backend should take care of putting functions in an appropriate
section, no?

I need to use that information in the back end only.
We emit 'bank selection' insns before any insn that access data memory. For example, a global int a; (GlobalAddress a) should have a banksel emitted while anything that access "foo()" (GlobalAddress foo) need not.
Are you saying to distinguish GloalAddress that are functions from those that are not?

I'm not familiar with the details of the backend, but I think you
should distinguish between calls and loads/stores for that sort of
thing.

-Eli

Eli Friedman wrote: