Skip to content

Releases: llvm-mos/llvm-mos-sdk

SDK v0.6.0

27 Jul 15:52
Compare
Choose a tag to compare

Breaking changes

  • (Missed in previous release) The default c.ld linker script now requires that a zp 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

19 Jul 15:06
Compare
Choose a tag to compare

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 for c and v.

SDK v0.5.0

10 Jul 03:55
664baf5
Compare
Choose a tag to compare

Breaking changes

  • The mosw65ce02 CPU type was renamed to mos65ce02.

New targets

  • mos-dodo: The Dodo 6502 portable game system. Thanks @atn34 !

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

05 Jul 23:35
Compare
Choose a tag to compare

Breaking changes

  • Responsibility for setting --gc-sections has been moved from the SDK to the compiler driver. Compiling against the mos target using the clang 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 and v 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

28 Jun 05:44
Compare
Choose a tag to compare

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

20 Jun 03:52
4fd5ae0
Compare
Choose a tag to compare

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

28 May 19:41
91cd402
Compare
Choose a tag to compare

New Targets

  • osi-c1p — Ohio Scientific Challenger 1P, thanks @smuehlst!

SDK v0.3.1

10 May 09:48
Compare
Choose a tag to compare

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.

SDK v0.3.0

23 Apr 17:21
Compare
Choose a tag to compare

Breaking Changes

  • The Clang driver now automatically adds -Tlink.ld to the linker command line. This responsibility has been removed from the SDK's Clang config files.

New Features

  • The 6502 simulator now supports a --profile flag, which prints out the total number of cycles executed for observed value of the program counter. This can be used in concert with llvm-symbolizer to produce source-level profiling.

Bug Fixes

  • The nes-slrom target now correctly copies .data segment initializers from ROM to RAM.

Optimization

  • The copy-around optimization had been accidentally disabled when switching to multi-byte increment and decrement pseudo-instructions. Repairing the optimization provided a good performance gain on most benchmarks, with a couple modest regressions.

Cleanup

  • Changes from upstream LLVM were merged.
  • __rc0 is set directly in linker scripts, not PROVIDEd.

SDK v0.2.3

15 Apr 02:04
Compare
Choose a tag to compare

New Platforms

  • nes-nrom-256. NES-ROM-256 board. Like NROM-128, but with 32 KiB (256Kib) of PRG-ROM.
  • nes-slrom. Support for NES-SLROM board. This board uses the MMC1 mapper chip, and unlike NROM, supports banking.
    • Supports 256 KiB of PRG-ROM. All C code is placed in bank 15, which is active on power on.
    • Supports 128 KiB of CHR-ROM.
    • No libraries for manipulating the banks are included yet; this will come in a future release.

New Features

  • INCLUDE statements can now be used inside custom OUTPUT_FORMAT { } blocks in linker scripts.
  • NES targets and users can now specify arbitrary modifications to the iNES 2.0 header by setting global symbol values. See ines.ld for details.