Three changes, one intent: bare `make` and bare cmake now build the C89
emitter with nothing to specify, and common/emitter contains only the six
headers the recompilers actually use (c89emit.h, x86emitter.h, x86types.h,
instructions.h, legacy_instructions.h, x86emitter_shim.h).
Default flip. Makefile gains `C89_EMITTER ?= 1` -- set BEFORE the
Makefile.common include, because the source exclusion there reads it. The
first attempt set it next to the CXXFLAGS append at line 839, after the
include: the define applied but the exclusion never fired, and the build
went on linking reference objects it no longer needed. Caught by `make -n`
grep: a bare plan now names zero reference objects, a C89_EMITTER=0 plan
names all eight. CMake's option defaults to ON with the same semantics
(-DC89_EMITTER=OFF for the reference).
Reference headers. internal.h, legacy_internal.h and the thirteen-header
implement/ tree move to tests/emitter/reference beside the sources that
need them. internal.h now includes the implement set itself -- it is the
reference implementation's own root and must be self-sufficient; x86types.h
includes them only under the reference configuration, for the extern
declarations in instructions.h's #else branches. The three G*Type operator
enums move into x86types.h: recompilers name their values, which makes them
API, not implementation. iR5900-32.cpp's MOVQ-workaround include of
internal.h was already reference-gated and is repointed. cmake's installed-
header list is repointed too (the stale entries failed configure).
Legacy jump API. The fourteen rel8/rel32 wrappers become macros over two
static helpers (J8Rel, J32Rel), matching the C89 core's idiom. The helpers
are static -- internal linkage per TU -- so there is no header-linkage
subtlety left to get wrong, where the previous inline definitions carried
one. The speculative conditional mode initially drafted into J32Rel was
removed before commit: only the unconditional form has callers.
The legacy SSE C-API wrappers (SSE_MINSS_XMM_to_XMM and friends) now emit
through E_SSE_RR directly instead of hopping through the C++ shim objects.
Their constants are proven end-to-end in newbind: reference function vs
C89 macro across all register pairs, 2,048 cases within the 110,070 total.
Verified: six suites green, switchover identical, both compile gates 31/31
in both configurations, bare make links at 11,351,104 bytes with zero
reference encoder symbols and boots, cmake configure passes in both
configurations. The cmake three-target build has not completed in this
container (cmake 4 needs -DCMAKE_POLICY_VERSION_MINIMUM=3.5 for the
vendored cpuinfo; GL dev packages were also missing) -- it needs one run on
a normally-provisioned machine. C89_EMITTER=0 static: the gates and suites
compile and byte-verify that configuration; its last full link ran two
commits ago unchanged.
common/emitter is now headers-only. The eight reference .cpp files move via
git mv to tests/emitter/reference, beside the oracles that compare against
them; their includes are repointed to project-relative paths. Both build
systems change together: Makefile.common lists them from the new path under
ifneq (C89_EMITTER, 1), and CMake gains a C89_EMITTER option (top-level)
with the same exclusion in common/CMakeLists.txt.
The exclusion flushed out three dependency classes the previous builds had
hidden, because until now the reference objects always linked:
x86Ptr / g_xmmtypes lived in x86emitter.cpp; now C++17 inline
thread_local definitions in x86types.h
legacy jump API JMP8/JZ8/.../JMP32 -- raw byte writers shared by
both emitters, moved verbatim inline into
legacy_instructions.h with explicit `inline`
(__fi is empty on MinGW and cannot carry ODR
linkage for header definitions)
legacy SSE wrappers SSE_MINSS_XMM_to_XMM etc., used by the FPU
recompilers: defined under the flag at global
scope in legacy_instructions.h over the bound
xMIN/xMAX/xADD/xSUB objects. The first attempt
put them inside namespace x86Emitter, where the
callers could not see them; the compile gate
caught it.
Verification from the new layout: all six byte suites green (423,556 cases
total), switchover identical, both compile gates 31/31 in both configs --
the gate now compiles the relocated reference sources too. Clean switched
static build links at 11,351,104 bytes (343 KB smaller than with the
reference compiled in), contains zero reference encoder symbols by nm, and
boots. Clean default static build from the new source location links at
11,114,392 bytes and boots.
CMake status, stated plainly: configure was exercised to the point of
failing on this container's missing OpenGL dev packages -- an environment
gap upstream of anything this patch touches. The C89_EMITTER option and
source-list edits are structurally parallel to the Makefile changes that
did pass end-to-end, but a cmake build of common, pcsx2 and pcsx2_libretro
has not completed here and still needs a run on a machine with GL headers.