From 58042719e5408c786bd61833277d8aaf1e117d6e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 30 Dec 2010 16:05:06 +0900 Subject: [PATCH] A little more documentation for expressions. --- tools/qfcc/include/expr.h | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index 7552c071b..fbe708f4e 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -473,14 +473,79 @@ int is_logic (int op); */ expr_t *constant_expr (expr_t *var); +/** Bind the result of an expression to a temporary variable. + + If a temporary variable is not needed when emitting code, none will + be used. + + \param e1 The expression which will be bound. + \param e2 The temporary variable to which the expression will be + bound. Must be a temporary expression (ex_temp). + \return The new bind expression. +*/ expr_t *new_bind_expr (expr_t *e1, expr_t *e2); + +/** Create a reference to the global .self entity variable. + + This is used for @self. + \return A new expression referencing the .self def. +*/ expr_t *new_self_expr (void); + +/** Create a reference to the .this entity field. + + This is used for @this. + \return A new expression referencing the .this def. +*/ expr_t *new_this_expr (void); + +/** Create an expression of the correct type that references the return slot. + + \param type The type of the reference to the return slot. + \return A new expression referencing the return slot. +*/ expr_t *new_ret_expr (struct type_s *type); + +/** Create an expression of the correct type that references the specified + parameter slot. + + \param type The type of the reference to the parameter slot. + \param num The index of the parameter (0-7). + \return A new expression referencing the parameter slot. +*/ expr_t *new_param_expr (struct type_s *type, int num); + +/** Create an expression representing a block copy. + + This is used for structure assignments. + + \param e1 Destination of move. + \param e2 Source of move. + \param type type giving size of move. + \return A new expression representing the move. +*/ expr_t *new_move_expr (expr_t *e1, expr_t *e2, struct type_s *type); +/** Temporary variable reference counting. + + Increment the users of the referenced temporary. Has no effect on + other expressions. + + \param e The expression referencing the temporary variable. If + a block expression, the result of the block will be + incremented. +*/ void inc_users (expr_t *e); + +/** Temporary variable reference counting. + + Decrement the users of the referenced temporary. Has no effect on + other expressions. + + \param e The expression referencing the temporary variable. If + a block expression, the result of the block will be + decremented. +*/ void dec_users (expr_t *e); void convert_name (expr_t *e);