> > That said, it looks like it is done this way because no-one needed > > anything more. It could easily be changed to handle the case of any > > number of return values. > > > Why not use ReplaceNodeWith ?I just took a look and it isn't that simple. This code is used for example to replace i32 = truncate 0x2374b48 with the first result of i32,ch = load 0x2356390, 0x2357188, 0x2356b88 <0x236ee80:0> alignment=4 This works fine right now. It fails with ReplaceNodeWith because the number of results differs. It could be made to work by using a MergeValues node to produce a node with one result out of the load, and similarly for the other examples of this kind of thing. Ciao, Duncan.
On Mon, 2008-09-01 at 15:53 +0200, Duncan Sands wrote:> > > That said, it looks like it is done this way because no-one needed > > > anything more. It could easily be changed to handle the case of any > > > number of return values. > > > > > Why not use ReplaceNodeWith ? > > I just took a look and it isn't that simple. This code is used > for example to replace > i32 = truncate 0x2374b48 > with the first result of > i32,ch = load 0x2356390, 0x2357188, 0x2356b88 <0x236ee80:0> alignment=4 > This works fine right now. It fails with ReplaceNodeWith because the > number of results differs. It could be made to work by using a MergeValues > node to produce a node with one result out of the load, and similarly for > the other examples of this kind of thing. >I think we will have to go that way since I may want to replace a "store" node also (A store node does not produce any results). In this case ReplaceNodeWith () is my only way out. Thanks, Sanjiv
> I think we will have to go that way since I may want to replace a "store" node also > (A store node does not produce any results). In this case ReplaceNodeWith () is my only way out.I agree we should go that way because it is more logical. However you can also work around the problem by calling ReplaceNodeWith yourself, and returning an SDValue with null node. Ciao, Duncan.