[LLVMdev] Branching to Entry block

Tanu Sharma tanusharma_04 at yahoo.com
Thu Feb 17 11:13:38 PST 2005


Thanks a lot for replying.
 
I have another query.
 
If branching to the entry block is not legal in llvm how should I be able to create a new entry block for any existing list?
 
I created a new block and inserted it into the present basic block list , but I get this error:
 
opt: BasicBlock.cpp:83: virtual llvm::BasicBlock::~BasicBlock(): Assertion `getParent() == 0 && "BasicBlock still linked into the program!"' failed.

The program completes its task and i get this in the end.
I am unable to resolve this.
 
Thanks
Tanu

John Criswell <criswell at cs.uiuc.edu> wrote:
Tanu Sharma wrote:
> Hello,
> 
> In an attempt to randomise the basic blocks in a function, is it 
> possible that I can randomise the entry block as well? And maybe insert 
> some instructions in the pass to call entry block while running the 
> program ?
> 
> Is it feasible?
> 
> What does entry block consist of ?

The entry block, by definition, is the first basic block (BB) to be 
executed by a function. As I understand it, it has the additional 
restriction that it cannot be dominated by other basic blocks (i.e. no 
other BBs in the function can branch to it).

If your entry BB performs useful computations and you want to move it, 
you could create a new entry BB that does nothing but branch to the old 
entry BB. The old entry BB (now just a regular BB) can then be moved.

I'm assuming thus far that you're randomizing the basic block order at 
the LLVM level (i.e. take LLVM function, randomize order of BBs, and 
then codegen each BB in order). Another approach, as I see it, would be 
to change the code generator so that it codegens the BBs in a random 
order, instead of codegen'ing them in order.

The first approach, I think, is a lot easier.

Regards,

-- John T.

> 
> Thanks
> 
> Tanu
> 
> 
> 
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Search presents - Jib Jab's 'Second Term' 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050217/bfdc1aee/attachment.html>


More information about the llvm-dev mailing list