292 Commits
Author SHA1 Message Date
Irmen de Jong 973e180108 m68k: struct defs now as RS blocks in the .asm instead of hand calculated EQUS 2026-11-15 21:57:32 +01:00
Irmen de Jong b757932159 6502: fix 65C02 paired-store index and slow-store lint 2026-11-15 16:39:07 +01:00
Irmen de Jong 52bde28ede 6502: Reuse pointers across adjacent memory stores 2026-11-15 05:24:20 +01:00
Irmen de Jong 80a055508f 6502: Hoist repeated loads across indexed stores 2026-11-15 04:33:42 +01:00
Irmen de Jong 5feeadf4c8 6502: Avoid stack saves for constant numeric-base stores 2026-11-15 03:58:43 +01:00
Irmen de Jong 7f743cba1c Optimize 6502 constant-base byte-indexed accesses 2026-11-15 03:46:58 +01:00
Irmen de Jong 37546f8e76 m68k: schedule hardware-register call argument moves
Replace the register allocator constraint that kept argument source vregs
out of other arguments' target slots with a proper move scheduler in
translateCall. Moves are emitted once their destination no longer holds a
pending source; cycles are broken by staging a source through a D0/D1
scratch register, falling back to an aligned stack temporary when both are
call arguments.

This makes hardware-register argument passing correct regardless of the
allocator's choices. Adds tests covering a D3/D2 swap and the stack-temp
fallback, and drops the now-obsolete allocator test and TODO entry.
2026-11-11 18:49:07 +01:00
Irmen de Jong 2efa8ea03f Avoid duplicate struct-array instances in M68k output
related to ee2aa9e215
2026-11-10 23:15:54 +01:00
Irmen de Jong ee78eb583e Reject native %asm on the virtual target at compile time 2026-11-10 11:41:05 +01:00
Irmen de Jong 21834a9a3d fix an inliner issue regarding register specified parameters 2026-11-09 00:43:25 +01:00
Irmen de Jong db5352bc0c m68k: recognise RTE as an instruction that returns from a (interrupt handler) subroutine 2026-11-05 17:23:02 +01:00
Irmen de Jong 2508b0a9f4 if-expressions are now const folded too
fix invalid a0 instruction
2026-11-03 20:17:52 +01:00
Irmen de Jong 5f3239d811 default no longer include all IR debug lines into the m68k asm file 2026-11-03 15:30:30 +01:00
Irmen de Jong 72b322e2f4 Extract single status-flag returns before register returns
A multi-assign returning one status flag plus register values used to
read the registers first, wrapped in PUSHST/POPST. That crashes the
68000 backend, which cannot save/restore CCR, and wastes two
instructions everywhere else. Extract the flag first instead: nothing
can clobber the status bits before it is captured, so no
preservation is needed. Multi-flag calls keep the old behavior.
2026-11-01 16:50:20 +01:00
Irmen de Jong 219545d9fc amiga display calc 2026-11-01 05:12:01 +01:00
Irmen de Jong 119a499819 m68k: promote eligible locals and parameters to vregs 2026-10-27 05:59:39 +01:00
Irmen de Jong 5daa4bd613 Merge branch 'master' into m68k-register-alloc
# Conflicts:
#	codeGenM68k/src/prog8/codegen/m68k/AsmOptimizer.kt
#	codeGenM68k/src/prog8/codegen/m68k/InstrArithmetic.kt
#	codeGenM68k/src/prog8/codegen/m68k/InstrBitwise.kt
2026-10-27 01:09:06 +01:00
Irmen de Jong fd2fac847a fix bug in new 6502 codegen, make c64 sprite examples more robust regarding sprite data memory addresses 2026-10-26 21:45:05 +01:00
Irmen de Jong 4427f986cc fuse extending loads into single IR load opcodes
add 8 IR opcodes (LOADMZ/LOADMS/LOADMZL/LOADMSL and the indexed
LOADI variants) and a peephole fusion pass that replaces
loadm/indexload followed by ext/exts/extl/extls with a single
extending load. Implemented for m68k, new6502 and the VM; run
deduplicateAddressComputations before fusion so it still sees the
unfused loadm+ext pairs.
2026-10-26 21:12:11 +01:00
Irmen de Jong de2be995ca m68k regalloc stage 4: cleanup 2026-10-22 19:43:24 +02:00
Irmen de Jong b820d32507 m68k: fix spill-slot alignment after vreg reuse and complete clobber audit
appendSpillSlotsToFrame() now builds a per-subroutine type map because
renumberVregsPerSubroutine() reuses vreg numbers across subroutines with
different types. Using the global virtualRegisterTypes map caused spilled
pointer vregs to be sized as byte/word, producing unaligned stack slots
like -9(a5) and crashing 68000 / corrupting saved registers on 68020.
2026-10-22 19:43:24 +02:00
Irmen de Jong 808cdc0464 add m68k golden harness test 2026-10-22 19:43:23 +02:00
Irmen de Jong fba4bb5272 6502 codegen bug: subtraction with a register-clobbering right operand 2026-10-16 00:58:49 +02:00
Irmen de Jong 460adb9e02 Remove Exec-specific for-loop over linked lists, disallow pointer as struct field name 2026-10-13 01:01:24 +02:00
Irmen de Jong dfb3257c04 reserve the 'pointer' datatype name, it can no longer be used as a symbol name 2026-10-13 00:00:26 +02:00
Irmen de Jong eda21a6ebf Fix in operator on arrays larger than 255 elements 2026-10-11 02:05:21 +02:00
Irmen de Jong a1a48405b0 m68k: fix a5 frame pointer register clobbering 2026-10-07 19:06:16 +02:00
Irmen de Jong 1f8b42fae5 make user docs and some code comments less convoluted 2026-10-05 20:00:32 +02:00
Irmen de Jong e74c34a5ab fix builtins rejecting a cx16 virtual register as their result register 2026-10-01 02:54:53 +02:00
Irmen de Jong 5222562493 move sqr range check into prog8_math.square instead of inlining it at each call site 2026-09-27 11:49:49 +02:00
Irmen de Jong 9fce07565c some romable tests, fix romable callfar crash and update stale VM label address test 2026-09-25 22:40:36 +02:00
Irmen de Jong 4cbf93da85 fix Status flag extraction clobbers a register return value 2026-09-24 01:00:49 +02:00
Irmen de Jong 976b64185d fix struct size truncation to 256 bytes on targets that allow larger structs (m68k) 2026-09-24 00:22:23 +02:00
Irmen de Jong 2050fcb4ee m68k: emit struct field definitions in the asm 2026-09-23 23:55:57 +02:00
Irmen de Jong 4eaba62f1e 6502 codegen: inline clamp() on word/uword when having compile-time constant bounds 2026-09-23 22:54:57 +02:00
Irmen de Jong bf696bcf5e fix multiple status flag returns in new codegens 2026-09-23 03:10:59 +02:00
Irmen de Jong 34bbb46514 fix a few new6502 codegen bugs 2026-09-23 01:27:40 +02:00
Irmen de Jong f086918e6f add union types: structs where every field is at offset 0, thus saving memory 2026-09-23 00:07:44 +02:00
Irmen de Jong 2d070aaec4 Fix 6502 pointer-field augmented assignment clobbering scratch pointer
Fixes #245
2026-09-21 22:51:11 +02:00
Irmen de Jong ba76fbfe85 fix code generation for "return <void function call>" 2026-09-17 22:39:53 +02:00
Irmen de Jong 9621552056 add 'arena' allocator library
6502 targets use uword sizes with no alignment overhead; m68k/virtual use
long sizes with even-address alignment. Updated the six pointer examples that used to have their own arena implementation.
2026-09-13 05:43:57 +02:00
Irmen de Jong 5685a1f229 6502: tighter for loop code for word and long loop vars 2026-09-13 04:29:59 +02:00
Irmen de Jong dbba6a94fa Merge branch 'v12maintenance'
# Conflicts:
#	codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
#	compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt
#	compiler/test/ast/TestVariousCompilerAst.kt
#	compiler/test/codegeneration/TestExecution6502.kt
#	examples/test.p8
#	gradle.properties
2026-09-10 21:45:47 +02:00
Irmen de Jong af06fdfffc fix more 6502-only struct pointer-field bugs; add indexed in-place support
fixes #237
2026-09-10 19:20:02 +02:00
Irmen de Jong e811ecdbde fix 6502 struct pointer-field array indexing 2026-09-09 23:47:09 +02:00
Irmen de Jong bd0457f262 Allow const expressions for 2D array dimensions (not just numeric literals) 2026-09-08 23:13:54 +02:00
Irmen de Jong ce2b298d6f code cleanups 2026-09-08 22:36:54 +02:00
Irmen de Jong 9a461628f2 Merge branch 'v12maintenance' 2026-09-02 19:14:57 +02:00
Irmen de Jong c8f309307f fix inlining bug: subroutines with register-mapped parameters cannot be inlined 2026-09-02 19:10:21 +02:00
Irmen de Jong b702ea50da no longer mangle inline asm that uses pipe operator (in other spots that is used as an instruction separator...) 2026-09-02 02:02:53 +02:00