Re: [PATCH 3/3] allow to normalize the pseudos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 3, 2017 at 12:34 AM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> Using the output of test-linearize for testing is not
> ideal because some details of this output are very dependent
> to small changes in linearization or optimization while the
> test in itself may very well not concerned about those changes.
>
> One of the things that are particulary sensitive to these changes
> is the number of the pseudos (%r123, ...).
>
> Make these tests much less sensitive to these changes by adding
> a normalization phase called just before emitting the output.
> This normalization will renumber all the pseudos sequentially,
> restarting at %r1 at each functions.

I have a totally untested idea might be able to simplify this
normalize process. It seems most of the pseudo output is
come from show_pseudo(). We can use the generation number
idea. All we need to do is just keep track of the base of the pseudo
number. If you need new series of number just set the base to a number bigger
than all of the pseudo number. That might means make alloc_pseudo::nr
visible to other function we know what is the max pseudo number.

Initialize the normalization is easy, just set
     pseudo_base = ++pseudo_max;

Then in show_pseudo() we can do the normalize as following:

if (pseudo->nr - pseudo_base < 0)
     pseudo->nr = ++pseudo_max;

For the output of the number, we have:
nr = pseudo->nr - pseudo_base;


One problem I can see if the pseudo->nr wrap around then it
will create confusion. Maybe not some thing we need to worry
about any time soon. Another thing is the pseudo->nr only
make sense in the function scope. We might able to use that
to handle overflowing if it really became a problem.

Might have some other problem as I haven't try to code it myself.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux