+/**
+ * Check the mode of a Load/Store with the mode of the entity
+ * that is accessed.
+ * If the mode of the entity and the Load/Store mode do not match, we
+ * have the bad reinterpret case:
+ *
+ * int i;
+ * char b = *(char *)&i;
+ *
+ * We do NOT count this as one value and return address_taken
+ * in that case.
+ * However, we support an often used case. If the mode is two-complement
+ * we allow casts between signed/unsigned.
+ *
+ * @param mode the mode of the Load/Store
+ * @param ent_mode the mode of the accessed entity
+ */
+static int check_load_store_mode(ir_mode *mode, ir_mode *ent_mode) {
+ if (ent_mode != mode) {
+ if (ent_mode == NULL ||
+ get_mode_size_bits(ent_mode) != get_mode_size_bits(mode) ||
+ get_mode_sort(ent_mode) != get_mode_sort(mode) ||
+ get_mode_arithmetic(ent_mode) != irma_twos_complement ||
+ get_mode_arithmetic(mode) != irma_twos_complement)
+ return 0;
+ }
+ return 1;
+}
+