On 11/04/2013 09:00 AM, Jakub Jelinek wrote:
On Mon, Nov 04, 2013 at 08:54:40AM -0500, Andrew MacLeod wrote:
What checking?  There ought to be no checking at all in this
example...  gimple_build_call_vec returns a gimple_call, and
gimple_call_set_lhs()  doesn't have to check anything because it
only accepts gimple_call's.. so there is no checking other than the
usual "does my parameter match" that the compiler has to do...
and want to replace it by checking of the types at compile time.
The problem is that it uglifies the source too much, and, when you
actually don't have a gimple_call but supposedly a base class of it,
But when you convert all the source base for gimple calls, then you
have context pretty much everywhere.. you wont be doing it from a
base class...  at least pretty infrequently.
Usually you just have IL which contains various kinds of statements,
it can be a call, assign, dozens of other gimple stmt forms.
If you need to modify something in these, you'd need to uglify with
as_a/is_a if you require everybody using these setters/getters to use
gimple_call * rather than gimple, pointer to any kind of stmt.

        Jakub
In many cases splitting out the case body and typing functions will surprisingly cover many of the the uses required. Proper subclassing will cover a lot too if the get/set methods are in the right classes. In cases where none of this works... well, there is an appropriate time for a virtual function... Thats really all those kinds off switches are implementing.... but I won't get into that meta discussion right now :-). We can save that for someday when there is actually a real proposal on the table.

Andrew

Reply via email to