Fixing CFA.
This commit is contained in:
parent
24fc5acb07
commit
9a2d99d652
|
@ -43,17 +43,16 @@ int ControlFlowAnalysisPass::Run(HIRBuilder* builder) {
|
||||||
while (block) {
|
while (block) {
|
||||||
auto instr = block->instr_tail;
|
auto instr = block->instr_tail;
|
||||||
while (instr) {
|
while (instr) {
|
||||||
if (instr->opcode->flags & OPCODE_FLAG_BRANCH) {
|
if ((instr->opcode->flags & OPCODE_FLAG_BRANCH) == 0) {
|
||||||
if (instr->opcode == &OPCODE_BRANCH_info) {
|
break;
|
||||||
auto label = instr->src1.label;
|
}
|
||||||
builder->AddEdge(block, label->block, Edge::UNCONDITIONAL);
|
if (instr->opcode == &OPCODE_BRANCH_info) {
|
||||||
break;
|
auto label = instr->src1.label;
|
||||||
} else if (instr->opcode == &OPCODE_BRANCH_TRUE_info ||
|
builder->AddEdge(block, label->block, Edge::UNCONDITIONAL);
|
||||||
instr->opcode == &OPCODE_BRANCH_FALSE_info) {
|
} else if (instr->opcode == &OPCODE_BRANCH_TRUE_info ||
|
||||||
auto label = instr->src2.label;
|
instr->opcode == &OPCODE_BRANCH_FALSE_info) {
|
||||||
builder->AddEdge(block, label->block, 0);
|
auto label = instr->src2.label;
|
||||||
break;
|
builder->AddEdge(block, label->block, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
instr = instr->prev;
|
instr = instr->prev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
|
||||||
// Walk blocks in reverse and calculate incoming/outgoing values.
|
// Walk blocks in reverse and calculate incoming/outgoing values.
|
||||||
auto block = builder->last_block();
|
auto block = builder->last_block();
|
||||||
while (block) {
|
while (block) {
|
||||||
// allocate bitsets based on max value number
|
// Allocate bitsets based on max value number.
|
||||||
block->incoming_values = incoming_bitvectors[block->ordinal];
|
block->incoming_values = incoming_bitvectors[block->ordinal];
|
||||||
auto& incoming_values = *block->incoming_values;
|
auto& incoming_values = *block->incoming_values;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue