* Expression kinds.
*/
typedef enum expression_kind_t {
- EXPR_UNKNOWN = 0,
- EXPR_INVALID,
+ EXPR_INVALID = 0,
EXPR_REFERENCE,
EXPR_REFERENCE_ENUM_VALUE,
EXPR_LITERAL_BOOLEAN,
EXPR_UNARY_PREFIX_INCREMENT,
EXPR_UNARY_PREFIX_DECREMENT,
EXPR_UNARY_CAST,
- EXPR_UNARY_CAST_IMPLICIT, /**< compiler generated cast */
EXPR_UNARY_ASSUME, /**< MS __assume() */
EXPR_UNARY_DELETE,
EXPR_UNARY_DELETE_ARRAY,
case EXPR_UNARY_PREFIX_INCREMENT: \
case EXPR_UNARY_PREFIX_DECREMENT: \
case EXPR_UNARY_CAST: \
- case EXPR_UNARY_CAST_IMPLICIT: \
case EXPR_UNARY_ASSUME: \
case EXPR_UNARY_DELETE: \
case EXPR_UNARY_DELETE_ARRAY:
#ifndef NDEBUG
bool transformed : 1; /**< Set if this expression was transformed. */
#endif
+ bool implicit : 1; /**< compiler generated expression.
+ Examples:
+ select into anonymous structs
+ implicit casts
+ */
};
/**
struct literal_expression_t {
expression_base_t base;
string_t value;
- symbol_t *suffix;
+ string_t suffix;
/* ast2firm data */
- tarval *target_value;
+ ir_tarval *target_value;
};
struct string_literal_expression_t {
expression_base_t base;
expression_t *compound;
entity_t *compound_entry;
- bool implicit : 1; /**< compiler generated select
- (for anonymous struct/union) */
};
struct array_access_expression_t {
statement_t *global_asm;
};
-static inline void *_allocate_ast(size_t size)
-{
- return obstack_alloc(&ast_obstack, size);
-}
-
static inline bool is_invalid_expression(expression_t *expression)
{
return expression->base.kind == EXPR_INVALID;
return statement->base.kind == STATEMENT_INVALID;
}
-#define allocate_ast(size) _allocate_ast(size)
-
/**
* Allocate an AST node with given size and
* initialize all fields with zero.
*/
static inline void *allocate_ast_zero(size_t size)
{
- void *res = allocate_ast(size);
- memset(res, 0, size);
- return res;
+ return memset(obstack_alloc(&ast_obstack, size), 0, size);
}
+/** If set, implicit casts are printed. */
+extern bool print_implicit_casts;
+/** If set parenthesis are printed to indicate operator precedence. */
+extern bool print_parenthesis;
+
#endif