Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

expression_utils.h File Reference

Various utilities for expression manipulation (and, sadly) a number which are not. More...

Defines

Functions


Detailed Description

Various utilities for expression manipulation (and, sadly) a number which are not.


Define Documentation

#define _UTILS__EXPRESSION_UTILS_H


Function Documentation

IntConstant * create_int_constant (SuifEnv * suif_env, IInteger i)

Create an integer constant.

The type will be the type for word_type taken fromt the target information block

IInteger get_expression_constant (Expression * exp)

Get an integer constant from an expression.

Returns indeterminate if the expression is not an integer constant

ProcedureSymbol * get_procedure_target_from_call (CallStatement * call)

Get the procedure to be called by a call statement.

ProcedureSymbol * get_procedure_from_address_op (Expression * procedure_address)

ProcedureDefinition * get_procedure_definition (ExecutionObject * eo)

SuifObject * remove_suif_object (SuifObject * obj)

Remove an object from its owner, and clear its parent pointer.

This should be moved to somewhere else

Statement * remove_statement (Statement * the_statement)

remove the statement If it's parent is a statement list, we will do the appropriate removal.

If not, we will replace it with a new empty statement list.

Expression * replace_expression (Expression * expr, Expression * replacement)

replace an expression with a new expression A thin and somewhat redundent wrapper around expr->get_parent()->replace(expr,replacement);.

Statement * replace_statement (Statement * expr, Statement * replacement)

Replace a statement with a new statement.

list<StoreVariableStatement *>* force_dest_not_expr (Expression * expr)

Turn the expression into a store of a variable.

followed by a reference. This can cause major code changes if the expression is in a do-while or while-do loop test.

If new statements are required, they will be returned It is possible to create Multiple statements from a single expression.

bool is_target_label (CodeLabelSymbol * target_label, Statement * the_statement)

Return true if the target_label could a branch target for the Statement For code labels with their address taken, the result is always true.

void insert_statement_after_loop_body (ForStatement * the_loop, Statement * the_statement)

Insert a statement at the end of a loop body.

If the loop continue label is used a new continue label will be created and an explicit label will be placed before the inserted statement.

void insert_statement_after_loop_body (DoWhileStatement * the_loop, Statement * the_statement)

Insert a statement at the end of a loop body.

If the loop continue label is used a new continue label will be created and an explicit label will be placed before the inserted statement.

void insert_statement_after_loop_body (WhileStatement * the_loop, Statement * the_statement)

Insert a statement at the end of a loop body.

If the loop continue label is used a new continue label will be created and an explicit label will be placed before the inserted statement.

Statement * insert_statement_before (Statement * loc, Statement * the_statement)

Smart statement insert.

Puts the existing statement into a statement list and inserts in that statement list, if neccessary. If loc is already in a statement list, or is a statement list itself, the existing statement is used.

Returns the list into which the insertion was made

Statement * insert_statement_after (Statement * loc, Statement * the_statement)

Insert statement after the given statement Similar optimizations to insert_statement_before apply.

bool is_void_dest (Expression * expr)

Return true if there is no destination for an expression.

Currently, this means that it is an Eval Statement.

Statement * build_assign (VariableSymbol * dst, Expression * expr)

Create an assignment statement.

Statement * build_assign (VariableSymbol * dest, VariableSymbol * src)

Create an assignment statement.

Expression * build_cast (Expression * expr, DataType * t)

Create a cast.

Statement * get_expression_owner (Expression * expr)

find the statement at the base of this expression tree.

void inline_call (CallStatement * the_call, ProcedureSymbol * target_proc)

If target_proc is 0, find the direct target from the call.

otherwise, the target proc should be consistent with the call's address operand. (Original comment preserved - no idea what this does)

Expression * build_dyadic_expression (LString op, Expression * left, Expression * right)

Build a dyadic expression Constant folding is done if needed.

(very minimal at present) If constant folding occurs, and the parameter expressions have no parent, they are deleted. If no folding occurs and the parameter expressions have parents, they are cloned

Expression * build_monadic_expression (LString op, Expression * subexp)

Build a monadic expression.

The monadic equivalent of the above

Expression * clone_if_needed (Expression * subexp)

Clone an expression if it has a parent.

\warning. Think before doing this. Cloning an expression will result in two evaluations of the expression. Perhaps you want to assign to a variable and use that instead. Most often used with constants


Generated at Mon Nov 22 19:43:07 1999 for NCI SUIF by doxygen  written by Dimitri van Heesch, © 1997-1999