Helper functions to handle function inlining. Used to inline simple functions (without internal loops) and return a single expression that corresponds to the inlined function. This is done by keeping track of current bindings of all variables to a symbolic expression, and updating the symbolic expression as you go through the function definition.
More...
#include <act/expr.h>
#include <act/act_id.h>
Go to the source code of this file.
|
act_inline_table * | act_inline_new (Scope *sc, act_inline_table *parent) |
|
void | act_inline_free (act_inline_table *) |
|
void | act_inline_setval (act_inline_table *Hs, ActId *id, Expr **e) |
|
Expr ** | act_inline_getval (act_inline_table *Hs, const char *s) |
|
int | act_inline_isbound (act_inline_table *, const char *s) |
|
Expr ** | act_inline_expr (act_inline_table *, Expr *, int recurse_fn=1) |
|
Expr * | act_inline_expr_simple (act_inline_table *, Expr *, int recurse_fn=1) |
|
act_inline_table * | act_inline_merge_tables (int nT, act_inline_table **T, Expr **cond) |
|
Helper functions to handle function inlining. Used to inline simple functions (without internal loops) and return a single expression that corresponds to the inlined function. This is done by keeping track of current bindings of all variables to a symbolic expression, and updating the symbolic expression as you go through the function definition.
◆ act_inline_expr()
Expr ** act_inline_expr |
( |
act_inline_table * |
, |
|
|
Expr * |
, |
|
|
int |
recurse_fn = 1 |
|
) |
| |
Return the result of inlining all function calls into the expression specified. The result might be a structure, so this returns an array of expressions.
◆ act_inline_expr_simple()
Expr * act_inline_expr_simple |
( |
act_inline_table * |
, |
|
|
Expr * |
, |
|
|
int |
recurse_fn = 1 |
|
) |
| |
Return the simple result of inlining all function calls into the expression specified. If the result is a structure, the first item from the structure is returned.
◆ act_inline_free()
void act_inline_free |
( |
act_inline_table * |
| ) |
|
Release storage for a previously allocated inline table
◆ act_inline_getval()
Expr ** act_inline_getval |
( |
act_inline_table * |
Hs, |
|
|
const char * |
s |
|
) |
| |
- Parameters
-
Hs | is the current inline binding table |
s | is the name of the identifier |
- Returns
- the binding for an identifier from the table
◆ act_inline_isbound()
int act_inline_isbound |
( |
act_inline_table * |
, |
|
|
const char * |
s |
|
) |
| |
- Parameters
-
tab | is the current inline binding table |
s | is the identifier to search for |
- Returns
- 1 if there is a binding present, 0 otherwise
◆ act_inline_merge_tables()
act_inline_table * act_inline_merge_tables |
( |
int |
nT, |
|
|
act_inline_table ** |
T, |
|
|
Expr ** |
cond |
|
) |
| |
Given inline tables corresponding to a set of conditions (e.g. via a selection statement), this computes unified expressions that combine the guard to select the correct expression result.
◆ act_inline_new()
act_inline_table * act_inline_new |
( |
Scope * |
sc, |
|
|
act_inline_table * |
parent |
|
) |
| |
Create a new inline table linked to a parent in the current scope
- Parameters
-
sc | is the current scope |
parent | is the parent inline table |
- Returns
- a new inline table
◆ act_inline_setval()
void act_inline_setval |
( |
act_inline_table * |
Hs, |
|
|
ActId * |
id, |
|
|
Expr ** |
e |
|
) |
| |
Set an identifier to an expression. An expression array is provided in case the identifier corresponds to a structure. The inline table bindings are updated.
- Parameters
-
Hs | is the current inline binding table |
id | is the identifier to be set |
e | is the array of expressions for values (e[0] will contain the value if the * identifier is simple one) |