[LLVMdev] Anderson's analysis, getresult instruction on x86_64

Prakash Prabhu
Tue, 05 Aug 2008 18:02:45 -0000

Thanks for the replies, Daniel and Matthijs. I added some code to generate
the copy constraint, which I think (in the present form) is wrong (or at
best not field sensitive):

+void Andersens::visitGetResultInst(GetResultInst &GR) {
+       if (isa<PointerType>(GR.getType()))
+       {
+               // P1 = getresult P2 --> <Copy/P1/P2>
+               Constraints.push_back(Constraint(Constraint::Copy,
getNodeValue(GR),
+
getNode(GR.getOperand(0))));
+       }
+}

Take for example the getresult statement:

%mrv_gr = getresult { i64*, i64* } %74, 0 ; ; <i64*> [#uses=1]

The above code would add the constraint as Copy/%mrv_gr/%74 instead of
Copy/%mrv_gr/%74.0 (the actual field which is a pointer). Is there a way in
which
one can extract the Value* of the appropriate field of getresult using the
index (0 in this case) and the base structure (%74) ? (or is this what you
were refering to: "For aggregates in memory, the pointer to the part of the
aggregate can simply be used, but no such thing for first class values.",
Matthjis ?)

Since in all the programs on which I am running Andersen's analysis, the
only usage of getresult is in accessing non-pointers:

%mrv_gr205 = getresult { i64, i64 } %615, 1     ; <i64> [#uses=1]

, for now, it seems to be ok to just ignore such instructions for pointer
analysis (by the above code).

thanks,
Prakash
On Tue, Aug 5, 2008 at 3:59 AM, Matthijs Kooijman <matthijs at stdin.nl>
wrote:

> Hi Prakash,
>
> I think this is highly related to PR2527 [1] and PR2451 [2]. I assume you
> are
> using LLVM 2.3, since current svn automatically replaces getresult with
> extractvalue instructions (but doesn't help for Andersen's).
>
> In either case, it seems that Andersen's currently has no ready made
way to
> indicate a part of a first-class aggregate (or vector), which is the
> essence
> of the problem here.  For aggregates in memory, the pointer to the part of
> the
> aggregate can simply be used, but no such thing for first class values.
>
> I'm not really into how Andersen's works, so I won't be able to
help you
> along
> with this any further, I'm afraid.
>
> Gr.
>
> Matthijs
>
> [1]: http://llvm.org/bugs/show_bug.cgi?id=2557
> [2]: http://llvm.org/bugs/show_bug.cgi?id=2451
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFImAhXz0nQ5oovr7wRApujAJ0ZtHgcQ4H0fQy3b4icmz/KyPzqdQCgm60q
> YzBoZwlCD26HQ+T5oiMLhGY> =uEvB
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080805/63d68934/attachment.html>