added attribute for load/store
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 24 Feb 2006 10:22:06 +0000 (10:22 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 24 Feb 2006 10:22:06 +0000 (10:22 +0000)
extended dumper

ir/be/ia32/ia32_new_nodes.c
ir/be/ia32/ia32_new_nodes.h
ir/be/ia32/ia32_nodes_attr.h
ir/be/ia32/ia32_optimize.c
ir/be/ia32/ia32_transform.c

index 2f5fd78..a498094 100644 (file)
@@ -190,16 +190,16 @@ static int dump_node_ia32(ir_node *n, FILE *F, dump_reason_t reason) {
                case dump_node_mode_txt:
                        mode = get_irn_mode(n);
 
-                       if (is_ia32_Load(n)) {
-                               mode = get_irn_mode(get_irn_n(n, 0));
-                       }
-                       else if (is_ia32_Store(n)) {
-                               mode = get_irn_mode(get_irn_n(n, 2));
+                       if (is_ia32_Load(n) || is_ia32_Store(n)) {
+                               mode = get_ia32_ls_mode(n);
                        }
 
                        if (mode) {
                                fprintf(F, "[%s]", get_mode_name(mode));
                        }
+                       else {
+                               fprintf(F, "[?NOMODE?]");
+                       }
                        break;
 
                case dump_node_nodeattr_txt:
@@ -216,11 +216,13 @@ static int dump_node_ia32(ir_node *n, FILE *F, dump_reason_t reason) {
                                fprintf(F, "[%s%s]", pref, get_ia32_cnst(n));
                        }
 
-                       if (is_ia32_AddrModeS(n)) {
-                               fprintf(F, "[AM S] ");
-                       }
-                       else if (is_ia32_AddrModeD(n)) {
-                               fprintf(F, "[AM D] ");
+                       if (! is_ia32_Lea(n)) {
+                               if (is_ia32_AddrModeS(n)) {
+                                       fprintf(F, "[AM S] ");
+                               }
+                               else if (is_ia32_AddrModeD(n)) {
+                                       fprintf(F, "[AM D] ");
+                               }
                        }
 
                        break;
@@ -571,6 +573,22 @@ char *get_ia32_cnst(ir_node *node) {
   return attr->cnst;
 }
 
+/**
+ * Gets the mode of the stored/loaded value (only set for Store/Load)
+ */
+ir_mode *get_ia32_ls_mode(const ir_node *node) {
+  ia32_attr_t *attr = get_ia32_attr(node);
+  return attr->ls_mode;
+}
+
+/**
+ * Sets the mode of the stored/loaded value (only set for Store/Load)
+ */
+void set_ia32_ls_mode(ir_node *node, ir_mode *mode) {
+  ia32_attr_t *attr = get_ia32_attr(node);
+  attr->ls_mode     = mode;
+}
+
 /**
  * Returns the argument register requirements of an ia32 node.
  */
index 00f2fd9..7948154 100644 (file)
@@ -112,6 +112,16 @@ void set_ia32_sc(ir_node *node, char *sc);
  */
 char *get_ia32_cnst(ir_node *node);
 
+/**
+ * Gets the mode of the stored/loaded value (only set for Store/Load)
+ */
+ir_mode *get_ia32_ls_mode(const ir_node *node);
+
+/**
+ * Sets the mode of the stored/loaded value (only set for Store/Load)
+ */
+void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
+
 /**
  * Returns the argument register requirements of an ia32 node.
  */
index 0eac7ee..1555c8f 100644 (file)
@@ -61,6 +61,8 @@ typedef struct _ia32_attr_t {
        char   *sc;   /**<< symconst name */
        char   *cnst; /**<< points to the string representation of the constant value (either tv or sc) */
 
+       ir_mode *ls_mode;  /**<< the mode of the stored/loaded value */
+
        ia32_op_flavour_t op_flav;   /**<< flavour of an op (flavour_Div/Mod/DivMod/Mul/Mulh) */
        long              pn_code;   /**<< projnum "types" (e.g. indicate compare operators and argument numbers) */
        long              n_res;     /**<< number of results */
index bf14c2f..cf40e88 100644 (file)
@@ -387,6 +387,7 @@ static ir_node *fold_addr(ir_node *irn, firm_dbg_module_t *mod, ir_node *noreg)
                                scale = get_tarval_long(get_ia32_Immop_tarval(temp));
 
                                if (scale <= 3) {
+                                       scale = 1 << scale;
                                        index = get_irn_n(temp, 2);
 
                                        DBG((mod, LEVEL_1, "\tgot scaled index %+F\n", index));
index 517d12d..569b6de 100644 (file)
@@ -1107,6 +1107,8 @@ static ir_node *gen_Load(ia32_transform_env_t *env) {
        }
 
        set_ia32_am_support(new_op, ia32_am_Source);
+       set_ia32_ls_mode(new_op, get_Load_mode(node));
+
        return new_op;
 }
 
@@ -1134,6 +1136,7 @@ ir_node *gen_Store(ia32_transform_env_t *env) {
        }
 
        set_ia32_am_support(new_op, ia32_am_Dest);
+       set_ia32_ls_mode(new_op, get_irn_mode(get_Store_value(node)));
        return new_op;
 }