Output of Pinapa

Overview

The output of Pinapa is composed of

There is no textual syntax for this, it's only a data-structure, useable through GCC and SystemC (plus a few additional for Pinapa) header files. This means Pinapa is a front-end, that is only meaningfull when associated with a back-end.

The example provided with Pinapa is the best starting point if you want to understand how this all works. A good way to write a back-end is to copy and rename the directory containing the example, and to modify it little by little.

Abstract Syntax Tree

The best documentation for AST is actually the chapter "Trees" of the GCC internals manual. The documentation of each node can also be found as comments in the source code of GCC, in the files tree.def, cp/cp-tree.def and c-common.def.

ELAB: Representation of the Architecture

The ELAB is not really well documented, but is also not a complex data-structure. If you know how to write a SystemC program, you know how to build ELAB. Looking at the header files of SystemC should be sufficient.

Decoration Mechanism

A rather general decoration mechanism is provided, allowing Pinapa to annotate the AST and ELAB, and Pinapa's backend to add other annotations. It is implemented and documented in pinapa-decoration-base.h.

Anotations Added by Pinapa on the AST

Some anotations are added on some node of the tree.

Type of instruction

The first one is the type of intruction. This is a field of type pinapa::sc_primitive_t.

Specific types

For AST representing special types, a decoration is also added, of type pinapa::type_of_type.

This is usefull for our back-end LusSy, who does a special treatment on addresses. Note that C++ typing system does not allow the identification of address types in 100% of the cases. In pieces of code like

  GLOBAL_ADDRESS_TYPE x = 42;
  int y = 56;
  x = x + y;

it is easy to identify x as being of type address, but y will be of type ``plain integer''.

Additional decoration on the AST instance

Additionally, for some instructions, an additional decoration is added:

Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page