[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]

My understanding of the the section on Control flow Graphs in the ?Design of the CPython Compiler? also alludes to this - 
>> As an example, consider an ?if? statement with an ?else? block. The guard on the ?if? is a basic block which is pointed to by the basic block containing the code leading to the ?if? statement. The ?if? statement block contains jumps (which are exit points) to the true body of the ?if? and the ?else? body (which may be NULL), each of which are their own basic blocks. Both of those blocks in turn point to the basic block representing the code following the entire ?if? statement.

The CPython compiler however seems to generate 2 basic blocks for the above snippets - 
	1. Block 1 - all instructions up to and including the if statement and the body of the if statement (the first return statement in this case)
	2. Block 2 - instructions for the else block (the second return statement)

Is there any reason for this or have I somehow missed something in the CFG generation process?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160711/b75b693e/attachment.html>