Hi Henrique, I'm glad to hear you're working on this!
> How can I update the phi-function v2 = phi(v0, v1)? I need to know > from which control flow edge the parameter v0 comes, so that I can > add a copy like this: You can do: phi->block()->getPredecessor(0), we guarantee that the predecessors of a phi's block are in the same order as the phi's operands. Not all phis will have exactly two predecessors though, so if you shrink the operand list, just make sure to shrink the block's predecessor list as well. -David On 07/16/2012 01:35 PM, Henrique Santos wrote: > Dear guys, > > I am trying to implement an optimization in IonMonkey that consists > in removing unreachable basic blocks. However, I am having problems > to implement it, because I do not know how to update the > phi-functions once I remove a block. For instance, if I have this > program: > > L0: v0 = 0 goto L2 > > L1: v1 = 1 > > L2: v2 = phi(v0, v1) print v2 > > I want to eliminate L1, and then the program would be like: > > L0: v0 = 0 goto L2: > > L2: v2 = phi(v0, ??) print v2 > > How can I update the phi-function v2 = phi(v0, v1)? I need to know > from which control flow edge the parameter v0 comes, so that I can > add a copy like this: > > L2: v2 = v0 print v2 > > However, I do not know how to find from which edge v0 comes. Is there > any example of code in your repository in which basic blocks are > removed? Or, otherwise, is it possible to find out the correct > parameter of a phi-function that is associated with a CFG edge? > > Thank you very much, > > Henrique. _______________________________________________ > dev-tech-js-engine-internals mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals > _______________________________________________ dev-tech-js-engine-internals mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

