π
<-
Chat plein-écran
[^]

Nouveaux travaux sur un compilateur C pour (e)Z80 via LLVM…

Nouveautés, projets, mises à jour.

Re: Nouveaux travaux sur un compilateur C pour (e)Z80 via LL

Message non lude Adriweb » 03 Mai 2020, 06:38

Si vous voulez voir 5h de streaming où Jacob travaille sur LLVM, c'est dispo sur Twitch (il était en live hier): https://www.twitch.tv/videos/608767782 :P
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14599
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Nouveaux travaux sur un compilateur C pour (e)Z80 via LL

Message non lude Adriweb » 27 Déc 2020, 17:21

Quelques années plus tard, et après de nombreuses heures sur la création/amélioration/débuggage du compilateur (enfin, le backend llvm), linker, et autres outils nécessaires à la toolchain, mais aussi la réécriture d'un certain nombre d'includes standard et des fonctions associées....
La toolchain C/C++ pour CE est sortie en v9.0, basée donc sur LLVM pour le compilateur, qui remplace donc ZDS !

Félicitations à tous les contributeurs, et évidemment à Jacobly en particulier !

The major upgrade from ZDS to LLVM

The toolchain is from now on based on LLVM, an open-source retargetable compiler infrastructure, and @jacobly0 created an (e)z80 backend!
This is a major milestone as it allows the CE toolchain to move away from using the legacy Zilog ZDS compiler, which is closed-source, proprietary, only worked on Windows, and contained numerous bugs.
Thanks to LLVM, later standards of the C and C++ languages are supported (you're not stuck with C89 anymore!), code optimization actually works, and the compiler is able to run natively across multiple platforms. The fact that it is open-source and community-maintained means that bugs can actually be fixed and improvements/feedback can come from anyone.

Note: No STL is provided for C++ source code (i.e. no std::string, no std::vector, etc.). Currently only language support is offered.


Updating your projects for this new toolchain version

In programs you build with this new toolchain, you should notice performance or speed improvements, depending on the optimization level you choose ... or even both :)

But the massive internal changes in the toolchain do mean that some programs might not compile right away anymore.
In fact, first, after installing the new toolchain, you'll have to update your projects' makefile. It's only a few lines, and a template makefile can be found here.

Regarding potential source code related migration, don't worry, it shouldn't be too difficult to fix your code. Here are some differences:
  • Old-style inline assembly will most likely not work, you'd have to write it like the compiler outputs it, in the format fasmg-ez80 expects. Update any assembly source modules with the guide described here.
  • Many new errors and warnings may be generated as the compiler is able to better infer. These should be fixed, and programs should compile without any warnings.
  • If your program was using 64-bit types (for instance long long), it may not build (link, more specifically) anymore. In fact, the ZDS compiler even made those 32-bit. If there's enough justified demand for actually supporting 64-bit types properly, we may work on it.
  • The convimg project has been updated to support a new YAML format that is easier for beginners and tooling. The previous toolchain release (v8.8) also used a YAML format, however some slight modifications were made in order to make it standard-compliant. Example convimg.yaml conversion files can be found in the examples.


Other changes and improvements

You can find the a more detailed list of changes (and a link to the commits) in the changelog file, but here are the other important changes in addition to the compiler change:

  • Lots of cleanup and improvements to the standard includes and headers in general, made possible by the compiler change mentioned above.
  • New fileioc function: ti_SetGCBehavior to set routines to run before and after a garbage collect would be triggered.
  • New keypadc defines: many keypad key defines corresponding to the TI-83 Premium CE keypad were added for easier coding.
  • New usb.h function: usb_BatteryCharging to check if the battery is currently charging.
  • Revamped v/s/printf functions, now available if needed thanks to a light third-party library, see docs.
  • New: fileioc-powered (by default) implementation for file IO functions, see docs.
  • New C++ header-only "library" for easily manipulating "TI real" numbers (see this PR), making some math operations easier. See examples.
  • abort() doesn't generate code that would make CEmu open its debugger anymore - you can use the specific debug functions for that now.
  • Documentation improved and revamped. Available on online here, which replaces the repo's wiki.

