allow backend to specify endianess, rewrite bitfield emitter to handle little and...
[libfirm] / ir / be / ia32 / ia32_address_mode.c
index 8acfdbf..112baae 100644 (file)
@@ -36,7 +36,8 @@
 #include "iredges_t.h"
 #include "irgwalk.h"
 
-#include "../benode_t.h"
+#include "../benode.h"
+#include "../belive.h"
 
 #define AGGRESSIVE_AM
 
@@ -86,6 +87,9 @@ static int do_is_immediate(const ir_node *node, int *symconsts, int negate)
                        return 0;
 
                return 1;
+       case iro_Unknown:
+               /* we can use '0' for Unknowns */
+               return 1;
        case iro_Add:
        case iro_Sub:
                /* Add's and Sub's are typically supported as long as both operands are
@@ -115,7 +119,8 @@ static int do_is_immediate(const ir_node *node, int *symconsts, int negate)
  * @return non-zero if the DAG represents an immediate, 0 else
  */
 #if 0
-static int is_immediate_simple(const ir_node *node) {
+static int is_immediate_simple(const ir_node *node)
+{
        int symconsts = 0;
        return do_is_immediate(node, &symconsts, 0);
 }
@@ -171,6 +176,8 @@ static void eat_immediate(ia32_address_t *addr, ir_node *node, int negate)
 #endif
                addr->symconst_sign = negate;
                break;
+       case iro_Unknown:
+               break;
        case iro_Add:
                assert(!ia32_is_non_address_mode_node(node));
                left  = get_Add_left(node);
@@ -299,7 +306,6 @@ static int eat_shl(ia32_address_t *addr, ir_node *node)
 /* Create an address mode for a given node. */
 void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, ia32_create_am_flags_t flags)
 {
-       int      res = 0;
        ir_node *eat_imms;
 
        if (is_immediate(addr, node, 0)) {
@@ -327,7 +333,6 @@ void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, ia32_create_a
                        eat_imms = ia32_skip_downconv(eat_imms);
                }
 
-               res  = 1;
                node = eat_imms;
 #ifndef AGGRESSIVE_AM
                if (get_irn_n_edges(node) > 1) {
@@ -519,10 +524,9 @@ static void mark_non_address_nodes(ir_node *node, void *env)
        }
 }
 
-void ia32_calculate_non_address_mode_nodes(be_irg_t *birg)
+void ia32_calculate_non_address_mode_nodes(ir_graph *irg)
 {
-       ir_graph *irg = be_get_birg_irg(birg);
-       be_lv_t  *lv  = be_assure_liveness(birg);
+       be_lv_t  *lv  = be_assure_liveness(irg);
 
        non_address_mode_nodes = bitset_malloc(get_irg_last_idx(irg));