[cfe-dev] how to make llvm_any_pointer match pointer in any address space

Liu winter via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 13 06:19:58 PDT 2017


Hi, I am trying to add address space in my backend. I have added an intrinsic:

        def  int_mytarget_padd : Intrinsic<[], [llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyptr_ty], []>;

then in test.c I wrote:

        #define MEM1 __attribute__((address_space(1)))
        #define MEM2 __attribute__((address_space(2)))
        #define MEM3 __attribute__((address_space(3)))

        void llvm_mytarget_padd(void *dst, void *op1, void* op2) asm("llvm.mytarget_padd");

        int func(int MEM3 *c, int MEM2 *a, int MEM2 *b) {
            llvm_mytarget_padd(c, a, b);
            return 0;
       }

Errors occured:

       passing '__attribute__((address_space(1))) int *' to parameter of type 'void *' changes address space of pointer

I change argument to `void MEM3 *dst, void MEM1 *op1, void MEM2*op2` in declaration of `llvm_mytarget_padd`, then compilation complete.
I want to make each parameter of `llvm_mytarget_padd` be of any address space , any suggestion?

Yours,
Winter



More information about the cfe-dev mailing list