mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 15:32:52 +00:00
Fix for issue 331
This commit is contained in:
parent
1d6a42c39a
commit
f5bb3d65af
@ -94,25 +94,25 @@ void CFG::EmitBlocks() {
|
|||||||
return std::distance(index_to_pc.begin(), it_index);
|
return std::distance(index_to_pc.begin(), it_index);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto it = labels.begin(); it != labels.end(); it++) {
|
// Check to make sure there are lables in the vector and that they have data.
|
||||||
const Label start = *it;
|
ASSERT(!lables.empty() && lables.size() > 2);
|
||||||
const auto next_it = std::next(it);
|
|
||||||
const bool is_last = next_it == labels.end();
|
// Loop through every pair except the last two:
|
||||||
if (is_last) {
|
// [0,1,2,3,4,5,6]
|
||||||
// Last label is special.
|
// [0,1], [1,2], [2,3], [3,4], [4,5]
|
||||||
return;
|
for (int i = 0; i < labels.size() - 2; ++i)
|
||||||
}
|
{
|
||||||
const Label end = *next_it;
|
const Label start = lables[i];
|
||||||
const size_t end_index = get_index(end) - 1;
|
const Label end = labels[i+1];
|
||||||
const auto& end_inst = inst_list[end_index];
|
|
||||||
|
// TODO: Investigate how to make sure this does not go out of bounds.
|
||||||
|
// Is inst_list always the size of labels?
|
||||||
|
const auto& end_inst = inst_list[i+1];
|
||||||
|
|
||||||
// Insert block between the labels using the last instruction
|
|
||||||
// as an indicator for branching type.
|
|
||||||
Block* block = block_pool.Create();
|
Block* block = block_pool.Create();
|
||||||
block->begin = start;
|
block->begin = start;
|
||||||
block->end = end;
|
block->begin_index = i;
|
||||||
block->begin_index = get_index(start);
|
block->end_index = i + 1;
|
||||||
block->end_index = end_index;
|
|
||||||
block->end_inst = end_inst;
|
block->end_inst = end_inst;
|
||||||
block->cond = MakeCondition(end_inst.opcode);
|
block->cond = MakeCondition(end_inst.opcode);
|
||||||
blocks.insert(*block);
|
blocks.insert(*block);
|
||||||
|
Loading…
Reference in New Issue
Block a user