Add ir_dereference constructor for structure field dereferences

This commit is contained in:
Ian Romanick 2010-04-19 15:40:49 -07:00
parent 8f755dcb67
commit 7ee79fb6b7
2 changed files with 10 additions and 0 deletions

8
ir.cpp
View file

@ -246,6 +246,14 @@ ir_dereference::ir_dereference(ir_instruction *var,
this->selector.array_index = array_index;
}
ir_dereference::ir_dereference(ir_instruction *variable, const char *field)
: mode(ir_reference_record), var(variable)
{
this->selector.field = field;
this->type = (var != NULL)
? var->type->field_type(field) : glsl_type::error_type;
}
bool
ir_dereference::is_lvalue()
{

2
ir.h
View file

@ -749,6 +749,8 @@ public:
ir_dereference(ir_instruction *variable, ir_rvalue *array_index);
ir_dereference(ir_instruction *variable, const char *field);
virtual ir_dereference *as_dereference()
{
return this;