Skip to main content
Dolphin emulates the PowerPC 750CL (GameCube) and Broadway (Wii) processors using multiple execution backends optimized for different scenarios.

PowerPC Architecture

The emulated CPUs are 32-bit RISC processors: Location: Source/Core/Core/PowerPC/

Execution Backends

Dolphin offers multiple CPU emulation modes in PowerPC/:
Location: PowerPC/Jit64/Default on x86-64 platforms. Compiles PowerPC code to native x86-64:
  • Block-level compilation with register allocation
  • Fastmem for direct memory access (when MMU allows)
  • Paired-single optimization using SSE/AVX
  • Fastest execution (5-10x interpreter speed)
The JIT handles:
  • Branch folding and block linking
  • Constant propagation
  • Register caching across instructions
  • Special handling for common idioms

JIT Compilation Process

The JIT operates on blocks of PowerPC code:
1

Block Discovery

Identify a basic block starting at PC
  • Follow instructions until branch/return
  • Respect block size limits
  • Check for compiled block in cache
2

Analysis

Analyze PowerPC instructionsFile: PowerPC/PPCAnalyst.cpp
  • Detect register usage
  • Find memory access patterns
  • Identify idle loops (for skip-idle optimization)
  • Determine instruction dependencies
3

Compilation

Generate native code
  • Allocate registers for PowerPC GPRs/FPRs
  • Emit x86-64/ARM64 instructions
  • Insert memory access trampolines
  • Add exception handling
4

Linking

Connect blocks together
  • Link direct branches between compiled blocks
  • Fast dispatch without dispatcher overhead
  • Invalidate on SMC (self-modifying code)

Register Mapping

PowerPC has extensive register state:
The JIT maps frequently-used registers:
  • r1 (stack pointer) → native register when possible
  • r13 (small data area) → cached
  • f0-f31 → x87/SSE registers or stack

Memory Management Unit

Location: PowerPC/MMU.cpp Translates virtual addresses to physical:
PowerPC uses segmented memory model:
  1. Segment lookup: Translate EA (effective address) to VA (virtual address)
  2. Page table lookup: Translate VA to PA (physical address)
  3. TLB caching: Translation Lookaside Buffer speeds up lookups
On x86-64/ARM64 with MMU disabled or known-safe access:
  • Direct pointer to emulated RAM
  • No translation overhead
  • Trap SIGSEGV/EXCEPTION_ACCESS_VIOLATION for bounds checking
  • 10x faster than full MMU emulation
Enabled automatically when safe.
Block Address Translation for large mappings:
  • 4 instruction BATs (IBAT0-3)
  • 4 data BATs (DBAT0-3)
  • Map large regions (128 KB - 256 MB)
  • Used by games for main RAM, I/O

Paired Singles

GameCube/Wii extension for SIMD floating-point:
Common instructions:
  • ps_add, ps_sub, ps_mul - Paired arithmetic
  • psq_l, psq_st - Quantized loads/stores
  • ps_merge00, ps_merge01 - Shuffle operations
The JIT optimizes paired-singles using:
  • x86-64: SSE instructions (2x floats per XMM register)
  • ARM64: NEON instructions (2x floats per vector)

Gekko/Broadway Differences

Wii (Broadway) is mostly identical to GameCube (Gekko):
The main difference is clock speed and cache size. No new instructions were added.

Performance Optimization

Idle Skipping

Detect idle loops waiting for interrupts:
When detected:
  • Skip ahead to next event
  • Save thousands of CPU cycles
  • Enabled with SkipIdle = True

Branch Following

Compile through unconditional branches:

Register Allocation

Keep PowerPC registers in native registers:
  • Avoid memory loads/stores
  • Track liveness across block
  • Spill least-used registers

Debugging CPU Emulation

Tools for CPU debugging:
In debugger:
  • Set breakpoints on PowerPC addresses
  • Step through PowerPC instructions
  • Inspect GPR/FPR register values
  • View disassembly
Location: Source/Core/Core/Debugger/

See Also