<div dir="ltr"><div> 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.</div><div><pre><code>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);
}</code></pre></div></div>