Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for LLVM 19 #4435

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Add support for LLVM 19 #4435

merged 1 commit into from
Jan 20, 2025

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Aug 25, 2024

This is incomplete. I've only made this so that we have a LLVM 19 branch ready to go once LLVM 19 is released (and the Xtensa fork has been rebased).

I will make a new PR once it is ready.

Some things that need to be resolved:

Copy link

github-actions bot commented Aug 25, 2024

Size difference with the dev branch:

Binary size difference
not the same command!
    tinygo build -size short -o ./build/test.bin -target=m5stamp-c3          ./examples/ws2812
    '-xesppie' is not a recognized feature for this target (ignoring feature)
 flash                          ram
 before   after   diff          before   after   diff
 263712  263408   -304  -0.12%   46748   46748      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/slideshow
  67932   67668   -264  -0.39%    6360    6360      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/i2c/main.go
  68468   68212   -256  -0.37%    6504    6504      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/uart/main.go
  75640   75448   -192  -0.25%    7448    7448      0   0.00% tinygo build -size short -o ./build/test.hex -target=p1am-100 ./examples/p1am/main.go
  27224   27104   -120  -0.44%    3632    3632      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/microbitmatrix/main.go
  26144   26032   -112  -0.43%   16412   16412      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/waveshare-epd/epd2in66b/main.go
  68656   68560    -96  -0.14%    6188    6188      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp2515/main.go
  57532   57436    -96  -0.17%    3692    3692      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht4x/main.go
  16720   16636    -84  -0.50%    4172    4172      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650
  69768   69688    -80  -0.11%    6368    6368      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/ds3231/main.go
  14808   14732    -76  -0.51%    6580    6580      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/hts221/main.go
  69304   69232    -72  -0.10%    6968    6968      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/flash/console/spi
  64012   63948    -64  -0.10%    6196    6196      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmi160/main.go
  64072   64008    -64  -0.10%    6228    6228      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp280/main.go
  26556   26492    -64  -0.24%    2328    2328      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/lsm303agr/main.go
  10880   10820    -60  -0.55%    3340    3340      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/touch/capacitive
  14152   14096    -56  -0.40%    6580    6580      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/lps22hb/main.go
  24752   24696    -56  -0.23%   13720   13720      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-nrf52840-sense ./examples/waveshare-epd/epd1in54/main.go
  11884   11836    -48  -0.40%    6580    6580      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/apds9960/proximity/main.go
   8372    8324    -48  -0.57%    3344    3344      0   0.00% tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/sram/main.go
  13792   13744    -48  -0.35%    3400    3400      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico     ./examples/sgp30
  27836   27796    -40  -0.14%    4780    4780      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp180/main.go
  22300   22260    -40  -0.18%    3540    3540      0   0.00% tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/time/main.go
  10740   10700    -40  -0.37%    4540    4540      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-bluefruit ./examples/tone
  61472   61440    -32  -0.05%    6180    6180      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adt7410/main.go
  12264   12236    -28  -0.23%    3352    3352      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/pca9685/main.go
  10552   10524    -28  -0.27%    3328    3328      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/seesaw
  12596   12568    -28  -0.22%    6976    6976      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/pyportal_touchpaint/main.go
  57448   57424    -24  -0.04%    3684    3684      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/shtc3/main.go
   6788    6764    -24  -0.35%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7735/main.go
   6176    6152    -24  -0.39%    2312    2312      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13x/main.go
  32280   32256    -24  -0.07%    4780    4780      0   0.00% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bme280/main.go
  57476   57460    -16  -0.03%    3684    3684      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht3x/main.go
  13568   13560     -8  -0.06%    6788    6788      0   0.00% tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/amg88xx
  26944   26936     -8  -0.03%    5680    5680      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit-v2 ./examples/microbitmatrix/main.go
   6700    6692     -8  -0.12%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7789/main.go
   5260    5256     -4  -0.08%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setpixel/main.go
   4620    4620      0   0.00%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/easystepper/main.go
   5832    5832      0   0.00%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/customchar/main.go
   5784    5784      0   0.00%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/text/main.go
   6228    6228      0   0.00%    3288    3288      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setbuffer/main.go
   2841    2841      0   0.00%     558     558      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino ./examples/servo
   5844    5844      0   0.00%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1331/main.go
   6488    6488      0   0.00%    2320    2320      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13/main.go
   6400    6400      0   0.00%    2320    2320      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd4in2/main.go
   1581    1581      0   0.00%     598     598      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino   ./examples/ws2812
   1056    1056      0   0.00%     180     180      0   0.00% tinygo build -size short -o ./build/test.hex -target=digispark ./examples/ws2812
  16148   16152      4   0.02%    2360    2360      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hub75/main.go
   6140    6144      4   0.07%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/spi_128x64/main.go
   8368    8376      8   0.10%    2320    2320      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/at24cx/main.go
  10372   10380      8   0.08%    4788    4788      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017-multiple/main.go
   6688    6696      8   0.12%    2288    2288      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/i2c_128x32/main.go
   5764    5772      8   0.14%    9522    9522      0   0.00% tinygo build -size short -o ./build/test.bin -target=m5stamp-c3          ./examples/ws2812
   7212    7224     12   0.17%    2280    2280      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/gc9a01/main.go
  10744   10756     12   0.11%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mag3110/main.go
   9920    9932     12   0.12%    4780    4780      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017/main.go
  12448   12476     28   0.22%    4788    4788      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/lsm6ds3/main.go
   9568    9600     32   0.33%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adxl345/main.go
   7432    7464     32   0.43%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/blinkm/main.go
  12200   12232     32   0.26%    4812    4812      0   0.00% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bmp388/main.go
  10528   10560     32   0.30%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/hd44780i2c/main.go
  11732   11764     32   0.27%    4780    4780      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis3dh/main.go
   8240    8272     32   0.39%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mma8653/main.go
   8148    8180     32   0.39%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mpu6050/main.go
  15336   15368     32   0.21%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl53l1x/main.go
  13816   13848     32   0.23%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl6180x/main.go
   8124    8160     36   0.44%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bh1750/main.go
  70632   70688     56   0.08%    3660    3660      0   0.00% tinygo build -size short -o ./build/test.hex -target=pinetime     ./examples/bma42x/main.go
  29508   29588     80   0.27%   38076   38076      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/pyportal_boing
  62644   62732     88   0.14%    5952    5952      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-nrf52840 ./examples/is31fl3731/main.go
  10152   10252    100   0.99%    6916    6916      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/basic
   9524    9624    100   1.05%    6780    6780      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/fourwire/main.go
  10172   10276    104   1.02%    6916    6916      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/scroll
   8080    8188    108   1.34%    6788    6788      0   0.00% tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/shifter/main.go
  65644   65756    112   0.17%    9004    9004      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/flash/console/qspi
   9760    9888    128   1.31%    4752    4752      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/itsybitsy-m0/main.go
  10644   10776    132   1.24%    4868    4868      0   0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/basic
  10732   10864    132   1.23%    4868    4868      0   0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/scroll
   8680    8816    136   1.57%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/main.go
   7872    8008    136   1.73%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/hcsr04/main.go
   9780    9916    136   1.39%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp3008/main.go
   6848    6984    136   1.99%    4780    4780      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/ws2812
  17396   17536    140   0.80%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/thermistor/main.go
  10064   10204    140   1.39%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/tm1637/main.go
