remove ENTITY_INVALID
[cparser] / ast2firm.c
index 9dd2a57..65794f5 100644 (file)
@@ -44,7 +44,7 @@
 #include "types.h"
 #include "type_hash.h"
 #include "mangle.h"
-#include "walk_statements.h"
+#include "walk.h"
 #include "warning.h"
 #include "printer.h"
 #include "entitymap_t.h"
@@ -741,7 +741,6 @@ ir_type *get_ir_type(type_t *type)
 
        case TYPE_TYPEOF:
        case TYPE_TYPEDEF:
-       case TYPE_INVALID:
                break;
        }
        if (firm_type == NULL)
@@ -1820,10 +1819,16 @@ static ir_node *process_builtin_call(const call_expression_t *call)
        case bk_gnu_builtin_ffs:
                 return gen_unary_builtin(ir_bk_ffs,      call->arguments->expression, function_type, dbgi);
        case bk_gnu_builtin_clz:
+       case bk_gnu_builtin_clzl:
+       case bk_gnu_builtin_clzll:
                 return gen_unary_builtin(ir_bk_clz,      call->arguments->expression, function_type, dbgi);
        case bk_gnu_builtin_ctz:
+       case bk_gnu_builtin_ctzl:
+       case bk_gnu_builtin_ctzll:
                 return gen_unary_builtin(ir_bk_ctz,      call->arguments->expression, function_type, dbgi);
        case bk_gnu_builtin_popcount:
+       case bk_gnu_builtin_popcountl:
+       case bk_gnu_builtin_popcountll:
        case bk_ms__popcount:
                 return gen_unary_builtin(ir_bk_popcount, call->arguments->expression, function_type, dbgi);
        case bk_gnu_builtin_parity:
@@ -3109,7 +3114,7 @@ bool constant_is_negative(const expression_t *expression)
 
 long fold_constant_to_int(const expression_t *expression)
 {
-       if (expression->kind == EXPR_INVALID)
+       if (expression->kind == EXPR_ERROR)
                return 0;
 
        ir_tarval *tv = fold_constant_to_tarval(expression);
@@ -3122,7 +3127,7 @@ long fold_constant_to_int(const expression_t *expression)
 
 bool fold_constant_to_bool(const expression_t *expression)
 {
-       if (expression->kind == EXPR_INVALID)
+       if (expression->kind == EXPR_ERROR)
                return false;
        ir_tarval *tv = fold_constant_to_tarval(expression);
        return !tarval_is_null(tv);
@@ -3325,7 +3330,6 @@ static ir_node *classify_type_to_firm(const classify_type_expression_t *const ex
                        /* typedef/typeof should be skipped already */
                        case TYPE_TYPEDEF:
                        case TYPE_TYPEOF:
-                       case TYPE_INVALID:
                        case TYPE_ERROR:
                                break;
                }
@@ -3518,6 +3522,12 @@ static ir_node *label_address_to_firm(const label_address_expression_t *label)
        return new_d_SymConst(dbgi, mode_P_code, value, symconst_addr_ent);
 }
 
+static ir_node *error_to_firm(const expression_t *expression)
+{
+       ir_mode *mode = get_ir_mode_arithmetic(expression->base.type);
+       return new_Bad(mode);
+}
+
 /**
  * creates firm nodes for an expression. The difference between this function
  * and expression_to_firm is, that this version might produce mode_b nodes
@@ -3583,9 +3593,8 @@ static ir_node *_expression_to_firm(const expression_t *expression)
        case EXPR_LABEL_ADDRESS:
                return label_address_to_firm(&expression->label_address);
 
-       case EXPR_UNKNOWN:
-       case EXPR_INVALID:
-               break;
+       case EXPR_ERROR:
+               return error_to_firm(expression);
        }
        panic("invalid expression found");
 }
@@ -5485,8 +5494,8 @@ static void statement_to_firm(statement_t *statement)
 #endif
 
        switch (statement->kind) {
-       case STATEMENT_INVALID:
-               panic("invalid statement found");
+       case STATEMENT_ERROR:
+               panic("error statement found");
        case STATEMENT_EMPTY:
                /* nothing */
                return;