[LLVMdev] Getting the position of a BasicBlock that doesn't exist anymore in the backend

Marcello Maggioni marcello at codeplay.com
Tue Apr 9 05:17:11 PDT 2013


Hello,

In our LLVM backend we needto  output certain labels in the AsmPrinter 
in order to access certain data through those labels. These labels are 
related to BlockAddress objects (that come from above) and they should 
be put into a position that is related to the BasicBlock pointed by that 
BlockAddress.

The problem I'm hitting is that if the BasicBlock that the BlockAddress 
points to is optimized away by the LLVM optimizer the BlockAddress 
becomes unreliable and the BasicBlock it points to is not anymore in the 
Function it was supposed to be. Because of this I'm not able to actually 
decide the position where to output the label anymore (because I rely on 
the position of the BasicBlock in the Function to decide the position of 
the label).

The most desirable situation would be to be able to know which is the 
BasicBlock that is immediately after in the stream and point to that, 
but I don't know if there is a reliable way to do that ( I tried to use 
the ->getPrevNode() ->getNextNode() on the BasicBlock object pointed by 
the BlockAddress, but I get unreliable results). Any idea?

Cheers,
Marcello

-- 
Marcello Maggioni
Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com
Twitter: https://twitter.com/codeplaysoft

This email and any attachments may contain confidential and /or privileged information and is for use by the addressee only. If you are not the intended recipient, please notify Codeplay Software Ltd immediately and delete the message from your computer. You may not copy or forward it,or use or disclose its contents to any other person. Any views or other information in this message which do not relate to our business are not authorized by Codeplay software Ltd, nor does this message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay Software Ltd does not accept any responsibility for any changes made to this message after it was sent. Please note that Codeplay Software Ltd does not accept any liability or responsibility for viruses and it is your responsibility to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY




More information about the llvm-dev mailing list