diff options
author | Eric Anholt <eric@anholt.net> | 2010-03-26 12:16:54 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-26 17:51:41 -0700 |
commit | 76ea56c007263ec3b79234e7b775e3a7b519a54a (patch) | |
tree | e96b9a789bcb97362419a8ba36df25dd800f93aa | |
parent | de38f0ed53c80f87478c3899d4ff1bc3a601ea6b (diff) |
Add support for ast_to_hir of pre inc/dec.
-rw-r--r-- | ast_to_hir.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index f8ca371034..67fed4cc89 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -656,7 +656,26 @@ ast_expression::hir(exec_list *instructions, case ast_conditional: case ast_pre_inc: - case ast_pre_dec: + case ast_pre_dec: { + op[0] = this->subexpressions[0]->hir(instructions, state); + if (op[0]->type->base_type == GLSL_TYPE_FLOAT) + op[1] = new ir_constant(1.0f); + else + op[1] = new ir_constant(1); + + type = arithmetic_result_type(op[0]->type, op[1]->type, + false, state); + + struct ir_rvalue *temp_rhs; + temp_rhs = new ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, op[0], temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } case ast_post_inc: case ast_post_dec: { |