Ctree element: expression. More...
Public Member Functions | |
| bool | cpadone (void) const |
| Pointer arithmetic correction done for this expression? | |
| bool | is_odd_lvalue (void) const |
| bool | is_fpop (void) const |
| void | set_cpadone (void) |
| cexpr_t (ctype_t cop, cexpr_t *_x) | |
| cexpr_t (ctype_t cop, cexpr_t *_x, cexpr_t *_y) | |
| cexpr_t (ctype_t cop, cexpr_t *_x, cexpr_t *_y, cexpr_t *_z) | |
| cexpr_t (mbl_array_t *mba, const lvar_t &v) | |
| cexpr_t (const cexpr_t &r) | |
| void | swap (cexpr_t &r) |
| cexpr_t & | operator= (const cexpr_t &r) |
| cexpr_t & | assign (const cexpr_t &r) |
| DECLARE_COMPARISONS (cexpr_t) | |
| void | replace_by (cexpr_t *r) |
| Replace the expression. | |
| void | cleanup (void) |
| Cleanup the expression. | |
| void | put_number (cfunc_t *func, uint64 v, int nbytes, type_sign_t sign=no_sign) |
| Assign a number to the expression. | |
| size_t | print1 (char *buf, size_t bufsize, const cfunc_t *func) const |
| Print expression into one line. | |
| void | calc_type (bool recursive) |
| Calculate the type of the expression. | |
| bool | equal_effect (const cexpr_t &r) const |
| Compare two expressions. | |
| bool | is_child_of (const citem_t *parent) const |
| Verify if the specified item is our parent. | |
| bool | contains_operator (ctype_t needed_op) const |
| Check if the expression contains the specified operator. | |
| bool | contains_expr (const cexpr_t *e) const |
| Does the expression contain another expression? | |
| bool | contains_comma (void) const |
| Does the expression contain a comma operator? | |
| bool | contains_insn (void) const |
| Does the expression contain an embedded statement operator? | |
| bool | contains_insn_or_label (void) const |
| Does the expression contain an embedded statement operator or a label? | |
| bool | contains_comma_or_insn_or_label (void) const |
| Does the expression contain a comma operator or an embedded statement operator or a label? | |
| bool | is_nice_expr (void) const |
| Is nice expression? Nice expressions do not contain comma operators, embedded statements, or labels. | |
| bool | is_nice_cond (void) const |
| Is nice condition?. | |
| bool | is_call_object_of (const citem_t *parent) const |
| Is call object?. | |
| type_sign_t | get_type_sign (void) const |
| Get expression sign. | |
| bool | is_type_unsigned (void) const |
| Is expression unsigned? | |
| bool | is_type_signed (void) const |
| Is expression signed? | |
| int | get_nbits (int pbits) const |
| Get number of bits that can really be used by the expression. | |
| bool | requires_lvalue (const cexpr_t *child) const |
| Check if the expression requires an lvalue. | |
| bool | has_side_effects (void) const |
| Check if the expression has side effects. | |
| uint64 | numval (void) const |
| Get numeric value of the expression. | |
| bool | is_const_value (uint64 v) const |
| Check if the expression is a number with the specified value. | |
| bool | is_negative_const (void) const |
| Check if the expression is a negative number. | |
| bool | is_non_zero_const (void) const |
| Check if the expression is a non-zero number. | |
| bool | is_zero_const (void) const |
| Check if the expression is a zero. | |
| bool | get_const_value (uint64 *np) const |
| Get expression value. | |
| bool | maybe_ptr (void) const |
| May the expression be a pointer? | |
| cexpr_t * | get_ptr_or_array (void) |
| Find pointer or array child. | |
| const cexpr_t * | find_op (ctype_t op) const |
| Find the child with the specified operator. | |
| cexpr_t * | find_op (ctype_t op) |
| const cexpr_t * | find_num_op (void) const |
| Find the operand with a numeric value. | |
| cexpr_t * | find_num_op (void) |
| const cexpr_t * | theother (const cexpr_t *what) const |
| Get the other operand. | |
| cexpr_t * | theother (const cexpr_t *what) |
| bool | get_1num_op (cexpr_t **o1, cexpr_t **o2) |
| Get pointers to operands. | |
| bool | get_1num_op (const cexpr_t **o1, const cexpr_t **o2) const |
Public Attributes | |
| union { | |
| cnumber_t * n | |
| used for cot_num | |
| fnumber_t * fpc | |
| used for cot_fnum | |
| struct { | |
| union { | |
| var_ref_t v | |
| used for cot_var | |
| ea_t obj_ea | |
| used for cot_obj | |
| } | |
| int refwidth | |
| how many bytes are accessed? (-1: none) | |
| } | |
| struct { | |
| cexpr_t * x | |
| the first operand of the expression | |
| union { | |
| cexpr_t * y | |
| the second operand of the expression | |
| carglist_t * a | |
| argument list (used for cot_call) | |
| uint32 m | |
| member offset (used for cot_memptr, cot_memref) for unions, the member number | |
| } | |
| union { | |
| cexpr_t * z | |
| the third operand of the expression | |
| int ptrsize | |
| memory access size (used for cot_ptr, cot_memptr) | |
| } | |
| } | |
| cinsn_t * insn | |
| an embedded statement, they are prohibited at the final maturity stage (CMAT_FINAL) | |
| char * helper | |
| helper name (used for cot_helper) | |
| char * string | |
| string constant (used for cot_str) | |
| }; | |
| typestring | type |
| expression type. must be carefully maintained | |
| int | exflags |
| Expression attributes | |
Ctree element: expression.
Depending on the exact expression item type, various fields of this structure are used.
hexrays_sample2.cpp, hexrays_sample3.cpp, and hexrays_sample5.cpp.
Definition at line 1617 of file hexrays.hpp.
| void cexpr_t::calc_type | ( | bool | recursive | ) |
Calculate the type of the expression.
Use this function to calculate the expression type when a new expression is built
| recursive | if true, types of all children expression will be calculated before calculating our type |
Definition at line 4366 of file hexrays.hpp.
References hexdsp.
| void cexpr_t::cleanup | ( | void | ) |
Cleanup the expression.
This function properly deletes all children and sets the item type to cot_empty.
Definition at line 4348 of file hexrays.hpp.
References hexdsp.
| bool cexpr_t::contains_operator | ( | ctype_t | needed_op | ) | const |
Check if the expression contains the specified operator.
| needed_op | operator code to search for |
Definition at line 4384 of file hexrays.hpp.
References hexdsp.
| bool cexpr_t::equal_effect | ( | const cexpr_t & | r | ) | const |
Compare two expressions.
This function tries to compare two expressions in an 'intelligent' manner. For example, it knows about commutitive operators and can ignore useless casts.
| r | the expression to compare against the current expression |
Definition at line 4372 of file hexrays.hpp.
References hexdsp.
Get pointers to operands.
at last one operand should be a number o1 will be pointer to the number
Definition at line 2502 of file hexrays.hpp.
References cot_num, citem_t::op, x, and y.
| bool cexpr_t::get_const_value | ( | uint64 * | np | ) | const |
Get expression value.
| np | Pointer to the variable where the expression value is returned. |
Definition at line 1792 of file hexrays.hpp.
References cot_num.
| int cexpr_t::get_nbits | ( | int | pbits | ) | const |
Get number of bits that can really be used by the expression.
For example, x % 16 uses only 4 bits
Definition at line 4390 of file hexrays.hpp.
References hexdsp.
| bool cexpr_t::has_side_effects | ( | void | ) | const |
Check if the expression has side effects.
Calls, pre/post inc/dec, and assignments have side effects.
Definition at line 4402 of file hexrays.hpp.
References hexdsp.
| bool cexpr_t::is_call_object_of | ( | const citem_t * | parent | ) | const |
Is call object?.
Definition at line 1748 of file hexrays.hpp.
References cot_call, and citem_t::op.
| bool cexpr_t::is_child_of | ( | const citem_t * | parent | ) | const |
Verify if the specified item is our parent.
| parent | possible parent item |
Definition at line 4378 of file hexrays.hpp.
References hexdsp.
| bool cexpr_t::is_nice_cond | ( | void | ) | const |
Is nice condition?.
Nice condition is a nice expression of the boolean type.
Definition at line 1745 of file hexrays.hpp.
| bool cexpr_t::is_nice_expr | ( | void | ) | const |
Is nice expression? Nice expressions do not contain comma operators, embedded statements, or labels.
Definition at line 1742 of file hexrays.hpp.
| uint64 cexpr_t::numval | ( | void | ) | const |
Get numeric value of the expression.
This function can be called only on cot_num expressions!
Definition at line 1767 of file hexrays.hpp.
References cot_num.
| size_t cexpr_t::print1 | ( | char * | buf, | |
| size_t | bufsize, | |||
| const cfunc_t * | func | |||
| ) | const |
Print expression into one line.
| buf | output buffer | |
| bufsize | size of the output buffer | |
| func | parent function. This argument is used to find out the referenced variable names. |
Reimplemented from citem_t.
Definition at line 4360 of file hexrays.hpp.
References hexdsp.
| void cexpr_t::put_number | ( | cfunc_t * | func, | |
| uint64 | v, | |||
| int | nbytes, | |||
| type_sign_t | sign = no_sign | |||
| ) |
Assign a number to the expression.
| n | number value | |
| nbytes | size of the number in bytes | |
| sign | number sign |
Definition at line 4354 of file hexrays.hpp.
References hexdsp.
| void cexpr_t::replace_by | ( | cexpr_t * | r | ) |
Replace the expression.
The children of the expression are abandoned (not freed). The expression pointed by 'r' is moved to 'this' expression
| r | the source expression. It is deleted after being copied |
Definition at line 4342 of file hexrays.hpp.
References hexdsp.
| bool cexpr_t::requires_lvalue | ( | const cexpr_t * | child | ) | const |
Check if the expression requires an lvalue.
| child | The function will check if this child of our expression must be an lvalue. |
Definition at line 4396 of file hexrays.hpp.
References hexdsp.
Get the other operand.
This function returns the other operand (not the specified one) for binary expressions.
Definition at line 1833 of file hexrays.hpp.