sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
shortloop_scan Namespace Reference

Variables

 OBJDUMP = sys.argv[1]
dict BRANCHES
dict JUMPS = {"j", "jal", "jr", "jalr", "b", "bal", "eret", "syscall", "break"}
 out = subprocess.run([OBJDUMP, "-d", elf], capture_output=True, text=True).stdout
 sections
 ins = []
 func = m.group(2)
 member = line.split(":")[0]
 m = re.match(r"^([0-9a-f]+) <(.+)>:$", line)
int hazards = 0
dict index = {a: i for i, (a, _, _, _) in enumerate(ins)}
 t = re.search(r"([0-9a-f]+) <", args)
 target = int(t.group(1), 16)
tuple n = (addr - target) // 4 + 2
 body = ins[index[target]:i]
 slot = ins[i + 1]

Detailed Description

Usage: shortloop_scan.py <objdump> <elf or .a>...

Lists R5900 short-loop erratum hazards in EE code: a conditional branch back over 6 or fewer instructions
(branch and delay slot included), no other branch or jump inside, and a delay slot that is not a nop.

Variable Documentation

◆ body

shortloop_scan.body = ins[index[target]:i]

Definition at line 51 of file shortloop_scan.py.

◆ BRANCHES

dict shortloop_scan.BRANCHES
Initial value:
= {"beq", "bne", "blez", "bgtz", "bltz", "bgez", "beqz", "bnez", "bc1t", "bc1f", "beql", "bnel", "blezl",
"bgtzl", "bltzl", "bgezl", "bc1tl", "bc1fl", "bltzal", "bgezal", "bc0t", "bc0f"}

Definition at line 12 of file shortloop_scan.py.

◆ func

shortloop_scan.func = m.group(2)

Definition at line 18 of file shortloop_scan.py.

◆ hazards

int shortloop_scan.hazards = 0

Definition at line 36 of file shortloop_scan.py.

◆ index

dict shortloop_scan.index = {a: i for i, (a, _, _, _) in enumerate(ins)}

Definition at line 38 of file shortloop_scan.py.

◆ ins

list ins = []

Definition at line 18 of file shortloop_scan.py.

◆ JUMPS

dict shortloop_scan.JUMPS = {"j", "jal", "jr", "jalr", "b", "bal", "eret", "syscall", "break"}

Definition at line 14 of file shortloop_scan.py.

◆ m

shortloop_scan.m = re.match(r"^([0-9a-f]+) <(.+)>:$", line)

Definition at line 27 of file shortloop_scan.py.

◆ member

shortloop_scan.member = line.split(":")[0]

Definition at line 18 of file shortloop_scan.py.

◆ n

tuple shortloop_scan.n = (addr - target) // 4 + 2

Definition at line 48 of file shortloop_scan.py.

◆ OBJDUMP

shortloop_scan.OBJDUMP = sys.argv[1]

Definition at line 11 of file shortloop_scan.py.

◆ out

shortloop_scan.out = subprocess.run([OBJDUMP, "-d", elf], capture_output=True, text=True).stdout

Definition at line 17 of file shortloop_scan.py.

◆ sections

shortloop_scan.sections

Definition at line 18 of file shortloop_scan.py.

◆ slot

shortloop_scan.slot = ins[i + 1]

Definition at line 54 of file shortloop_scan.py.

◆ t

shortloop_scan.t = re.search(r"([0-9a-f]+) <", args)

Definition at line 42 of file shortloop_scan.py.

◆ target

shortloop_scan.target = int(t.group(1), 16)

Definition at line 45 of file shortloop_scan.py.