adds faster decoding to tcc and cleans up others

This commit is contained in:
2023-07-29 11:42:46 +02:00
parent bd0d15f3a2
commit 6e52af168b
4 changed files with 180 additions and 187 deletions

View File

@@ -218,7 +218,7 @@ private:
});
}
}
typename arch::traits<ARCH>::opcode_e decodeInstr(decoding_tree_node* node, code_word_t word){
typename arch::traits<ARCH>::opcode_e decode_instr(decoding_tree_node* node, code_word_t word){
if(!node->children.size()){
if(node->instrs.size() == 1) return node->instrs[0].op;
for(auto instr : node->instrs){
@@ -228,7 +228,7 @@ private:
else{
for(auto child : node->children){
if (child->value == (node->submask&word)){
return decodeInstr(child, word);
return decode_instr(child, word);
}
}
}
@@ -260,7 +260,6 @@ constexpr size_t bit_count(uint32_t u) {
template <typename ARCH>
vm_impl<ARCH>::vm_impl(ARCH &core, unsigned core_id, unsigned cluster_id)
: vm_base<ARCH>(core, core_id, cluster_id) {
unsigned id=0;
root = new decoding_tree_node(std::numeric_limits<uint32_t>::max());
for(auto instr:instr_descr){
root->instrs.push_back(instr);
@@ -297,7 +296,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
} else {
if (is_jump_to_self_enabled(cond) &&
(instr == 0x0000006f || (instr&0xffff)==0xa001)) throw simulation_stopped(0); // 'J 0' or 'C.J 0'
auto inst_id = decodeInstr(root, instr);
auto inst_id = decode_instr(root, instr);
// pre execution stuff
this->core.reg.last_branch = 0;
if(this->sync_exec && PRE_SYNC) this->do_sync(PRE_SYNC, static_cast<unsigned>(inst_id));