glsl: Use ir_rvalue to represent generic error_type values.
Currently, ir_call can be used as either a statement (for void functions) or a value (for non-void functions). This is rather awkward, as it's the only class that can be used in both forms. A number of places use ir_call::get_error_instruction() to construct a generic value of error_type. If ir_call is to become a statement, it can no longer serve this purpose. Unfortunately, none of our classes are particularly well suited for this, and creating a new one would be rather aggrandizing. So, this patch introduces ir_rvalue::error_value(), a static method that creates an instance of the base class, ir_rvalue. This has the nice property that you can't accidentally try and access uninitialized fields (as it doesn't have any). The downside is that the base class is no longer abstract. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -1458,13 +1458,13 @@ ir_function::has_user_signature()
|
||||
}
|
||||
|
||||
|
||||
ir_call *
|
||||
ir_call::get_error_instruction(void *ctx)
|
||||
ir_rvalue *
|
||||
ir_rvalue::error_value(void *mem_ctx)
|
||||
{
|
||||
ir_call *call = new(ctx) ir_call;
|
||||
ir_rvalue *v = new(mem_ctx) ir_rvalue;
|
||||
|
||||
call->type = glsl_type::error_type;
|
||||
return call;
|
||||
v->type = glsl_type::error_type;
|
||||
return v;
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user