Use an instruction instead of a special-case boolean instruction.

This commit is contained in:
2020-09-17 18:33:52 -07:00
parent cf6f353f20
commit 02f8306c7b
3 changed files with 17 additions and 50 deletions

View File

@@ -3,6 +3,7 @@
#include <type_traits>
#include "binop.hpp"
#include "error.hpp"
#include "instruction.hpp"
#include "type.hpp"
#include "type_env.hpp"
#include "env.hpp"
@@ -308,9 +309,13 @@ struct case_strategy_bool {
return;
}
into.push_back(instruction_ptr(new instruction_if(
std::move(ms.get_case_for(true)),
std::move(ms.get_case_for(false)))));
instruction_ijump* ijump = new instruction_ijump();
instruction_ptr inst(ijump);
ijump->branches.push_back(std::move(ms.get_case_for(false)));
ijump->tag_mappings[0] = 0;
ijump->branches.push_back(std::move(ms.get_case_for(true)));
ijump->tag_mappings[1] = 1;
into.push_back(std::move(inst));
}
};