removed unused header
[libfirm] / ir / ana / irmemory.c
index 3c76a81..9b3343a 100644 (file)
@@ -1,13 +1,28 @@
 /*
- * Project:     libFIRM
- * File name:   ir/ana/irmemory.c
- * Purpose:     Memory disambiguator
- * Author:      Michael Beck
- * Modified by:
- * Created:     27.12.2006
- * CVS-ID:      $Id$
- * Copyright:   (c) 2006-2007 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief    Memory disambiguator
+ * @author   Michael Beck
+ * @date     27.12.2006
+ * @version  $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -69,6 +84,25 @@ static ir_node *find_base_adr(ir_node *sel, ir_entity **pEnt) {
        return ptr;
 }  /* find_base_adr */
 
+/**
+ * Check if the address can be decomposed into base PLUS offset.
+ */
+static int has_offset(ir_node *adr, int *offset) {
+       if (is_SymConst(adr)) {
+               *offset = 0;
+               return 1;
+       }
+       if (is_Sel(adr)) {
+               ir_entity *ent = get_Sel_entity(adr);
+               ir_type   *owner = get_entity_owner(ent);
+
+               if (get_type_state(owner) != layout_fixed) {
+                       /* The layout is NOT fixed yet, symbolic evaluation needed */
+               }
+       }
+       return 0;
+}  /* has_offset */
+
 /**
  * Two address expressions have the same base address,
  * check if there offsets are different.
@@ -77,6 +111,10 @@ static ir_node *find_base_adr(ir_node *sel, ir_entity **pEnt) {
  * @param adr2  The second address.
  */
 static ir_alias_relation different_offsets(ir_node *adr1, ir_node *adr2) {
+       int offset1, offset2;
+       if (has_offset(adr1, &offset1) && has_offset(adr2, &offset2)) {
+               /* */
+       }
        return may_alias;
 }  /* different_offsets */
 
@@ -143,7 +181,7 @@ static int is_arg_Proj(ir_node *node) {
        node = get_Proj_pred(node);
        if (! is_Proj(node))
                return 0;
-       return is_Start(get_Proj_pred(node) && pn_Start_T_args == get_Proj_proj(node));
+       return pn_Start_T_args == get_Proj_proj(node) && is_Start(get_Proj_pred(node));
 }  /* is_arg_Proj */
 
 /**
@@ -568,6 +606,7 @@ static void init_taken_flag(ir_type * tp) {
        }
 }  /* init_taken_flag */
 
+#if 0
 /**
  * Print the address taken state of all entities of a given type for debugging.
  */
@@ -583,6 +622,7 @@ static void print_address_taken_state(ir_type *tp) {
                }
        }
 }  /* print_address_taken_state */
+#endif
 
 /**
  * Post-walker: check for global entity address
@@ -597,11 +637,11 @@ static void check_global_address(ir_node *irn, void *env) {
                ent = get_SymConst_entity(irn);
        } else if (is_Sel(irn) && get_Sel_ptr(irn) == tls) {
                /* A TLS variable. */
-               ent = get_SymConst_entity(irn);
+               ent = get_Sel_entity(irn);
        } else
                return;
 
-       if (get_entity_address_taken(ent) == ir_address_not_taken) {
+       if (get_entity_address_taken(ent) >= ir_address_taken) {
                /* Already at the maximum. */
                return;
        }