summaryrefslogtreecommitdiff
path: root/ast_function.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-06-09 17:31:02 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-11 15:37:34 -0700
commit1a872b1af37927d689ec7af0921af7f3a9dcb1fd (patch)
tree75fc725b62572c32cddd293d3f67376c6bd917b5 /ast_function.cpp
parent253dedeb6c3beb5192e76b5abafce58a302d9066 (diff)
Do simple constant folding while processing function call parameters
Diffstat (limited to 'ast_function.cpp')
-rw-r--r--ast_function.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/ast_function.cpp b/ast_function.cpp
index f0c1f0409a..b0700bed5f 100644
--- a/ast_function.cpp
+++ b/ast_function.cpp
@@ -36,7 +36,11 @@ process_parameters(exec_list *instructions, exec_list *actual_parameters,
foreach_list (n, parameters) {
ast_node *const ast = exec_node_data(ast_node, n, link);
- ir_rvalue *const result = ast->hir(instructions, state);
+ ir_rvalue *result = ast->hir(instructions, state);
+
+ ir_constant *const constant = result->constant_expression_value();
+ if (constant != NULL)
+ result = constant;
actual_parameters->push_tail(result);
count++;