I have a simple add program.
int main() {
int x=10,y=10,result=0;
result=x+y;
return 0;
}
I created a LLVM frontend module pass which can traverse through the entire module.
So my pass iterates through the basic block and fetches me instructions.
FORE(iter, (*bb)) {
if(isa<AllocaInst>(iter)) {
errs()<<"The address of allocated variable is "<<&(*iter);
}
}
The output of this would be the address of alloca instruction but not the real stack address of the local variable.
Is there any way I can get the stack address of local variable using pass?