[llvm-dev] Using a MachineInstruction Address

Diogo Sampaio via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 1 16:06:48 PST 2020


Hi, 
Is there a straight-forward way to obtain an arbitrary MachineInstruction address and maintain it updated along the backend optimizations, even if it is in the middle of a MachineBasicBlock? 
I have an instruction that takes a relative address. E.g 

BB0: 
myInstruction BBN + 4*x 

BBN: 
... x instructions ... 
target_instruction <<=== it points to here. 

The issues I have are: 
1) I only see the ability to obtain basic-block addresses/labels, and these are only updated in terminator instructions. So by change that basic block is renamed/merged the value in myInstruction gets corrupt. 
2) Even if I set-up the instruction at the top of a basic block, eventually the BB gets merged, so just pointing to the BB label is not enough. 

I do see MCSymbol, but I don't get it. It seems to be resolved during asm printing. 

Thanks, 


Diogo Sampaio 
Senior Compiler Engineer • Kalray 
dsampaio at kalrayinc.com • [ https://www.kalrayinc.com/ | www.kalrayinc.com ] 

[ https://www.kalrayinc.com/ |   ] 
	
The Processor at the Heart 
of Intelligent Systems 

Please consider the environment before printing this e-mail. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201202/1fde3b6a/attachment.html>


More information about the llvm-dev mailing list