Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Register-Transfer-Language (RTL) Code from C and JAVA Code?

When any compiler like GCC compiles a C Program it generates intermediate code. Just like we can get Assembly code by applying -s option to any .c file, similarly I want to get Register-Transfer-Language (RTL) for C and JAVA file . How to get it ?

like image 269
Mercury Avatar asked Nov 10 '15 06:11

Mercury


People also ask

What is Register Transfer Language explain with two examples?

The Register Transfer Language is the symbolic representation of notations used to specify the sequence of micro-operations. In a computer system, data transfer takes place between processor registers and memory and between processor registers and input-output systems.

What is RTL register?

In digital circuit design, register-transfer level (RTL) is a design abstraction which models a synchronous digital circuit in terms of the flow of digital signals (data) between hardware registers, and the logical operations performed on those signals.

What is RTL write RTL representation and interpretation for a loading a register?

In computer science, register transfer language (RTL) is a kind of intermediate representation (IR) that is very close to assembly language, such as that which is used in a compiler. It is used to describe data flow at the register-transfer level of an architecture.


1 Answers

The three adress code is called gimple, see e.g. https://gcc.gnu.org/onlinedocs/gccint/GIMPLE.html but this seems more frontend-backend communication, it can be dumped using

  gcc  -fdump-tree-gimple <file>  

See http://www.cse.iitb.ac.in/~uday/courses/cs324-05/gccProjects/node4.html

from some more IR related dumping options from HLL to deep. Probably you want option 4.

  1. Abstract Syntax Tree (AST). The -fdump-tree-original-raw switch dumps the textual representation of the AST for given input source.
  2. Gnu SIMPLE representation (GIMPLE) The -fdump-tree-gimple-raw switch dumps the GIMPLE representation of the input source.
  3. Control Flow Graph (CFG). The -fdump-tree-cfg-raw switch dumps the CFG form of the GIMPLE code.
  4. Register Transfer Language (RTL IR) The -da switch dumps the RTL IR of the input source program with the pass number as a part of the dump file name.
  5. Assembly Language (ASM). The -S switch dumps the target assembly code for the input. In our case, this is the Pentium assembly language.
like image 132
Marco van de Voort Avatar answered Sep 20 '22 13:09

Marco van de Voort