This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, MELT] add dominance functions


I have corrected my patch with your remarks.

Especially about the debug functions, it takes the debug melt flag into account. Moreover, I have allowed the user to give a message when calling this function, as usual in MELT debug functions. Giving this message was a bit difficult (This is the only argument of the function, so this must be a MELT value, and that uneasy to convert the value into :cstring).

I have used debugeprintf macro into a code_chunk to give the MELT file + line numbers, followed by a outstr_err, which displays the user message. I think the only disavantage is that it puts an end of lines between the two informations. If you think there is a best way to do this, I am ok to try it.

The new changelog:

2011-05-20 Pierre Vittet <piervit@pvittet.com>

* melt/xtramelt-ana-base.melt
(is_dominance_info_available, is_post_dominance_info_available,
calculate_dominance_info_unsafe, calculate_post_dominance_info_unsafe,
free_dominance_info, free_post_dominance_info, calculate_dominance_info,
calculate_post_dominance_info, debug_dominance_info,
debug_post_dominance_info, get_immediate_dominator_unsafe,
get_immediate_dominator, get_immediate_post_dominator_unsafe,
get_immediate_post_dominator, dominated_by_other_unsafe,
dominated_by_other, post_dominated_by_other_unsafe,
post_dominated_by_other, foreach_dominated_unsafe,
dominated_by_bb_iterator): Add primitives, functions, iterators for using
dominance info.



On 19/05/2011 07:32, Basile Starynkevitch wrote:
On Wed, 18 May 2011 21:04:39 +0200
Pierre Vittet<piervit@pvittet.com>  wrote:

Hello,

I have written a patch to allow the use of the GCC dominance functions
into MELT.
[...]

Changelog:
2011-05-17  Pierre Vittet<piervit@pvittet.com>

      * melt/xtramelt-ana-base.melt
      (is_dominance_info_available, is_post_dominance_info_available,
      calculate_dominance_info_unsafe,
      calculate_post_dominance_info_unsafe,
      free_dominance_info, free_post_dominance_info,
      calculate_dominance_info,
      calculate_post_dominance_info, debug_dominance_info,
      debug_post_dominance_info, get_immediate_dominator_unsafe,
      get_immediate_dominator, get_immediate_post_dominator_unsafe,
      get_immediate_post_dominator, dominated_by_other_unsafe,
      dominated_by_other, post_dominated_by_other_unsafe,
      post_dominated_by_other, foreach_dominated_unsafe,
      dominated_by_bb_iterator): Add primitives, functions, iterators for
      using dominance info.


Thanks for the patch. Some minor tweaks:

First, put a space between formal arguments list&  function name.
So

+(defprimitive calculate_dominance_info_unsafe() :void
should be
+(defprimitive calculate_dominance_info_unsafe () :void

Then, please put the defined name on the same line that defprimitive or
defun or def... When consecutive MELT formals have the same ctype, you
don't need to repeat it

So

+(defprimitive
+  dominated_by_other_unsafe(:basic_block bbA :basic_block bbB) :long

should be

+(defprimitive dominated_by_other_unsafe (:basic_block bbA bbB) :long

In :doc strings, document when something is a boxed value
(distinction between values&  stuffs is crucial), so write instead
[I added the boxed word, it is important]

+(defun get_immediate_dominator (bb)
+ :doc#{Return the next immediate dominator of the boxed basic_block
$BB as a MELT +value.}#

At last, all debug* operations should only output debug to stderr only
when flag_melt_debug is set and give the MELT source position (because
we don't want any debug printing in the usual case when -fmelt-debug is
not given to our cc1) Look at debugloop in xtramelt-ana-base.melt for
an example (notice that debugeprintfnonl is a C macro printing the MELT
source position.


So please resubmit a slightly improved patch.


Regards.

Attachment: add_dominance_functions-173936.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]