2038514 2038270   -244   0.00%  472394  472394      0   0.00%

@deadprogram
Copy link
Member

LLVM 19 is out and the default for homebrew installs: https://formulae.brew.sh/formula/llvm

@aykevl
Copy link
Member Author

aykevl commented Nov 18, 2024

Yes. But it should continue to work, if people install LLVM as brew install llvm@18 (as IIRC it says in the documentation).

I can make a PR to support LLVM 19 for go install only if needed, but I'd prefer to do that only when needed (it is extra work to make and test). Instead, I'd prefer to wait until Espressif releases their LLVM 19 fork.

@QuLogic
Copy link
Contributor

QuLogic commented Jan 5, 2025

I noticed with lld 19 that several experimental flags warn that they don't exist and are being ignored. As this changes those to the non-prefixed versions, doesn't that mean that lld 18 will now warn that those don't exist and start ignoring them? In other words, don't we need some translation for -experimental--prefixed features between >=19 and <19?

@aykevl aykevl changed the title WIP: add support for LLVM 19 Aadd support for LLVM 19 Jan 19, 2025
@aykevl aykevl changed the title Aadd support for LLVM 19 Add support for LLVM 19 Jan 19, 2025
@aykevl aykevl marked this pull request as ready for review January 19, 2025 14:33
@aykevl
Copy link
Member Author

aykevl commented Jan 19, 2025

I noticed with lld 19 that several experimental flags warn that they don't exist and are being ignored. As this changes those to the non-prefixed versions, doesn't that mean that lld 18 will now warn that those don't exist and start ignoring them? In other words, don't we need some translation for -experimental--prefixed features between >=19 and <19?

These flags often change with LLVM releases, especially for RISC-V. So far it hasn't been breaking anything to use the flags of a different LLVM release, but the warnings are kinda ugly.
One solution would be to use a different set of flags for different LLVM versions, though I don't really like to maintain those. It's a solution though if needed.

(To be clear: these warnings only happen when using a LLVM version that's not the "primary"/latest supported LLVM version. Most users shouldn't see those).

@aykevl
Copy link
Member Author

aykevl commented Jan 19, 2025

In other news, I've updated this PR since the Xtensa fork got updated with LLVM 19 support!

Copy link
Member

@deadprogram deadprogram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At last! Thanks for all the work on this @aykevl now merging.

@deadprogram deadprogram merged commit 9e9768b into dev Jan 20, 2025
24 checks passed
@deadprogram deadprogram deleted the llvm19 branch January 20, 2025 05:15
@aykevl aykevl mentioned this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants