Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

Developing an LLVM-based compiler for stack based TF16 processor architecture

https://doi.org/10.15514/ISPRAS-2021-33(5)-8

Abstract

Development for stack-based architectures is usually done using legacy low level languages or assembly code, so there exists a problem of a high level programming language support for such architectures. In this paper we describe the development process of an LLVM/Clang-based C compiler for stack-based TF16 processor architecture. LLVM was used due to adaptation possibilities of its components for new architectures, such as disassembler, linker and debugger. Two compiler versions were developed. The first version generated code without using stack capabilities of TF16, treating it instead as a register-based architecture. This version was relatively easy to develop and it provided us a comparison point for the second one. In the second version we have implemented a platform independent stack scheduling algorithm that allowed us to generate code that makes use of the stack capabilities of the CPU. When comparing the two versions, a version that utilized stack capabilities generated code that was on average 35.7% faster and 50.8% smaller than the original version. The developed stack scheduling algorithm also allows to support other stack based architectures in LLVM toolchain

About the Authors

Leonid Vladlenovich SKVORTSOV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher in Compiler Technology department



Roman Vyacheslavovich BAEV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher in Compiler Technology department



Ksenia Yurievna DOLGORUKOVA
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher in Compiler Technology department



Eugene Yurievich SHARYGIN
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher in Compiler Technology department



References

1. Koopman P. Stack computers: the new wave. Halsted Press, 1989. 231 p.

2. Каршенбойм И. Стековые процессоры, или новое — это хорошо забытое новое. Компоненты и технологии, no. 2, 2004 г., стр. 130-134 / Karshenboim J. Stack processors, or new is the well-forgotten new. Components and technologies, no. 2, 2004, pp. 139-134 (In Russian).

3. Rather E, Colburn D, Moore C. The evolution of Forth. ACM SIGPLAN Notices, volю 28, тo. 3, 1993, pp. 177-199.

4. LLVM Compiler Infrastructure. Available at: https://llvm.org, accessed 10.09.2021.

5. Koopman P. A preliminary exploration of optimized stack code generation. Journal of Forth Application and Research, vol. 6, no. 3, 1994, pp. 241-251.

6. GCC, the GNU Compiler Collection. Available at https://gcc.gnu.org, accessed 10.09.2021.

7. Bailey C. Inter-boundary scheduling of stack operands: A preliminary study. In Proc. of the EuroForth Conference, 2000, pp 3-11.

8. Shannon M. A C Compiler for Stack Machines. MS Thesis. University of York, 2006, 116 p.

9. SCC, Simple C Compiler. Available at https://www.simple-cc.org, accessed 10.09.2021.

10. FCC, Fedjmike's C Compiler. Available at https://github.com/Fedjmike/fcc, accessed 10.09.2021.


Review

For citations:


SKVORTSOV L.V., BAEV R.V., DOLGORUKOVA K.Yu., SHARYGIN E.Yu. Developing an LLVM-based compiler for stack based TF16 processor architecture. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2021;33(5):137-154. (In Russ.) https://doi.org/10.15514/ISPRAS-2021-33(5)-8



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2079-8156 (Print)
ISSN 2220-6426 (Online)