Releases: llvm-mos/llvm-mos-sdk
SDK v0.7.1
New Targets
- #51
cx16
— Commander X16. Partial support was previously available through the c64 target, but this target adds native support.
Bug Fixes
-
llvm-mos/llvm-mos#213 —
-mcpu=
now produces an error when an incorrect CPU type is given. -
The NES status registers are now unsigned. The cc65 definitions were signed due to an obscure cc65-specific codegen issue.
-
#69 — The
PEEK
andPOKE
macros imported from cc65 now usevolatile
. Previously, the compiler may have optimized them away. -
#73 — The MEGA65 target now uses the
mos65ce02
CPU type. Previously, this was the defaultmos6502
, which restricted functionality to that avaiable on a vanilla NMOS 6502.
Miscellaneous
-
The SDK was relicensed to use the Apache License v2.0 with LLVM Exceptions. Previously, it did not include the LLVM exceptions, which technically required that distributions of binaries compiled against the SDK include a copy of the Apache License.
-
Upstream LLVM was merged at 65923012b3.
SDK v0.7.0
Breaking Changes
- llvm-mos/llvm-mos#209: LLVM-MOS specific optimization passes are now generally disabled at -O0, just like regular optimization passes. These passes ignored optimization level for simplicity sake, but now they don't. This means that functions compiled at -O0 will use soft stacks and won't allocate zero page (other than the regular use of imaginary registers).
- The hardware register definitions from cc65 were ported for all supported platforms. Conflicting functionality in the SDK was replaced with its cc65 equivalent.
New Features
- cc65's
peekpoke.h
was ported to the SDK.
Bug fixes
- llvm-mos/llvm-mos#208: The CLD instruction at the beginning of a C interrupt handler was placed after the stack was adjusted. Since adjusting the stack requires an addition, the result of the addition may have been incorrect.
- llvm-mos/llvm-mos#206: There were two cases where the compiler would produce incorrect assembly. This only affected assembly output, since clang goes directly from C to machine code. If assembled later, the first case would fail, and the second would assemble to a different opcode than was emitted.
- DODO API functions no longer prevent the allocation of ZP. Linker script support was also fixed.
Optimizations
- llvm-mos/llvm-mos#210: Zero page locations can now be allocated to functions that appear to recurse in the call graph, but are known for other reasons not to ever recurse. For example, for main in C++ to recurse is undefined behavior, so it can now always allocate ZP.
SDK v0.6.0
Breaking changes
- (Missed in previous release) The default
c.ld
linker script now requires that azp
memory region be available. It can be of size zero.
New Features
Whole-program automatic zero page allocation
The C compiler now automatically allocates global variables/constants, function local variables, and callee-saved registers to function-specific zero page locations whenever possible. Each SDK target uses the new -mlto-zp=<xxx>
flag to set the number of bytes of contiguous zero page available for use by the compiler. The compiler then estimates the benefit of assigning each possible candidate to that zero page region, then greedily assigns them until the available zero page is consumed. The new -mreserve-zp=<xxx>
flag can reduce the number of bytes of zero page reserved for compiler use, allowing programmer use of the zero page outside of C's automatic assignment. Such zero page regions sections still be recorded and placed by the linker (that is, not by directly manipulating pointers <256), otherwise, they risk conflicting with compiler-allocated zero page.
As with static stack frames, the zero page regions used by different functions can overlap if the compiler can prove that the functions can never simultaneously be active. Given the relatively large amount of zero page available in our current targets, we've observed that a considerable portion of most program's working set can now fit entirely within the zero page.
Bug fixes
- Fixed an issue where function pointer usage could cause static stack frames of functions to inappropriately overlap.
- The presence of the
.zp.rodata
section will now also cause data to be copied to the zero page at program startup, just like.zp.data
.
SDK v0.5.1
New Features
Zero Page Sections
The SDK now supports placing sections in the available zero page for all supported targets. To be placed by the target linker scripts, zero page sections must begin with the prefix .zp
. By default, sections placed here will be uninitialized at program load time, the semantics are equivalent to the .noinit
section in main memory. If a zero page section is prefixed by .zp.bss
, the program will initialize it with zeroes at startup, like with .bss
. If it is instead prefixed by .zp.data
, then the contents of the section will be copied into the zero page at startup, like with .data
on ROM targets. Note that the copy routines aren't particularly well optimized yet; they just use the 16-bit memcpy, pending further work on the C side for supporting zero page addressing.
Bug Fixes
- Fixed internal compiler error where multi-byte increment pseudoinstruction might escape lowering.
- Fixed inline assembly constraint
R
in clang; added operand size checking forc
andv
.
SDK v0.5.0
Breaking changes
- The
mosw65ce02
CPU type was renamed tomos65ce02
.
New targets
New features
- The assembler and disassembler now support 65CE02 opcodes. This includes the remaining 65C02 opcodes as well. Thanks @mlund !
Bug fixes
- Fixed issue with tail duplication in
-O3
where increment and decrement operations could lose their tied operands, leading to incorrect code generation. - llvm-mos/llvm-mos#200: Fixed error that occured whenever an integer constant >32767 was used with the
i
inline assembly predicate.
SDK v0.4.0
Breaking changes
- Responsibility for setting
--gc-sections
has been moved from the SDK to the compiler driver. Compiling against themos
target using theclang
family of commands now defaults to--gc-sections
. This can still be disabled manually on the command line and in the SDK via--no-gc-sections
.
New Features
c
andv
are now suppored as inline assembly constraints to specify that a boolean value should be placed in the C or V flag, respectively.
Bug fixes
- Libcalls in the SDK that are compiled outside of LTO and that can be called an interrupt handler no longer use static stack.
Optimizations
- Redundant immediate load instructions are now opportunistically re-written to the
T__
family of transfer instructions. This saves one byte of space. - The register coalescer can choose to rematerialize constant loads instead of copying them to a new register. Previously, these rematerialized loads would use a tighter register class than is required, which can lead to additional copies as the register allocator attempts to satisfy it. The register class constraint has now been loosened, which can help the register allocator to keep these values alive, in particular, for the entirety of loops.
SDK v0.3.4
New Targets
New Features
Arbitrary sized integers
The compiler now supports the C23 candidate types _BitInt(n)
and _UnsignedBitInt(n)
for integers of arbitrary width. Note that this feature isn't all that well tested; if you run into any problems, please let us know.
Other Improvements
- NES targets now have KEEP by default for CHR-ROM, so it's no longer necessary to add the retain flag to sections.
- The NES-SLROM linker script now supports CHR-ROM.
SDK v0.3.3
New Compiler Features
-fno-static-stack
can now be used to disable static stacks for a given translation unit, forcing usage of dynamic stacks for each function.
New Target Features
- OSI target now supports
getchar
.
Optimizations
- Static stack frames can now overlap if the compiler can prove that the corresponding functions can never simultaneously be active. This brings static stack memory usage down in line with that expected of the worst-case dynamic stack frame a program can reach.
- Pointer increments are now correctly moved below the last usage of the pointer, wherever possible.
- Multi-byte increments are now folded together with comparisons to zero wherever possible. This allows eliding the high part of the comparison in most cases.
- Improvements to loop optimization's cost model.
SDK v0.3.2
New Targets
osi-c1p
— Ohio Scientific Challenger 1P, thanks @smuehlst!
SDK v0.3.1
Bug Fixes
- Fixed llvm-mos/llvm-mos#182, where xex files would be produced with invalid header addresses.
- Fixed llvm-mos/llvm-mos#179, where the printf %p specifier would print an incorrect address.
- Fixed SDK build with CMake v3.18 (llvm-mos/llvm-mos#177); made minimum version consistently 3.18, rather than varying per-file.