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: GIMPLE and intent of variables


On Wed, Aug 17, 2011 at 9:38 AM, grabekm90 <grabekm90@wp.pl> wrote:
>
>
>
> Jeff Law wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 08/16/11 15:35, grabekm90 wrote:
>>
>>> How to resolve a problem with pointers (especially arrays)? For
>>> example, we have a GIMPLE function:
>>>
>>> set_a (int * a) { int * D.2701; D.2701 = a + 40; *D.2701 = 7; }
>>>
>>> This is equivalent code in C:
>>>
>>> void set_a(int * a) { a[10] = 107; }
>>>
>>> GIMPLE tries to avoid operations on the left side of the assign sign.
>>> There is a problem because I want to identify local variable (D.2701)
>>> with function parameter (a). In this case "a" is output parameter. I
>>> could follow a behavior of parameters in my plugin, but I suppose
>>> that GIMPLE makes accessible better solution, doesn't it?
>> Adding/subtracting from a pointer should result in another pointer to a
>> different part of the same object. ?So anytime I saw
>> <whatever> = <pointer> +- index
>>
>> I'd record that <whatever> was a derived pointer.
>>
>> jeff
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.11 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iQEcBAEBAgAGBQJOSuPvAAoJEBRtltQi2kC7p6AH/3x6EXhLr4os3FjFklvNdJk6
>> FsGYnl9l3ZxRzYv5TyS6Pe2hzZaRPzZyF0a6r6/pZ9KqxlBA7XQwIAxjBnW37+DK
>> LypIeCz7IeQDqPnB2OV9e271Q+b6EWPhSg/csAAeGqKtmixjwNC2Zjkgjbf5Anmn
>> WtSyo12A2b16f24I/bHw36frupcBF7adMBK5CyQVthoMkbVsporvG9Yz4NX/vmF+
>> 2UPGw3wap9SIsMEs9bG/OA13Q2WsQS7EJw2n5GH4gdlEwMmd6e8WsuQ0802SkHdX
>> aVgwIJ0xQbk2RuVnRb8244u+6AOuVT4yVVvHJ5QGfON/UoLFUKa1SPUXRSRLKaM=
>> =HggP
>> -----END PGP SIGNATURE-----
>>
>>
>
> ?The question is: how can we get to know, using GIMPLE mechanism, from which
> parameter a pointer derives?

There are none.  You can use SSA mechanisms to look up the definition
chain or use points-to information (but that doesn't give you information
about the offset).

Richard.

> --
> View this message in context: http://old.nabble.com/GIMPLE-and-intent-of-variables-tp32275433p32277626.html
> Sent from the gcc - patches mailing list archive at Nabble.com.
>
>


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