On 21 September 2011 10:21, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net">eric@anholt.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, 20 Sep 2011 18:28:15 -0700, Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
> All this does is generate a bogus value with error type; the fact that<br>
> it was in ir_call was rather arbitrary to begin with. ir_constant is an<br>
> equally arbitrary place. The rationale is that a future commit will<br>
> change ir_calls from rvalues to statements, and all uses of this<br>
> function expect an rvalue.<br>
<br>
</div>This would make a lot more sense to me as a global<br>
"get_error_rvalue(ctx)" instead of a method of some arbitrary class.<br></blockquote><div><br>I guess there are two questions to be answered here:<br><br>1. What type of object should we use as a placeholder in the IR for errors?<br>
2. Where should we put the factory method that creates this object?<br><br>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.<br>
<br>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?<br>
</div></div>