Commit cacba274 authored by zygzagZ's avatar zygzagZ

Further bool lazy eval fixes and proper alloc register preservation

parent c938ad6f
......@@ -261,7 +261,7 @@ void Compiler::generateQAlloc(QAlloc &q) {
append("PUSHL", "$" + to_string(q.size));
append("CALL", q.count ? "__latte_mem_init_array" : "__latte_mem_init");
append("ADDL", "$" + to_string(q.count ? 12 : 8), "%esp");
append("ADDL", "$8", "%esp");
for (auto r = saveRegs.rbegin(); r != saveRegs.rend(); r++) {
if (*r != Register(q.loc)) {
......
......@@ -244,6 +244,7 @@ void QuadrupleGenerator::visitEAnd(EAnd *p) {
leftValBlock->quads.pop_back();
// could merge basic blocks now, but why bother
if (r) {
if (labelTrue && r->constExpr && r->val == 1) addQuad<QJump>(labelTrue);
lastVar = r->val ? l : r;
}
} else {
......@@ -254,12 +255,10 @@ void QuadrupleGenerator::visitEAnd(EAnd *p) {
rightValBlock->append(block);
leftValBlock->append(block);
if (!labelTrue || !labelFalse) {
lastVar = alloc();
if (!labelTrue || !labelFalse) {
block->addPhi(rightValBlock, lastVar, r);
block->addPhi(leftValBlock, lastVar, l);
} else {
lastVar = nullptr;
}
}
}
......@@ -287,6 +286,8 @@ void QuadrupleGenerator::visitEOr(EOr *p) {
leftValBlock->quads.pop_back();
// could merge basic blocks now, but why bother
if (r) {
// qjump labelFalse if r->constExpr && r->val == 0 && labelFalse
if (labelFalse && r->constExpr && r->val == 0) addQuad<QJump>(labelFalse);
lastVar = r->val ? r : l;
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment