[LLVMdev] Entry block (Randomisation)

John Criswell criswell at cs.uiuc.edu
Tue Feb 15 07:02:52 PST 2005


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' 
> <http://us.rd.yahoo.com/evt=30648/*http://movies.yahoo.com/movies/feature/jibjabinaugural.html> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list