----------

Let's thank once again @jacobly0 for his spectacular work (years in the making), as well as everybody who contributed in one way or another, to this release 🥂

Happy coding!


Une news sera prochainement écrite :)
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14599
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Nouveaux travaux sur un compilateur C pour (e)Z80 via LL

Message non lude Epharius » 27 Déc 2020, 23:10

Félicitation à tous, c'est un travail énorme pour un gain énorme !
Le projet Geometry Dash est terminé ! N'hésitez pas à aller jeter un coup d’œil au topic du projet ! Vous pouvez le télécharger ici.

Unis par la flèche sacrée de cupidon :favorite:
Image
Avatar de l’utilisateur
EphariusPremium
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 7%
 
Messages: 1107
Images: 4
Inscription: 08 Déc 2014, 17:38
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: Ensimag
GitHub: MathisLav

Re: Nouveaux travaux sur un compilateur C pour (e)Z80 via LL

Message non lude BFI » 26 Juin 2022, 11:14

Bonjour,
Je suis un vieil utilisateur du 8085, Z80 et 68HC11. Je connais le C++ et j'aimerais générer du code pour le (e)Z80, par exemple. Auriez-vous l'amabilité de m'indiquer quelle est la marche à suivre?

Cordialement

J-P
Avatar de l’utilisateur
BFI
Niveau 0: MI (Membre Inactif)
Niveau 0: MI (Membre Inactif)
Prochain niv.: 0%
 
Messages: 1
Inscription: 26 Juin 2022, 11:09
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: retraité et étudiant à l'EPFL

Re: Nouveaux travaux sur un compilateur C pour (e)Z80 via LL

Message non lude Adriweb » 26 Juin 2022, 11:45

Bonjour,

Le plus simple serait d'utiliser la toolchain CE en suivant les étapes d'installations / mise en route pour pouvoir builder ses projets C/C++ en programmes compatibles CE...

Après, si le but est uniquement de générer du code ASM (pour le lire) à partir de code C ou C++, pas besoin de la toolchain, le compilateur suffit (au passage : il génère de l'ASM en syntaxe fasmg). Auquel cas, on peut le télécharger ici (les 3 liens Release selon l'OS): https://github.com/jacobly0/llvm-project/wiki

Et puis l'appeler depuis un terminal/cmd avec par exemple ez80-clang -S -Oz -xc++ - -o - <<<"void consume(long long* xptr); void test(long long x){consume(&x);}"
(Ou si l'entrée est un fichier, et qu'on veut avoir la sortie dans un fichier aussi: ez80-clang -S -Oz test.cpp -o test.cpp.asm)

Ce qui nous donne, en l'occurrence:
Code: Tout sélectionner
   section   .text,"ax",@progbits
   assume   adl = 1
   section   .text,"ax",@progbits
   public   __Z4testx
__Z4testx:
   ld   hl, -8
   call   __frameset
   ld   hl, (ix + 6)
   ld   de, (ix + 9)
   ld   bc, (ix + 12)
   ld   (ix - 8), hl
   ld   (ix - 5), de
   ld   (ix - 2), c
   ld   (ix - 1), b
   pea   ix - 8
   call   __Z7consumePx
   ld   sp, ix
   pop   ix
   ret
   section   .text,"ax",@progbits

   ident   "clang version 14.0.0 (https://github.com/jacobly0/llvm-project 93891dd25de7b052c54e9d8519f36eac2d557b99)"
   extern   __Unwind_SjLj_Register
   extern   __Unwind_SjLj_Unregister
   extern   __frameset
   extern   __Z7consumePx
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14599
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Précédente

Retourner vers Actualités

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 11 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
813 utilisateurs:
>786 invités
>21 membres
>6 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)