Suppose I have in my CFG (among others) two basic blocks A and B, with an edge from A to B. I need to do the following: * get the set S of live values across that edge * map each of them to another value (S->S') * replace - in B and its successors - all the uses of values in S with the mapped values (S') Does LLVM provide an easy way to do this (because I can't seem to be able to find it)? If not, do you have any suggestions about how to do it? -- Carlo Alberto Ferraris <cafxx at strayorange.com <mailto:cafxx at strayorange.com>> website/blog <http://cafxx.strayorange.com> - +39 333 7643 235 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110614/618810c8/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: cafxx.vcf Type: text/x-vcard Size: 233 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110614/618810c8/attachment.vcf>
Il 14/06/2011 18:17, Carlo Alberto Ferraris ha scritto:> Suppose I have in my CFG (among others) two basic blocks A and B, with > an edge from A to B. I need to do the following: > > * get the set S of live values across that edge >I forgot to add that it doesn't have to be exactely the set of live values: it can also be an overapproximation, i.e. S might contain also values that are not live anymore -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110614/98b64823/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: cafxx.vcf Type: text/x-vcard Size: 233 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110614/98b64823/attachment.vcf>
From the fact that nobody is replying I guess there's no easy way to do what I asked. Can you just confirm then that the following is a meaningful way to do it? * D_b <- set of dominators of BB b * S_b <- set containing b and its successors (optional) * VD_b <- set of the values defined in D_b * VS_b <- set of the values with uses in S_b (optional) * LV_b <- VD_b ∩ VS_b, i.e. the live values (optional, otherwise LV_b = VD_b) * create the value mapping LV_b -> LV'_b * apply the mapping to the uses in VS_b the points marked (optional) are needed only if we don't want an overapproximation of the set of live values. To keep things simple, let's assume that b has a single predecessor. Is this correct? Any flaws? -- Carlo Alberto Ferraris <cafxx at strayorange.com <mailto:cafxx at strayorange.com>> website/blog <http://cafxx.strayorange.com> - +39 333 7643 235 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110615/8c82b618/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: cafxx.vcf Type: text/x-vcard Size: 233 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110615/8c82b618/attachment.vcf>