pinapa-decoration.cpp File Reference

Top level of the AST analyzer. More...

#include <stdio.h>
#include <ext/hash_set>
#include "pinapa-tree.h"
#include "pinapa-tree-utils.h"
#include "input.h"
#include "pinapa-decoration.h"
#include "pinapa-simcontext.h"
#include "pinapa-analyze-body.h"
#include "pinapa-tree-decoration.h"
#include "tree-inline.h"

Namespaces

namespace  pinapa

Typedefs

typedef hash_set< treepinapa::function_set_t

Functions

tree pinapa_initialize_decoration (tree *t, int *x, void *y)
void pinapa_gcc_analyze_function_hook (tree fn)
void pinapa_named_return_value_optimisation_hook ()
void pinapa_gcc_keep_old_node_hook (tree t, tree arg1)
void pinapa_gcc_build_tree_node_hook (tree t)

Variables

function_set_t pinapa::global_function_set
tree pinapa::current_function
tree pinapa::pinapa_current_function_return_value
bool pinapa::named_return_value_attach_it = false
bool improved_ascii_progress_bar = false


Detailed Description

Top level of the AST analyzer.

This file contains the function sc_analyze_function, which is called after GCC's front-end.


Function Documentation

void pinapa_gcc_analyze_function_hook ( tree  fn  ) 

Function called by GCC's modified front-end.

Calls the function pinapa_gcc_analyze_function_hook to add a link to the function body in SystemC data structures, and analyze_function_body to link SystemC primitive in the body of the function to the right object in the SystemC kernel.

A call to this function has been added in GCC's source code.

void pinapa_gcc_build_tree_node_hook ( tree  t  ) 

Hook added in tree.c, line 2409

this function helps keeping in mind location in source file of interesting statements (call_expr), since gcc does not retain this information but for _DECL nodes

void pinapa_gcc_keep_old_node_hook ( tree  t,
tree  arg1 
)

Hook added in fold-const.c, line 1703.

this is to keep the type of the node as a decoration because the next line will override it with another type.

This is useful to manage enumeral types, since the TREE_TYPE is ENUMERAL_TYPE at this moment, and will be overridden by INTEGER_TYPE.

tree pinapa_initialize_decoration ( tree t,
int *  x,
void *  y 
)

Initializes the decoration for the top level node of the tree t. Other params are here to be compliant with the type walk_tree_fn, from GCC

void pinapa_named_return_value_optimisation_hook (  ) 

There is an optimisation of GCC : When the expression of all the "return" statements of a function are a single variable (only if this is an object.), and if it is always the same variable, then, this variable is stored once for all in a global variable pointed to by the macro current_function_return_value.

see genrtl_start_function, and declare_return_variable in GCC for more details.

The problem for us is that this variable will be overridden when the next function will be parsed.

So, we'll add it to the decoration of the function declaration.

This function has been added as a hook in GCC's source :


Variable Documentation

bool improved_ascii_progress_bar = false

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