1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 08:31:11 +00:00

Adds a check for 8/16-bit redundancy.

This commit is contained in:
Thomas Harte 2020-09-25 17:42:42 -04:00
parent 22c792dc46
commit 636e929607

View File

@ -67,6 +67,23 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
});
storage_.micro_ops_.push_back(OperationMoveToNextProgram);
// Minor optimisation: elide the steps if 8- and 16-bit steps are equal.
bool are_equal = true;
size_t c = 0;
while(true) {
if(storage_.micro_ops_[micro_op_location_8 + c] != storage_.micro_ops_[micro_op_location_16 + c]) {
are_equal = false;
break;
}
if(storage_.micro_ops_[micro_op_location_8 + c] == OperationMoveToNextProgram) break;
++c;
}
if(are_equal) {
storage_.micro_ops_.resize(micro_op_location_16);
micro_op_location_16 = micro_op_location_8;
}
// Insert into the map.
installed_patterns[key] = std::make_pair(micro_op_location_8, micro_op_location_16);
} else {
@ -185,6 +202,7 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
}
};
ProcessorStorage TEMPORARY_test_instance;
ProcessorStorage::ProcessorStorage() {
ProcessorStorageConstructor constructor(*this);