[llvm-dev] Print emory for constant address

Zhizhong via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 7 11:43:51 PDT 2018


Hi all,

Consider a simple ll code:
%2 = load i32* %y, align 4

I intend to get the memory address of %2.
if(isa<loadInst>(I)){
	// variable name:y
	value v = I.getOperand(0);
	// ? I shows the entire instruction, not %2, then I.getName() would print an empty space which is %2, but I can’t get the memory when dereferencing it
	errs()<< *&(I.getName())<<"\n”;
}

error: taking the address of an temporary object of type llvm::stringRef.

Please suggest what should I use to get the actual address of the register name %2.

Thanks,
Ethan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180408/7abbeeb4/attachment.html>


More information about the llvm-dev mailing list