Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,31 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check the actual CMOC indexed-load peephole rule in a source build."""
|
||||
import argparse
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("source_build", type=Path, help="build.py output's work/cmoc directory")
|
||||
args = parser.parse_args()
|
||||
src = args.source_build.resolve(strict=True) / "src"
|
||||
objects = sorted(path for path in src.glob("cmoc-*.o") if path.name != "cmoc-main.o")
|
||||
if not objects:
|
||||
parser.error("Build CMOC first; compiler objects are required")
|
||||
fixture = Path(__file__).resolve().parent / "optimizer-rule.cpp"
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-cmoc-rule-") as work:
|
||||
out = Path(work)
|
||||
# Retain all normal compiler definitions and rename only its CLI entry
|
||||
# in this extra object. The rule itself comes from unchanged build objects.
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++11", "-Dmain=vccCompilerDriverMain",
|
||||
'-DPACKAGE="cmoc"', '-DVERSION="0.1.100"', '-DPKGDATADIR="."',
|
||||
"-D__unix", "-I", src, "-c", src / "main.cpp", "-o", out / "driver.o"], check=True)
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++11", "-I", src, fixture,
|
||||
out / "driver.o", *objects, "-o", out / "rule-check"], check=True)
|
||||
subprocess.run([out / "rule-check"], check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,42 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Execute indexed-argument-load regressions on both emulated guest CPUs."""
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("runtime", type=Path, help="staged CMOC toolchain")
|
||||
parser.add_argument("core", type=Path, help="libVCCCore.a")
|
||||
parser.add_argument("rom", type=Path, help="locally supplied CoCo 3 ROM")
|
||||
parser.add_argument("--host-arch", choices=("arm64", "x86_64"),
|
||||
help="select a macOS compiler slice (x86_64 uses Rosetta on Apple Silicon)")
|
||||
args = parser.parse_args()
|
||||
fixture = Path(__file__).resolve().parent
|
||||
runtime = args.runtime.resolve(strict=True)
|
||||
compiler = runtime / "bin/cmoc"
|
||||
command = (["/usr/bin/arch", "-" + args.host_arch] if args.host_arch else []) + [compiler]
|
||||
env = dict(os.environ, PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
|
||||
# Same adjacent-element call at runtime indices 0 and 2, using a byte
|
||||
# parameter, word parameter and pointer bases. Expectations are host-owned.
|
||||
pair = (4, 12, 8, 16, 20, 28, 24, 32)
|
||||
expected = "ARGS " + "".join(f"{value:02X}" for value in pair * 3) + " END"
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-indexed-arguments-") as work:
|
||||
runner = Path(work) / "run-compiled"
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
fixture.parent / "run-compiled.cpp", args.core.resolve(strict=True), "-o", runner],
|
||||
check=True)
|
||||
for optimization in ("-O0", "-O2"):
|
||||
print("Checking indexed arguments", optimization, flush=True)
|
||||
subprocess.run(command + ["--coco", optimization, "--no-relocate", "--switch=jump", "--org=2800",
|
||||
"--intermediate", "-Werror", "-o", "TEST.BIN", fixture / "qualification.c"],
|
||||
cwd=work, env=env, check=True)
|
||||
subprocess.run([runner, args.rom.resolve(strict=True), "TEST.BIN", expected],
|
||||
cwd=work, check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Exercise the actual built compiler rule; expose its private entry only in
|
||||
// this test translation unit. Vendor sources and normal objects stay unchanged.
|
||||
#include "util.h"
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#define private public
|
||||
#include "ASMText.h"
|
||||
#undef private
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
void check(const char* first, const char* middleOp, const char* middle, const char* last, bool expectRemoval) {
|
||||
ASMText text(true);
|
||||
text.ins("LDB", first); text.ins(middleOp, middle); text.ins("LDB", last);
|
||||
const bool removed = text.removeUselessLdaOrLdb(0);
|
||||
if (removed != expectRemoval) throw std::runtime_error(std::string(first) + "; " + middleOp + " " + middle + "; LDB " + last);
|
||||
}
|
||||
int main() {
|
||||
try {
|
||||
check("5,U", "LDX", "#array", "D,X", false);
|
||||
check("5,U", "LDX", "#array", "B,X", false);
|
||||
check("5,U", "LDX", "#array", "[D,X]", false);
|
||||
check("5,U", "LDX", "#array", "[B,X]", false);
|
||||
check("5,U", "LDX", "D,Y", ",X", false);
|
||||
check("5,U", "LDX", "B,Y", ",X", false);
|
||||
check("5,U", "LDX", "[D,Y]", ",X", false);
|
||||
check("5,U", "LEAX", "D,Y", ",X", false);
|
||||
check("5,U", "LEAX", "B,Y", ",X", false);
|
||||
check(",S+", "LDX", "#array", ",X", false);
|
||||
check(",--X", "LDX", "#array", ",X", false);
|
||||
check("[,Y++]", "LDX", "#array", ",X", false);
|
||||
check("[,--U]", "LDX", "#array", ",X", false);
|
||||
check("5,U", "LDX", "#array", ",X", true);
|
||||
check("5,U", "LEAX", "4,Y", "4,X", true);
|
||||
std::cout << "PASS indexed-load rule: 13 dependency/side-effect guards, 2 safe removals\n";
|
||||
return 0;
|
||||
} catch (const std::exception& error) { std::cerr << error.what() << '\n'; return 1; }
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include <cmoc.h>
|
||||
|
||||
// Distinct in-range sentinels make a stale loaded value used as a second
|
||||
// subscript visibly wrong, without depending on neighboring globals' layout.
|
||||
static unsigned char joystick_axes[64];
|
||||
static struct { unsigned char centers[64]; } preferences;
|
||||
static unsigned char chosen;
|
||||
|
||||
static void capture(unsigned char x, unsigned char y, unsigned char cx, unsigned char cy)
|
||||
{
|
||||
// Print actual bytes; the host owns all comparisons and expected results.
|
||||
printf("%02x%02x%02x%02x", (unsigned)x, (unsigned)y, (unsigned)cx, (unsigned)cy);
|
||||
}
|
||||
|
||||
static void sampleByte(unsigned char index)
|
||||
{
|
||||
capture(joystick_axes[index], joystick_axes[index + 1],
|
||||
preferences.centers[index], preferences.centers[index + 1]);
|
||||
}
|
||||
|
||||
static void sampleWord(unsigned index)
|
||||
{
|
||||
capture(joystick_axes[index], joystick_axes[index + 1],
|
||||
preferences.centers[index], preferences.centers[index + 1]);
|
||||
}
|
||||
|
||||
static void samplePointer(unsigned char index, const unsigned char *axes, const unsigned char *centers)
|
||||
{
|
||||
capture(axes[index], axes[index + 1], centers[index], centers[index + 1]);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(joystick_axes); ++i)
|
||||
{
|
||||
joystick_axes[i] = 0x35;
|
||||
preferences.centers[i] = 0x3a;
|
||||
}
|
||||
joystick_axes[0] = 4; joystick_axes[1] = 12;
|
||||
joystick_axes[2] = 20; joystick_axes[3] = 28;
|
||||
preferences.centers[0] = 8; preferences.centers[1] = 16;
|
||||
preferences.centers[2] = 24; preferences.centers[3] = 32;
|
||||
printf("ARGS ");
|
||||
// Runtime parameters preserve the original indexed argument expressions.
|
||||
chosen = 0; sampleByte(chosen);
|
||||
chosen = 2; sampleByte(chosen);
|
||||
chosen = 0; sampleWord(chosen);
|
||||
chosen = 2; sampleWord(chosen);
|
||||
chosen = 0; samplePointer(chosen, joystick_axes, preferences.centers);
|
||||
chosen = 2; samplePointer(chosen, joystick_axes, preferences.centers);
|
||||
printf(" END\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user