Releases: llvm-mos/llvm-mos-sdk
Releases · llvm-mos/llvm-mos-sdk
SDK v12.0.0
Breaking changes
- llvm-mos/llvm-mos@9a4523b -- Make all types prefer
int
toshort
- This follows AVR, and it make int promotions work more like expected.
size_t
is nowunsigned int
, wasunsigned short
ptrdiff_t
is nowsigned int
, wassigned short
intptr_t
is nowsigned int
, wassigned short
char16_t
is nowunsigned int
, wasunsigned short
wint_t
is nowsigned long
, wasunsigned long
(now accomodates a -1
WEOF
)
- This follows AVR, and it make int promotions work more like expected.
- 1475f49 -- Targets should now implement the default
SIGABRT
handler__sigabrt()
instead ofabort()
.abort()
now invokesraise()
as required by the standard. - ea8aea8 - Break character conversion out of
__putchar
into__char_conv
__putchar
now simply outputs to the target equivalent of file descriptor
zero; it no longer converts to the target character set. Accordingly,__putchar
now replaces__chrout
on most targets;__chrout
has been removed. Character conversion functionality has been moved to a new__char_conv
.
- 72e3379 -- Translate to shifted PETSCII at runtime; shift on startup if translation used.
- This is likely to be a bit controversal; see the commit message for a detailed rationale. The jist is that the language of the standard essentially requires that outputting characters in our execution character set (ASCII) to the screen display their normal representation, as far as is possible. For the C64, that means shifting the character set. Accordingly, we do this in a constructor tied to the inclusion of
__char_conv
.
- This is likely to be a bit controversal; see the commit message for a detailed rationale. The jist is that the language of the standard essentially requires that outputting characters in our execution character set (ASCII) to the screen display their normal representation, as far as is possible. For the C64, that means shifting the character set. Accordingly, we do this in a constructor tied to the inclusion of
- 597971d -- Translate to ATASCII control codes
- Similar to the above, but probably less controversal. ASCII
'\t'
,'\a'
, and'\b'
are now translated at runtime to their ATASCII equivalents. - #300 - Normalize Atari cartridge target naming - @cwedgwood
atari5200-super
is nowatari5200-supercart
(Super Cart cartridge)atari8-stdcart
is nowatari8-cart-std
(Standard cartridge)atari8-xegs
is nowatari8-cart-xegs
(XEGS catridge)atari-mega
is nowatari8-cart-megacart
(Megacart cartridge)
New features
- llvm-mos/llvm-mos#442 - Lower
fptoui.sat
andfptosi.sat
saturating float to integer intrinsics- Lowers them to
fmax
andfmin
, which aren't yet implemented. Still, the compiler no longer crashes.
- Lowers them to
- 8d67b8d -- Add a stub for
getenv
- 81161eb -- Add a stub for 'system'
- 1475f49 -- Add a minimal
<signal.h>
- c0f1c7a -- Add
qsort
- 2f99463 -- Add
bsearch
- 543b5a9 -- Finish
<string.h>
(addstrcspn
andstrstr
). - #294 - Add all remaining RP6502 OS calls -- @rumbledethumps
Bug fixes
- llvm-mos/llvm-mos@981c2b6 -- Correct handling of aliases to globals allocated to zero page
- llvm-mos/llvm-mos#422 -- Replace
CMPTerm
thenBR
with a new family ofCmpBr
pseudo-instructions- This fixes a longstanding ugly fragility in the backend, but it required rewriting quite a few routines.
- 90f616f -- Fix
xregn
varargs UB in RP6502 target - c49a529 -- Remove incorrectly coped
.ifdef __ATARIXL__
fromatari.inc
- 3e94be4 -- Nonstandard
strtox
were prefixed with an underscore - 543b5a9 --
strrev
in<string.h>
has been renamed to_strrev
to match Microsoft's current recommendations, and since it's not a standard function. - #296 -- Don't allow inline of Atari
__putchar
, since it usesRTS
trick - @cwedgwood - #297 -- Use
HATABS
for Atari__putchar
- @cwedgwood - #305 -- Add C++
extern "C"
to<rp6502.h>
- @rumbledethumps - #295 -- Remove
va_start
warning from RP6502xregn
- @rumbledethumps
SDK v11.0.0
Breaking changes
- d231325 - Remove
_exit
- This function comes from POSIX, and it's properly part of
<unistd.h>
, which we don't have, not<stdlib.h>
. Accordingly, it was suspect for us ever to have included it, especially since the standard has an equivalent in<stdlib.h>
,_Exit
. Accordingly, all uses of_exit
in the SDK have been rewritten to use_Exit
, and this should be the mechanism defined by new targets going forward.
- This function comes from POSIX, and it's properly part of
New targets
- #293 -- Picocomputer 6502 (RP6502) --
mos-rp6502-clang
-- @rumbledethumps
New library features
- #292 -- Implement
aligned_alloc
.- This is a version of
malloc
that supports a power of two alignment specification. This can be useful when sizes of allocated objects are naturally powers of two, since it allows stashing data in the low bits of pointers to the objects. Plus it's in the C standard ;)
- This is a version of
- ac77ee4 - Implement the
quick_exit
familyquick_exit
allows exiting from the program without running C++ destructors, but while still doing other process-related cleanup. (Once we have astdio
, this will typically mean flushing and closing open files.) It also adds anat_quick_exit
to allow registering callbacks to occur on quick exit (atexit
handlers do not).
Optimizations
- #292 - Rewrite
malloc
- This makes our implementation of
malloc
a standard Knuth boundary tag allocator that allocates in first fit FIFO order. This removes all O(n) operations that except the single first-fit freelist scan; accordingly, free is now constant time instead of O(n). It also removes all heap space overhead except the two byte header permalloc
. The cost is a modestly increased code size and that heap objects are now two-byte aligned.
- This makes our implementation of
Bug fixes
- #289 -- NES GTROM -- Declare
write_ppu
to return void -- @cwedgwood - e61baad -
calloc
now correctly detects integer overflow in its multiplication and returns NULL, rather than producing undefined behavior.
SDK v10.0.0
Breaking changes
- llvm-mos/llvm-mos@2550bb7 - Make
(u)int16_t
(unsigned) int
, not(unsigned) short
.- This has a very fine distinction with little to no runtime effect, but it now follows AVR, and it makes the e.g.
PRI16d
format specifier justd
rather thanhd
. Code is very unlikely to break, but it still seems possible.
- This has a very fine distinction with little to no runtime effect, but it now follows AVR, and it makes the e.g.
New features
- Implemented the all max-width functions in
<inttypes.h>
(except the wide character versions). - a1a8d22 - Implement the
strtox
family of instructions using PDCLib. - 546bf8b - Define
MB_CUR_MAX
from<stdlib.h>
in line with other clang targets. - eaf7bd5 - Implement
atox
family of functions using PDCLib. - 08494f6 - Implement
rand
andsrand
using a 16-bit xorshift.- The implementation is a tradeoff; it's relatively small and fast, and its statistical properties are good for each bit of the output, but it has a short period of 65536. The standard puts no requirements on period, and this is the smallest PRNG I could find with good quality output within its period. We could use a 16-bit add-only LCG, which may be smaller but has worse behavior, or a 32-bit xorshift, which would provide a non-permutation in the low 16 bits returned by
rand()
and a POSIX compliant 2^32 period, but it would be considerably slower and larger.
- The implementation is a tradeoff; it's relatively small and fast, and its statistical properties are good for each bit of the output, but it has a short period of 65536. The standard puts no requirements on period, and this is the smallest PRNG I could find with good quality output within its period. We could use a 16-bit add-only LCG, which may be smaller but has worse behavior, or a 32-bit xorshift, which would provide a non-permutation in the low 16 bits returned by
Bug fixes
- llvm-mos/llvm-mos@10e7734 - Define
__STDC_HOSTED__
to0
; we're not yet a hosted implementation. - 2f0c6cd - Define
__STDC_NO_COMPLEX__
to1
, since<complex.h>
is unavailable. - 885708d - Define
__STDC_NO_ATOMICS__
to1
, since atomics are not yet supported.
Miscellaneous
- Merge from llvm/llvm-project@5f71aa9
SDK v9.1.0
New targets
- #272 - Atari 8-bit MegaCart and SIC! cartridges (
atari8-mega
) - @cwedgwood - #279 - Atari 5200 "Super Cart" target (also supports single 32KiB bank) (
atari5200-super
) - @cwedgwood
New features
- 887ed60 - Implemented
assert.h
Optimizations
- llvm-mos/llvm-mos@3d56785 - Internalize libcalls and run dead code elimination
- This detects ultimately unused functions that were brought into the link in case late code generation needed them. This allows them to be stripped out before they consume valuable static stack or zero page space.
- As a result,
abort
and the floating point libcalls were moved into LTO with the others, allowing them to use the zero page and static stack.
Bug fixes
- llvm-mos/llvm-mos#385 - Added error messages for overlapping inline asm clobbers and input registers
- d0e7823 - Fixed SDK constraint issues uncovered by above
- #277 - Allowed NES GTROM to correctly emit PRG-ROMs smaller than the maximum - @cwedgwood
- cd715b3 - Added missing return value to
strcat
- b071f2e - Preserve NUL characters to repair video character set user-defined C++ literals
- #287 - Remove duplicate entries from VIC20 charset switches - @cwedgwood
Miscellaneous
- Merged from llvm/llvm-project@5f71aa9
SDK v9.0.1
Bug fixes
- #269 - Fixed an off-by-one error in the MMC3 8k banking linker script
- This produced invalid ROMs if PRG-ROM was set to less than the maximum size.
Optimizations
- llvm-mos/llvm-mos#426 - Made compiler default to
-ffunction-sections
and-fdata-sections
when LTO is disabled so that linker garbage collection can work while the libcalls are out of LTO.
Miscellaneous
- Merged from llvm/llvm-project@10f15e2
SDK v9.0.0
Breaking changes
- #258 - Rename
atari8
toatari8-dos
- @cwedgwood
Optimizations
- #259 - Move
atexit
tocxa-atexit.cc
- This prevents references to
stdlib.cc
functions (e.g., calloc) from bringing in the atexit runtime support unnecessarily.
- This prevents references to
Bug fixes
- Prevent NES GTROM mapper from using CHR-ROM
- The original implementation of this mapper always had 16KiB of CHR-RAM, and its mapper, 111, is shared with another Chinese fan translation project. Newer Mesen detect the fan translation by the presence of CHR-ROM, so it's not the case that CHR-ROM GTROM will work across widely-used emulators.
Miscellaneous
- Merged from upstream llvm/llvm-project@c43c86c
SDK v8.1.0
New targets
- #250 - Atari 8-bit XEGS (bank-switched) cartridge support - @cwedgwood
New features
- llvm-mos/llvm-mos#10 - Floating Point Support
- llvm-mos now supports the
float
anddouble
data types, with binary32 and binary64 IEEE 754 implementations, respectively. The soft float library comes from LLVM's compiler-rt, and it isn't very well optimized for the 6502. Printf support may be manually included by passing-lprintf_flt
. Unfortunatly, at present, printf must operate over doubles, and the simulator is the only target large enough to support a full printf implementation. Work is underway to make this smaller. - All relevant llvm-test-suite end-to-end floating-point tests pass.
- llvm-mos now supports the
Optimizations
- llvm-mos/llvm-mos#419 - Strict inlining costs
- The inliner no longer forces inlining to occur when an indirect call can be elided. This happened with printf, which could cause up to a complete printf implementations to be duplicated up to four times.
Bug fixes
- Ignore empty records in ABI: Empty unions could cause the compiler to crash.
Known issues
- The floating point libcalls are huge; this suggests they should be kept out of LTO, since ultimately unused libcalls present in LTO can still end up permanently bringing things in. Unfortunately, libcalls must be either fully included in LTO or fully excluded, since they are implicitly treated as
__attribute__((leaf))
. I opted for the latter, which means that this release regresses performance of large libcalls, since they can no longer use the zero page or static stacks. Work is underway to provide better stripping for unused libcalls, which will allow us to summarily pull in all libcalls to LTO in a future release.
Misc
SDK v8.0.1
Bug fixes
- llvm-mos/llvm-mos#413 - Fixed compiler crash due to new shift chaining optimization.
- Fixed latent issue in register scavenger; it would attempt to scavenge X, but this isn't implemented. Instead, disable ZP, Y addressing to avoid the case.
- Fixed recursive codegen issue uncovered in the register scavenger; since it can run more than once, we need to check if the reserved imaginary save registers are in use before marking a register for scavenging.
- #247 - Fix
pce_joypad_read()
only returning low nibble - @asiekierka
Optimizations
- #248 - Base printf routines on one another. Helps decrease code size when multiple printf variants are used.
Miscellaneous
- #246, llvm-mos/llvm-mos#412 - Add arm64 build target for macOS
- #241 -- Use emutest and libretro to test arbitrary emulators in Github CI (currently only NES and Atari2600 are implemented) - @sehugg
- Merge llvm/llvm-project@f4c6947
SDK v8.0.0
Breaking changes
- #242 - Rename cx16 kernal call
SAVEHL
toBSAVE
-- @XarkLabs- This call was not documented previously, and internal vector was called savehl (save headerless). Now it is documented as BSAVE so this PR renames kernel vector and function to match documentation.
New features
- #244 - Add missing
cbm_k_chkout
KERNAL routine.
Optimizations
- llvm-mos/llvm-mos#408 - Optimize multiplies and chain shifts
- Multiplies by constants are now relaxed into a add or subtract of two shifts, wherever possible.
- Shifts of the same base by different constant amounts in the same direction are now chained off of each other, with lesser amounts occuring "on the way" to greater amount. Code is moved globally within a function to form the chains.
- This also fixes llvm-mos/llvm-mos#268, where a manual add of shifts would be normalized into a multiply, but lacking this backend transform, the multiply would stay all the way to final output.
Bug fixes
- llvm-mos/llvm-mos#381 - Support relative and absolute paths in
-fpost-link-tool
. - llvm-mos/llvm-mos#403 - Don't report function sizes for Mesen label files
- Providing function symbol sizes corrupts the disassembly in Mesen's debugger
- #239 - Various Atari 2600 fixes -- @sehugg
- Fixed zp section overlapping registers.
- Fixed bank selection macros to accept macro parameters.
- Better Stella signature.
- Make
cbm.h
header work when included from C++.
SDK v7.1.0
New targets
Bug fixes
- llvm-mos/llvm-mos#354 - Added error messages for out-of-range relocations
- For compatibility with existing practice, the high two bytes of the 32-bit virtual addresses are ignored for 8-bit and 16-bit addresses.