external declaration of dominance debug functions

2011-05-23 Thread Piervit
Hello,

Here is a two lines patch, allowing to use debug_dominance_info and
debug_dominance_tree functions outside of gcc/dominance.c. For the
moment, those functions are not declared in any gcc/*.h files (as far as
I know after trying a grep). I have added them as external functions
into gcc/basic-block.h. I feel this is useful to be able to call those
functions from others files, for exemple from plugins.

ChangeLog:

2011-05-23  Pierre Vittet  

* basic-block.h (debug_dominance_info, debug_dominance_tree):
  Add declaration.Index: gcc/basic-block.h
===
--- gcc/basic-block.h	(revision 174056)
+++ gcc/basic-block.h	(working copy)
@@ -882,6 +882,9 @@ extern basic_block get_bb_copy (basic_block);
 void set_loop_copy (struct loop *, struct loop *);
 struct loop *get_loop_copy (struct loop *);
 
+extern void debug_dominance_info (enum cdi_direction dir);
+extern void debug_dominance_tree (enum cdi_direction dir, basic_block root);
+
 #include "cfghooks.h"
 
 /* Return true when one of the predecessor edges of BB is marked with EDGE_EH.  */


Re: external declaration of dominance debug functions

2011-05-23 Thread Piervit
Le Mon, 23 May 2011 11:30:34 +0200,
Richard Guenther  a écrit :

> On Mon, May 23, 2011 at 10:33 AM, Piervit  wrote:
> > Hello,
> >
> > Here is a two lines patch, allowing to use debug_dominance_info and
> > debug_dominance_tree functions outside of gcc/dominance.c. For the
> > moment, those functions are not declared in any gcc/*.h files (as
> > far as I know after trying a grep). I have added them as external
> > functions into gcc/basic-block.h. I feel this is useful to be able
> > to call those functions from others files, for exemple from plugins.
> 
> debug_* functions are supposed to be used from interactive gdb
> sessions. They should not be advertised in public headers.
> 
> Richard.
> 
> > ChangeLog:
> >
> > 2011-05-23  Pierre Vittet  
> >
> >        * basic-block.h (debug_dominance_info, debug_dominance_tree):
> >          Add declaration.

Thank you for your answer. I am sorry I was not aware of this rule.
However I have try the following command in the gcc/ directory:

pierre@zenwalk gcc %grep " debug_*" *.h | wc -l
231

And the majority of the result are debug_* functions in header file,
such as extern void debug_tree (tree); in tree.h, extern void
debug_pass (void); in tree-pass.h and many others.


[PATCH] comment precising need to use free_dominance_info

2011-05-11 Thread piervit
After using function flow_loops_find in cfgloop.c, it is needed to use 
free_dominance_info to clear structure which have beend added by the 
use of calculate_dominance_info.


I have added a comment precising this.

My contributor number is 634276.


ChangeLog:
2011-05-11  Pierre Vittet  

* cfgloop.c (flow_loops_find): Add comment remembering to call
free_dominance_info
Index: gcc/cfgloop.c
===
--- gcc/cfgloop.c   (revision 173677)
+++ gcc/cfgloop.c   (working copy)
@@ -368,6 +368,11 @@ init_loops_structure (struct loops *loops, unsigne
 
 /* Find all the natural loops in the function and save in LOOPS structure and
recalculate loop_depth information in basic block structures.
+
+   This function calls calculate_dominance_info which allocates a structure to
+   handle dominance. It must be freed after use with the function
+   free_dominance_info.
+
Return the number of natural loops found.  */
 
 int


[PATCH, MELT] remove useless use of var in gcc/Makefile.in

2011-05-16 Thread piervit

Hello,

this patch is for the MELT branch.

My GCC contributor number is 634276.

In a previous commit MELTHERE_CFLAGS was remove. I could still find a 
few references to it in the gcc/Makefile.in. I have also removed 
MELTHERE_CC1_CFLAGS as it takes its value from a subset of 
MELTHERE_CFLAGS


This patch removes them (with no incidence as MELTHERE_CFLAGS was 
empty).


Changelog

2011-05-16  Pierre Vittet  

* Makefile.in: remove useless use of MELTHERE_CFLAGS,
remove variable MELTHERE_CC1_CFLAGS, as it takes its arg from
MELTHERE_CLAGS.


Thanks!
Index: gcc/Makefile.in
===
--- gcc/Makefile.in (revision 173793)
+++ gcc/Makefile.in (working copy)
@@ -5338,9 +5338,8 @@ melt_make_move=$(SHELL) $(srcdir)/../move-if-chang
 ## Don't use := definitions here!
 ## CC1 forbids -pipe and -Wp,-D_FORTIFY_SOURCE=2
 comma= ,
-MELTHERE_CC1_CFLAGS=$(filter-out -pipe -Wp$(comma)-D_FORTIFY_SOURCE=2, 
$(MELTHERE_CFLAGS))
-melt_make_cc1flags= -I. $(MELTHERE_CC1_CFLAGS)
-melt_cflags=  -I. $(MELTHERE_CFLAGS) -I $(srcdir)/melt/generated/ $(INCLUDES)
+melt_make_cc1flags= -I. 
+melt_cflags=  -I. -I $(srcdir)/melt/generated/ $(INCLUDES)
 export melt_cflags
 ## extra cflags are for compiling applicative MELT files, e.g. xtramelt*.c
 melt_extra_cflags= -g
@@ -5372,10 +5371,10 @@ include $(srcdir)/melt-build.mk
 melt.encap: cc1$(exeext) $(melt_make_cc1_dependency)
echo melt.encap making Makefile and melt-build.mk
$(MAKE) Makefile $(srcdir)/melt-build.mk
-   echo melt.encap making warmelt0 with MELTHERE_CFLAGS= 
$(MELTHERE_CFLAGS) melt_cflags= $(melt_cflags)
+   echo melt.encap making warmelt0 with melt_cflags= $(melt_cflags)
$(MAKE) warmelt0
-   echo melt.encap making warmelt1 with MELTHERE_CFLAGS= 
$(MELTHERE_CFLAGS) melt_cflags= $(melt_cflags)
-## MELTHERE_CFLAGS & melt_cflags are exported!
+   echo melt.encap making warmelt1 with melt_cflags= $(melt_cflags)
+##  melt_cflags are exported!
$(MAKE) warmelt1
echo melt.encap making warmelt2
$(MAKE) warmelt2