From 28362d2d53cdffacca7b192133690c09cb1fdaa3 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sat, 17 Nov 2007 19:40:31 +0000 Subject: [PATCH] Generate IR for calling function pointers. [r18459] --- ast2firm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index 2ec9b96..f0be12e 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -701,8 +701,15 @@ static ir_node *call_expression_to_firm(const call_expression_t *call) expression_t *function = call->function; ir_node *callee = expression_to_firm(function); - assert(function->datatype->type == TYPE_FUNCTION); - function_type_t *function_type = (function_type_t*) function->datatype; + function_type_t *function_type; + if (function->datatype->type == TYPE_POINTER) { + pointer_type_t *const ptr_type = (pointer_type_t*)function->datatype; + assert(ptr_type->points_to->type == TYPE_FUNCTION); + function_type = (function_type_t*)ptr_type->points_to; + } else { + assert(function->datatype->type == TYPE_FUNCTION); + function_type = (function_type_t*)function->datatype; + } int n_parameters = 0; call_argument_t *argument = call->arguments; -- 2.20.1