On 21 September 2011 10:21, Eric Anholt <e...@anholt.net> wrote:

> On Tue, 20 Sep 2011 18:28:15 -0700, Kenneth Graunke <kenn...@whitecape.org>
> wrote:
> > All this does is generate a bogus value with error type; the fact that
> > it was in ir_call was rather arbitrary to begin with. ir_constant is an
> > equally arbitrary place. The rationale is that a future commit will
> > change ir_calls from rvalues to statements, and all uses of this
> > function expect an rvalue.
>
> This would make a lot more sense to me as a global
> "get_error_rvalue(ctx)" instead of a method of some arbitrary class.
>

I guess there are two questions to be answered here:

1. What type of object should we use as a placeholder in the IR for errors?
2. Where should we put the factory method that creates this object?

As to question 1, we have to choose some type, and short of creating a brand
new type to represent errors (which seems wasteful and possibly bug-prone),
ir_constant is as good as any.  It's certainly better than ir_call for the
reasons Ken stated.

As to question 2, I agree that making this a static method of ir_constant
seems kind of arbitrary--ideally the caller shouldn't know or care that the
factory method creates an ir_constant.  But I'd prefer to make it a static
method of some class so that it's less likely to be stumbled upon by someone
who doesn't need it.  How about making it a static method of ir_rvalue?
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to