mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 08:49:47 +00:00
git subrepo pull (merge) deps/lightrec
subrepo: subdir: "deps/lightrec" merged: "3636435a" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "96b4f031" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo" commit: "a04d8c2"
This commit is contained in:
parent
16712de60a
commit
f4fc76cee8
2
deps/lightrec/.gitrepo
vendored
2
deps/lightrec/.gitrepo
vendored
@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = https://github.com/pcercuei/lightrec.git
|
||||
branch = master
|
||||
commit = a6ac0156560afd3ddcbed737e84198a270dc7953
|
||||
commit = 96b4f0314f1906d78069ec45a18d7cc660e73aeb
|
||||
parent = 9f797430963d9cf0fcef7d963466f9cac7026de2
|
||||
method = merge
|
||||
cmdver = 0.4.1
|
||||
|
2
deps/lightrec/blockcache.c
vendored
2
deps/lightrec/blockcache.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2015-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
2
deps/lightrec/disassembler.c
vendored
2
deps/lightrec/disassembler.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2014-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
2
deps/lightrec/emitter.c
vendored
2
deps/lightrec/emitter.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2014-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
2
deps/lightrec/interpreter.c
vendored
2
deps/lightrec/interpreter.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2019-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
12
deps/lightrec/lightrec.c
vendored
12
deps/lightrec/lightrec.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2014-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -777,6 +777,8 @@ static struct block * lightrec_precompile_block(struct lightrec_state *state,
|
||||
lightrec_print_disassembly(block, code, length);
|
||||
}
|
||||
|
||||
pr_debug("Block size: %lu opcodes\n", block->nb_ops);
|
||||
|
||||
/* If the first opcode is an 'impossible' branch, never compile the
|
||||
* block */
|
||||
if (list->flags & LIGHTREC_EMULATE_BRANCH)
|
||||
@ -825,6 +827,7 @@ int lightrec_compile_block(struct block *block)
|
||||
bool op_list_freed = false, fully_tagged = false;
|
||||
struct opcode *elm;
|
||||
jit_state_t *_jit;
|
||||
jit_node_t *start_of_block;
|
||||
bool skip_next = false;
|
||||
jit_word_t code_size;
|
||||
unsigned int i, j;
|
||||
@ -849,6 +852,8 @@ int lightrec_compile_block(struct block *block)
|
||||
jit_prolog();
|
||||
jit_tramp(256);
|
||||
|
||||
start_of_block = jit_label();
|
||||
|
||||
for (elm = block->opcode_list; elm; elm = elm->next) {
|
||||
next_pc = block->pc + elm->offset * sizeof(u32);
|
||||
|
||||
@ -887,6 +892,11 @@ int lightrec_compile_block(struct block *block)
|
||||
pr_debug("Patch local branch to offset 0x%x\n",
|
||||
branch->target << 2);
|
||||
|
||||
if (branch->target == 0) {
|
||||
jit_patch_at(branch->branch, start_of_block);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < state->nb_targets; j++) {
|
||||
if (state->targets[j].offset == branch->target) {
|
||||
jit_patch_at(branch->branch,
|
||||
|
2
deps/lightrec/memmanager.c
vendored
2
deps/lightrec/memmanager.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2019-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
36
deps/lightrec/optimizer.c
vendored
36
deps/lightrec/optimizer.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2014-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -136,6 +136,18 @@ bool opcode_writes_register(union code op, u8 reg)
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case OP_CP2:
|
||||
if (op.r.op == OP_CP2_BASIC) {
|
||||
switch (op.r.rs) {
|
||||
case OP_CP2_BASIC_MFC2:
|
||||
case OP_CP2_BASIC_CFC2:
|
||||
return op.i.rt == reg;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
case OP_META_MOV:
|
||||
return op.r.rd == reg;
|
||||
default:
|
||||
@ -525,6 +537,9 @@ static int lightrec_transform_ops(struct block *block)
|
||||
list->i.rs = list->i.rt;
|
||||
list->i.rt = 0;
|
||||
}
|
||||
} else if (list->i.rs == list->i.rt) {
|
||||
list->i.rs = 0;
|
||||
list->i.rt = 0;
|
||||
}
|
||||
break;
|
||||
case OP_BNE:
|
||||
@ -625,11 +640,13 @@ static int lightrec_switch_delay_slots(struct block *block)
|
||||
break;
|
||||
case OP_BEQ:
|
||||
case OP_BNE:
|
||||
if (opcode_writes_register(next_op, op.i.rt))
|
||||
if (op.i.rt && opcode_writes_register(next_op, op.i.rt))
|
||||
continue;
|
||||
case OP_BLEZ: /* fall-through */
|
||||
case OP_BGTZ:
|
||||
if (opcode_writes_register(next_op, op.i.rs))
|
||||
case OP_META_BEQZ:
|
||||
case OP_META_BNEZ:
|
||||
if (op.i.rs && opcode_writes_register(next_op, op.i.rs))
|
||||
continue;
|
||||
break;
|
||||
case OP_REGIMM:
|
||||
@ -641,15 +658,11 @@ static int lightrec_switch_delay_slots(struct block *block)
|
||||
continue;
|
||||
case OP_REGIMM_BLTZ: /* fall-through */
|
||||
case OP_REGIMM_BGEZ:
|
||||
if (opcode_writes_register(next_op, op.i.rs))
|
||||
if (op.i.rs &&
|
||||
opcode_writes_register(next_op, op.i.rs))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OP_META_BEQZ:
|
||||
case OP_META_BNEZ:
|
||||
if (opcode_writes_register(next_op, op.i.rs))
|
||||
continue;
|
||||
default: /* fall-through */
|
||||
break;
|
||||
}
|
||||
@ -749,16 +762,13 @@ static int lightrec_local_branches(struct block *block)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!prev || prev->j.op != OP_META_SYNC) {
|
||||
if (prev && prev->j.op != OP_META_SYNC) {
|
||||
pr_debug("Adding sync before offset "
|
||||
"0x%x\n", offset << 2);
|
||||
ret = lightrec_add_sync(block, prev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!prev)
|
||||
prev = block->opcode_list;
|
||||
|
||||
prev->next->offset = target->offset;
|
||||
}
|
||||
|
||||
|
2
deps/lightrec/recompiler.c
vendored
2
deps/lightrec/recompiler.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2019-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
2
deps/lightrec/regcache.c
vendored
2
deps/lightrec/regcache.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Paul Cercueil <paul@crapouillou.net>
|
||||
* Copyright (C) 2014-2020 Paul Cercueil <paul@crapouillou.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
Loading…
Reference in New Issue
Block a user