Skip to content

Releases: llvm-mos/llvm-mos-sdk

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.

SDK v0.2.2

31 Mar 00:34
Compare
Choose a tag to compare

New platforms

  • nes-nrom-128. Contains a simple PPU support library. Generates an iNES 2.0 file for the NES NROM-128 board.

New features

  • llvm-objdump -d disassembler now shows branch targets using absolute addresses.
  • __do_copy_data symbol reference emitted whenever .data section referenced.
  • copy-data optional library to copy .data segment from ROM to RAM if necessary.
  • exit-loop optional library to exit the program by entering an infinite loop.

Optimizations

  • Placed C runtime constants in .rodata, not .data. Keeps them from being copied.
  • Replaced runtime subtraction in .bss zeroing and .data copying with linker-computed size.

Bugfixes

  • Added barrym95838's BCD behavior corrections to the 6502 simulator.

Refactors

  • libstart renamed to libcrt0.

SDK v0.2.1

19 Mar 19:23
Compare
Choose a tag to compare

New features

Custom output formats in linker scripts

A new OUTPUT_FORMAT { } syntax was added to the linker script, and the SDK now takes advantage of it. This allows specifying directly what the bytes of the output file should contain: various header bytes, and portions of the linker's LMA (loaded memory address) space, either zero padded or trimmed to fit. This considerably simplifies defining custom file formats (XEX, iNES, PRG, etc.) over the LMA hacking previously done in the SDK. This mode also causes the corresponding ELF file to be generated with the .elf file extension.
https://llvm-mos.org/wiki/Linker_Script

mos-common target

mos-common was made into a real, but incomplete, target, with it's own library and object files. This makes it easier to port LLVM-MOS to new targets, as it's no longer necessary to hook into the SDK's CMake build system to do so; the common target can be used with crt0.s and C files stashed in a user directory. There's still work to be done to clean up and document the porting process using the common target; this should occur over the next few weeks after this release.

Bug fixes

  • When building the SDK on Mac OS, LLVM-MOS's llvm-ar and llvm-ranlib are now used instead of the system ones.

SDK v0.2.0

08 Mar 05:57
Compare
Choose a tag to compare

Breaking changes

  • Structs 4 bytes or smaller are passed and returned by value rather than by indirect pointer.
  • Renamed a800xl target to atari8

New features

  • C++ type_traits implementation

Optimizations

  • Reduced printf from ~12K to ~5K by replacing div/mod 10 with a simple BCD-like shift and add algorithm.

SDK v0.1.0

25 Feb 18:41
Compare
Choose a tag to compare

This is the first official release of the llvm-mos compiler and SDK.

Documentation for getting started.

What you get

  • Code generation for the Commodore 64, Atari 800, and an included 6502 simulator.
  • The high and low-level optimizations expected of a young-ish LLVM backend
    • Sophisticated register allocation over A, X, Y, and a field of 16 2-byte zero-page (imaginary) registers
    • The imaginary registers can be placed anywhere and need not be contiguous.
    • The calling convention passes through registers whenever possible.
    • Loop optimizations to select 6502 addressing modes
    • Whole program "static stack" optimization
      • Automatically identifies non-reentrant functions and allocates their frames as static globals
      • Programs without recursion or complex function pointers may not need a soft stack at all.
      • No manual annotations required
    • Link time inlining and optimization across the whole program
      • Includes SDK libraries. Library calls can be often optimized away completely!
  • Broad C99 and C++11 freestanding standards compatibility
    • Interrupt handling
    • C++ templates
    • C++ virtual functions
    • C++ new/delete
    • C++ Run-Time Type Information (dynamic_cast, typeid)
    • C++ static constructors/destructors (run before and after main)
    • C++ "magic" function local static constructors/destructors
  • Excellent compiler usability
    • Clang's world-class error messages
    • IDE integration through the included custom clangd's Language Server Protocol
    • Straigtforward invocations to compile for various targets: mos-c64-clang++ -Os -o game.prg game.cc
  • A small standard library sufficient to provide the above and a few extras
    • Simple printf
    • Simple malloc/free
    • exit, _Exit, and atexit
  • An ELF file format implementation
    • All the usual POSIX tools for working with object files: readelf, nm, etc.
    • A GAS-compatible assembler for the 6502 with a complete macro system
  • A lld linker implementation for the 6502
    • All the usual trimmings of an ELF lld backend
      • Link-time garbage collection
      • Symbol map exports
      • Linker scripts
      • GCC ld compatibility

What you don't get

  • C99 requires supporting 64KiB locals, sorry, no can do.
  • A hosted C with all the standard library bells and whistles.
  • Float/double
  • C++ Exceptions