OSDN Git Service

2009-05-08 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / graphite.h
index 92a6816..a270065 100644 (file)
@@ -1,5 +1,5 @@
 /* Gimple Represented as Polyhedra.
-   Copyright (C) 2006, 2007, 2008  Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
    Contributed by Sebastian Pop <sebastian.pop@inria.fr>.
 
 This file is part of GCC.
@@ -23,6 +23,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "tree-data-ref.h"
 
+int ref_nb_loops (data_reference_p);
+
 typedef struct graphite_bb *graphite_bb_p;
 DEF_VEC_P(graphite_bb_p);
 DEF_VEC_ALLOC_P (graphite_bb_p, heap);
@@ -216,6 +218,8 @@ gbb_loop (struct graphite_bb *gbb)
   return GBB_BB (gbb)->loop_father;
 }
 
+int nb_loops_around_gb (graphite_bb_p);
+
 /* Calculate the number of loops around GB in the current SCOP.  Only
    works if GBB_DOMAIN is built.  */
 
@@ -275,13 +279,36 @@ DEF_VEC_ALLOC_P (name_tree, heap);
    by two edges.  */
 typedef struct sese
 {
+  /* Single ENTRY and single EXIT from the SESE region.  */
   edge entry, exit;
+
+  /* REGION_BASIC_BLOCKS contains the set of all the basic blocks
+     belonging to the SESE region.  */
   struct pointer_set_t *region_basic_blocks;
+
+  /* An SSA_NAME version is flagged in the LIVEOUT bitmap if the
+     SSA_NAME is defined inside and used outside the SESE region.  */
+  bitmap liveout;
+
+  /* The overall number of SSA_NAME versions used to index LIVEIN.  */
+  int num_ver;
+
+  /* For each SSA_NAME version VER in LIVEOUT, LIVEIN[VER] contains
+     the set of basic blocks indices that contain a use of VER.  */
+  bitmap *livein;
 } *sese;
 
 #define SESE_ENTRY(S) (S->entry)
 #define SESE_EXIT(S) (S->exit)
 #define SESE_REGION_BBS(S) (S->region_basic_blocks)
+#define SESE_LIVEOUT(S) (S->liveout)
+#define SESE_LIVEIN(S) (S->livein)
+#define SESE_LIVEIN_VER(S, I) (S->livein[I])
+#define SESE_NUM_VER(S) (S->num_ver)
+
+extern sese new_sese (edge, edge);
+extern void free_sese (sese);
+extern void sese_build_livein_liveouts (sese);
 
 /* A SCOP is a Static Control Part of the program, simple enough to be
    represented in polyhedral form.  */
@@ -290,13 +317,11 @@ struct scop
   /* A SCOP is defined as a SESE region.  */
   sese region;
 
-  /* All the basic blocks in this scop.  They have extra information
-     attached to them, in the graphite_bb structure.  */
+  /* All the basic blocks in this scop that contain memory references
+     and that will be represented as statements in the polyhedral
+     representation.  */
   VEC (graphite_bb_p, heap) *bbs;
 
-  /* Set for a basic block index when it belongs to this SCOP.  */
-  bitmap bbs_b;
-
   lambda_vector static_schedule;
 
   /* Parameters used within the SCOP.  */
@@ -319,10 +344,13 @@ struct scop
      can only add new params before generating the bb domains, otherwise they
      become invalid.  */
   bool add_params;
+
+  /* LIVEOUT_RENAMES registers the rename mapping that has to be
+     applied after code generation.  */
+  htab_t liveout_renames;
 };
 
 #define SCOP_BBS(S) S->bbs
-#define SCOP_BBS_B(S) S->bbs_b
 #define SCOP_REGION(S) S->region
 /* SCOP_ENTRY bb dominates all the bbs of the scop.  SCOP_EXIT bb
    post-dominates all the bbs of the scop.  SCOP_EXIT potentially
@@ -341,6 +369,7 @@ struct scop
 #define SCOP_PROG(S) S->program
 #define SCOP_LOOP2CLOOG_LOOP(S) S->loop2cloog_loop
 #define SCOP_LOOPS_MAPPING(S) S->loops_mapping
+#define SCOP_LIVEOUT_RENAMES(S) S->liveout_renames
 
 extern void debug_scop (scop_p, int);
 extern void debug_scops (int);
@@ -544,59 +573,4 @@ scop_gimple_loop_depth (scop_p scop, loop_p loop)
   return depth;
 }
 
-/* Static inline function prototypes.  */
-
-static inline unsigned scop_nb_params (scop_p scop);
-
-/* Returns true when BB is in SCOP.  */
-
-static inline bool
-bb_in_scop_p (basic_block bb, scop_p scop)
-{
-  return bitmap_bit_p (SCOP_BBS_B (scop), bb->index);
-}
-
-/* Returns true when LOOP is in SCOP.  */
-
-static inline bool 
-loop_in_scop_p (struct loop *loop, scop_p scop)
-{
-  return (bb_in_scop_p (loop->header, scop)
-         && bb_in_scop_p (loop->latch, scop));
-}
-
-/* Calculate the number of loops around LOOP in the SCOP.  */
-
-static inline int
-nb_loops_around_loop_in_scop (struct loop *l, scop_p scop)
-{
-  int d = 0;
-
-  for (; loop_in_scop_p (l, scop); d++, l = loop_outer (l));
-
-  return d;
-}
-
-/* Calculate the number of loops around GB in the current SCOP.  */
-
-static inline int
-nb_loops_around_gb (graphite_bb_p gb)
-{
-  return nb_loops_around_loop_in_scop (gbb_loop (gb), GBB_SCOP (gb));
-}
-
-/* Returns the dimensionality of an enclosing loop iteration domain
-   with respect to enclosing SCoP for a given data reference REF.  The
-   returned dimensionality is homogeneous (depth of loop nest + number
-   of SCoP parameters + const).  */
-
-static inline int
-ref_nb_loops (data_reference_p ref)
-{
-  loop_p loop = loop_containing_stmt (DR_STMT (ref));
-  scop_p scop = DR_SCOP (ref);
-
-  return nb_loops_around_loop_in_scop (loop, scop) + scop_nb_params (scop) + 2;
-}
-
 #endif  /* GCC_GRAPHITE_H  */