<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear LLVM Community,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div><br>
</div>
<div>A few weeks ago, I published updated patches of the Xtensa Architecture backend for review. During this time, the 2nd patch was approved, and I am very happy about it .
<br>
</div>
<div>Current situation is that first three patches are approved:</div>
<div><br>
</div>
<div>1. Recognize Xtensa in triple parsing code https://reviews.llvm.org/D64826 .</div>
<div>2. Add Xtensa ELF definitions https://reviews.llvm.org/D64827 .</div>
<div>3. Initial version of the Xtensa backend https://reviews.llvm.org/D64829 .</div>
<div><br>
</div>
<div>And the last seven patches not yet have been reviewed.</div>
<div> I would like to ask everyone to help with reviewing following patches. </div>
<div><br>
</div>
<div>4. Add basic *.td files with Xtensa architecture description https://reviews.llvm.org/D64830 .</div>
<div>5. Add Xtensa MCTargetDescr initial functionality https://reviews.llvm.org/D64831 .</div>
<div>6. Add Xtensa basic assembler parser https://reviews.llvm.org/D64832 .</div>
<div>7. Add Xtensa instruction printer https://reviews.llvm.org/D64833 .</div>
<div>8. Add support of the Xtensa shift / load / store / move and processor control instructions. https://reviews.llvm.org/D64834 .</div>
<div>9. Add basic support of Xtensa disassembler https://reviews.llvm.org/D64835 .</div>
<div>10. Add relaxations and fixups. Add rest part of Xtensa Core Instructions. https://reviews.llvm.org/D64836 .</div>
<div><br>
</div>
<div> I would be glad to receive any comments or feedback about them.</div>
<div><br>
</div>
<div>Thanks to all! Best regards,</div>
Andrei Safronov<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Andrei Safronov<br>
<b>Sent:</b> Wednesday, March 10, 2021 4:29 AM<br>
<b>To:</b> llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> [llvm-dev] [RFC] Tensilica Xtensa (ESP32) backend</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi All!
<div><br>
</div>
<div>On behalf of Espressif Systems, I would like to propose Xtensa backend to be added as an experimental to LLVM project.</div>
<div><br>
</div>
<div></div>
The new target should satisfy common rules (https://llvm.org/docs/DeveloperPolicy.html#adding-a-new-target) to be upstreamed in experimental mode.
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Therefore, we prepared an overview about conformance of the Xtensa backend to these rules:
<div><br>
</div>
<div>1. Every target must have a code owner.</div>
<div> I added myself in CODE_OWNERS.txt as responsible for Xtensa backend support in the first patch.</div>
<div> </div>
<div>2. There must be an active community behind the target. </div>
<div> We have been developing the Xtensa backend project for 3 years, the latest version is ported to LLVM release 11.0.0.</div>
<div> <a href="https://github.com/espressif/llvm-project" id="LPlnk943367">https://github.com/espressif/llvm-project</a> . The Xtensa backend project now implements object code generation, architecture-dependent optimizations and it became possible to use
clang to compile software projects for the EPSP32 / ESP8266 processor family.</div>
<div> </div>
<div>3. The code must be free of contentious issues.</div>
<div> The Xtensa backend code deisgned with minimum changes in IR behaviour.</div>
<div><br>
</div>
<div>4. The code conforms to all of the policies laid out in this developer policy document, including license, patent, and coding standards.</div>
<div> We paid attention to all these requirements in code design.</div>
<div><br>
</div>
<div>5. The target should have either reasonable documentation on how it works (ISA, ABI, etc.) or a publicly available simulator/hardware (either free or cheap enough) - preferably both.</div>
<div> The Xtensa target is implemented in Qemu emulator https://github.com/qemu/qemu/tree/master/target/xtensa and has publicly available hardware implementations, for example ESP32/ESP8266 MCU's family https://www.espressif.com/en/products/socs/esp32 . We
also created the Xtensa ISA documentation project <a href="https://github.com/espressif/xtensa-isa-doc" id="LPlnk">
https://github.com/espressif/xtensa-isa-doc</a> , which is designed to simplify the patch review process, this project is based on public sources.</div>
<div> </div>
<div>Some time ago, we already presented this project for discussion to the LLVM community in a letter
</div>
<div><a href="https://lists.llvm.org/pipermail/llvm-dev/2019-March/130796.html">https://lists.llvm.org/pipermail/llvm-dev/2019-March/130796.html</a> , and published a series of patches in the Phabricator:</div>
<div><br>
</div>
<div>1. Recognize Xtensa in triple parsing code <a href="https://reviews.llvm.org/D64826" id="LPlnk731179">
https://reviews.llvm.org/D64826</a> .<br>
</div>
<div>2. Add Xtensa ELF definitions <a href="https://reviews.llvm.org/D64827" id="LPlnk">
https://reviews.llvm.org/D64827</a> .<br>
</div>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_1 x__EReadonly_1">
</div>
3. Initial version of the Xtensa backend <a href="https://reviews.llvm.org/D64829" id="LPlnk">
https://reviews.llvm.org/D64829</a> .<br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_2 x__EReadonly_1">
</div>
4. Add basic * td files with Xtensa architecture description <a href="https://reviews.llvm.org/D64830" id="LPlnk174852">
https://reviews.llvm.org/D64830</a> .<br>
<div>5. Add Xtensa MCTargetDescr initial functionality <a href="https://reviews.llvm.org/D64831" id="LPlnk">
https://reviews.llvm.org/D64831</a> .<br>
</div>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_3 x__EReadonly_1">
</div>
6. Add Xtensa basic assembler parser <a href="https://reviews.llvm.org/D64832" id="LPlnk">
https://reviews.llvm.org/D64832</a> .<br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_4 x__EReadonly_1">
</div>
7. Add Xtensa instruction printer <a href="https://reviews.llvm.org/D64833" id="LPlnk320729">
https://reviews.llvm.org/D64833</a> .<br>
<div>8. Add support of the Xtensa shift / load / store / move and processor control instructions.
<a href="https://reviews.llvm.org/D64834" id="LPlnk">https://reviews.llvm.org/D64834</a> .<br>
</div>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_5 x__EReadonly_1">
</div>
9. Add basic support of Xtensa disassembler <a href="https://reviews.llvm.org/D64835" id="LPlnk">
https://reviews.llvm.org/D64835</a> .<br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_6 x__EReadonly_1">
</div>
10. Add relaxations and fixups. Add rest part of Xtensa Core Instructions. <a href="https://reviews.llvm.org/D64836" id="LPlnk">
https://reviews.llvm.org/D64836</a> .<br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_7 x__EReadonly_1">
</div>
<br>
Currently, patches 1 and 3 have been approved, but other patches are still waiting for review. The patches 1-10 in the Phabricator are updated in accordance with the latest LLVM API changes and comments from the patches review.
<div><br>
</div>
<div>Now exists a strong demand and interest from our large developer community for LLVM Xtensa backend and there are also some other companies in a world which have Xtensa based chips. For example, Xtensa backend helps to implement Rust for the Xtensa https://github.com/MabezDev/rust-xtensa
and TinyGo <a href="https://tinygo.org/faq/what-about-esp8266-esp32/" id="LPlnk">
https://tinygo.org/faq/what-about-esp8266-esp32/</a> .</div>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_8 x__EReadonly_1">
</div>
<br>
<div>But for the further development of such projects, it would be much more convenient to have the Xtensa backend implementation in the main LLVM version.</div>
<div><br>
</div>
<div>So, it would be great if the LLVM community could help resume the review process.</div>
<div><br>
</div>
<div>All comments and suggestions are welcome!</div>
<div><br>
</div>
Andrei Safronov<br>
</div>
</div>
</body>
</html>