Skip to content

Commit

Permalink
git subrepo pull --force deps/lightrec
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "deps/lightrec"
  merged:   "05f7e09e919"
upstream:
  origin:   "https://github.com/pcercuei/lightrec.git"
  branch:   "master"
  commit:   "05f7e09e919"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "110b9eb"
  • Loading branch information
pcercuei committed Jan 8, 2025
1 parent 60e75db commit 2476185
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions deps/lightrec/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/pcercuei/lightrec.git
branch = master
commit = ea20362c9542f12fb6a0f27aa7df66b2af06b84d
parent = 8847df50c67c19c605f60a109d30556b74d08eee
commit = 05f7e09e919327677454099664656e681f755ee5
parent = 60e75dbfc3a5c7278e5bf4bf39801ea8fbcf3892
method = merge
cmdver = 0.4.6
2 changes: 1 addition & 1 deletion deps/lightrec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)
project(lightrec LANGUAGES C VERSION 0.9)

list(APPEND LIGHTREC_SOURCES
Expand Down
8 changes: 7 additions & 1 deletion deps/lightrec/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,13 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch)

if (branch_in_ds) {
run_first_op = true;
next_pc = pc + 4;

if (op->i.op == OP_SPECIAL)
next_pc = reg_cache[op->r.rs]; /* TODO: is it the old or new rs? */
else if (op->i.op == OP_J || op->i.op == OP_JAL)
next_pc = (pc & 0xf0000000) | (op->j.imm << 2);
else
next_pc = pc + 4 + ((s16)op->i.imm << 2);
}

if (load_in_ds && run_first_op) {
Expand Down
7 changes: 7 additions & 0 deletions deps/lightrec/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,13 @@ static int lightrec_transform_branches(struct lightrec_state *state,

switch (op->i.op) {
case OP_J:
if (is_delay_slot(block->opcode_list, i)) {
/* Jumps in delay slots cannot be converted to
* branches, as they have a different behaviour
* there. */
continue;
}

/* Transform J opcode into BEQ $zero, $zero if possible. */
offset = (s32)((block->pc & 0xf0000000) >> 2 | op->j.imm)
- (s32)(block->pc >> 2) - (s32)i - 1;
Expand Down

0 comments on commit 2476185

Please sign in to comment.