> But secondly, why make that restriction at all? Suppose I have a function > to which a language semantics requires passing by reference. Now suppose > the operand is "a + b". Why not just make an ADDR_EXPR of the PLUS_EXPR? > > Sure, the front end *could* make a temporary, but the gimplifier has all > the logic already to do that, so why shouldn't it? > > The whole point of the gimplifier is to avoid making too many restrictions > on what are valid trees: it's GIMPLE where we want to make those > restrictions. It seems very duplicative to me to say that the process of > creating temporaries for certain expressable trees is the job of the front > end and for others is the job of the gimplifier? Why not just be > consistent and say it's the gimplifier's job to do all of them?
But only where the semantics are well defined. I can think of several different possible semantics for talking the address of arbitrary things. Consider "foo(&(a+b), &(a+b))" Is it ok to pass the same address for both arguments? Should the location pointed to be modifiable or readonly? IMHO it's best to make things like this explicit. That way there's no disagreement over which language defined semantics we should be using. Paul