Change tracking of basic blocks (within function) to use a vector.
Changing the code to "preallocate" basic blocks in a vector, rather
than dynamically creating on demand. This has the advantage of not
requiring basic blocks to be sorted after the bitcode is parsed.
This also means that the name of the basic blocks remain constant,
even during parsing, making debugging easier.
The drawback is that the DECLAREBLOCKS bitcode record of a function
block can define a very large number of basic blocks. To control this,
we look at the function block size (within the bitstream) to determine
the maximal number of basic blocks that could be defined. If the
DECLAREBLOCKS record specifies a number larger than this, we generate
an error and recover (if applicable).
We also add an cleanup test that confirms the number of declared basic
blocks correspond to the number of basic blocks defined in the
function.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4261
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/1297433002 .
4 files changed