summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-29 15:20:42 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-29 15:20:42 -0700
commit5185a5f7d5654c9202c226015c4daeee43d9b897 (patch)
tree903ae4b09d0368ff77b2a2fee746bb813025ec08 /ast_to_hir.cpp
parent6e659caaa946339a2de3890a8bed091ccb65102a (diff)
Add generate_temporary to generate an anonymous temporary
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 4674cfcdd5..80489d3719 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -388,6 +388,26 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
return rhs;
}
+
+/**
+ * Generate a new temporary and add its declaration to the instruction stream
+ */
+static ir_variable *
+generate_temporary(const glsl_type *type, exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ char *name = (char *) malloc(sizeof(char) * 13);
+
+ snprintf(name, 13, "tmp_%08X", state->temp_index);
+ state->temp_index++;
+
+ ir_variable *const var = new ir_variable(type, name);
+ instructions->push_tail(var);
+
+ return var;
+}
+
+
static ir_rvalue *
get_lvalue_copy(exec_list *instructions, struct _mesa_glsl_parse_state *state,
ir_rvalue *lvalue, YYLTYPE loc)