in source/model-generator/ReturnsThisAnalyzer.cpp [86:136]
static bool analyze_default(
ReturnsThisContext* context,
const IRInstruction* instruction,
ReturnsThisEnvironment* current_state) {
LOG(4, "Analyzing instruction: {}", show(instruction));
if (opcode::is_a_load_param(instruction->opcode())) {
auto current_parameter_position = context->last_parameter_loaded();
context->increment_last_parameter_loaded();
auto location = current_parameter_position == 0 ? Location::ThisParameter
: Location::Default;
LOG(4,
"load-param: {}. Setting register: {} to Location: {}",
current_parameter_position,
instruction->dest(),
location);
current_state->set(instruction->dest(), Domain(location));
} else if (opcode::is_a_return_value(instruction->opcode())) {
mt_assert(instruction->srcs().size() == 1);
auto reg = instruction->srcs()[0];
auto return_locations = current_state->get(reg);
LOG(4, "Return register {} points to {}", reg, return_locations);
context->join_return_location(return_locations);
} else if (opcode::is_move_result_any(instruction->opcode())) {
auto result_locations = current_state->get(RESULT_REGISTER);
LOG(4,
"is-move-result-any. Setting dest register {} to location: {}",
instruction->dest(),
result_locations);
current_state->set(instruction->dest(), result_locations);
current_state->set(RESULT_REGISTER, Domain::top());
} else if (instruction->has_move_result_any()) {
auto result_location = Domain(Location::Default);
LOG(4, "has-move-result. Setting result register to {}", result_location);
current_state->set(RESULT_REGISTER, result_location);
} else if (instruction->has_dest()) {
auto result_location = Domain(Location::Default);
LOG(4,
"has-dest. Setting dest register {} to {}",
instruction->dest(),
result_location);
current_state->set(instruction->dest(), result_location);
}
return false;
}