[llvm-dev] Identify accessed memory regions with LLVM pass

Harish via llvm-dev
Tue, 28 Dec 2021 05:46:27 -0000

I am working on an architecture that uses scratchpad memory. So I am
planning to implement a pass that inserts data transfer
instructions(custom) before the computation. Look at the below example
where the fun() needs A, B, C arrays. Before invoking fun(), I have the
move these arrays to the scratchpad. How do I identify the memory region
accessed by these arrays? Any pointers would be helpful.

void fun(int *A, int *B, int *C, int start, int end){
    for (int i = start; i < end; ++i) {
        [i] = A[i] + B[i];
    }

}

void test(){

    int start, end;
    int *A, *B, *C;
    // Intialize variables

    // TODO:
    //   1. Identify the memory region accessed by A, B and C
    //   2. Move the accessed regions to scratchpad memory
    fun(A, B, C, start, end);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20211228/504e357a/attachment.html>