On Sun, Feb 5, 2012 at 10:56 AM, Amker.Cheng <amker.ch...@gmail.com> wrote:
> Hi,
> In PRE, function compute_antic_aux uses bitmap_set_subtract to compute
> value/expression set subtraction.
>
> The comment of bitmap_set_subtract says it subtracts all the values
> and expressions contained in ORIG from DEST.
>
> But the implementation as following
> ---------------------------------------------------
> static bitmap_set_t
> bitmap_set_subtract (bitmap_set_t dest, bitmap_set_t orig)
> {
>  bitmap_set_t result = bitmap_set_new ();
>  bitmap_iterator bi;
>  unsigned int i;
>
>  bitmap_and_compl (&result->expressions, &dest->expressions,
>                    &orig->expressions);
>
>  FOR_EACH_EXPR_ID_IN_SET (result, i, bi)
>    {
>      pre_expr expr = expression_for_id (i);
>      unsigned int value_id = get_expr_value_id (expr);
>      bitmap_set_bit (&result->values, value_id);
>    }
>
>  return result;
> }
>
> Does it just subtract the expressions, rather than values. And It
> resets values according to the resulting expression.
>
> I am a little confused here. Any explanation?

It's probably to have the SET in some canonical form - the resulting
values are simply re-computed from the expression subtraction
(multiple expressions may have the same value, so in
{ a, b } { 0 } - { a } { 0 } you need to either compute { } { } or { b } { 0 }
neither which you can reach by simply subtracting both bitmaps.

The function should probably be named bitmap_set_subtract_expressions
though, complement to bitmap_set_subtract_values.

Richard.

> Thanks very much.
> --
> Best Regards.

Reply via email to