From 8c4cde7e0d1bc59fd171d8e443c382b4711db342 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Sun, 19 Nov 2006 16:16:57 +0000 Subject: [PATCH] added function and call attribute to set register class for call address --- ir/be/beabi.c | 31 +++++++++++++++++++++---------- ir/be/beabi.h | 7 +++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 5785089b5..79f4343f9 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -50,10 +50,11 @@ typedef struct _be_abi_call_arg_t { } be_abi_call_arg_t; struct _be_abi_call_t { - be_abi_call_flags_t flags; - const be_abi_callbacks_t *cb; - ir_type *between_type; - set *params; + be_abi_call_flags_t flags; + const be_abi_callbacks_t *cb; + ir_type *between_type; + set *params; + const arch_register_class_t *cls_addr; }; struct _be_abi_irg_t { @@ -160,10 +161,18 @@ static INLINE be_abi_call_arg_t *get_call_arg(be_abi_call_t *call, int is_res, i /* Set the flags for a call. */ void be_abi_call_set_flags(be_abi_call_t *call, be_abi_call_flags_t flags, const be_abi_callbacks_t *cb) { - call->flags = flags; - call->cb = cb; + call->flags = flags; + call->cb = cb; } + +/* Set register class for call address */ +void be_abi_call_set_call_address_reg_class(be_abi_call_t *call, const arch_register_class_t *cls) +{ + call->cls_addr = cls; +} + + void be_abi_call_param_stack(be_abi_call_t *call, int arg_pos, unsigned alignment, unsigned space_before, unsigned space_after) { be_abi_call_arg_t *arg = get_or_set_call_arg(call, 0, arg_pos, 1); @@ -202,11 +211,14 @@ be_abi_call_flags_t be_abi_call_get_flags(const be_abi_call_t *call) static be_abi_call_t *be_abi_call_new(void) { be_abi_call_t *call = xmalloc(sizeof(call[0])); + call->flags.val = 0; call->params = new_set(cmp_call_arg, 16); call->cb = NULL; + call->cls_addr = NULL; call->flags.bits.try_omit_fp = be_omit_fp; + return call; } @@ -623,11 +635,10 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp, i get_Call_type(irn)); /* - TODO: - Set the register class of the call address to the same as the stack pointer's. - That' probably buggy for some architectures. + Set the register class of the call address to the same as the stack pointer's + if it's not set by the backend in the abi callback. */ - be_node_set_reg_class(low_call, be_pos_Call_ptr, sp->reg_class); + be_node_set_reg_class(low_call, be_pos_Call_ptr, call->cls_addr ? call->cls_addr : sp->reg_class); DBG((env->dbg, LEVEL_3, "\tcreated backend call %+F\n", low_call)); diff --git a/ir/be/beabi.h b/ir/be/beabi.h index c1868a35d..0409d4402 100644 --- a/ir/be/beabi.h +++ b/ir/be/beabi.h @@ -93,6 +93,13 @@ struct _be_abi_callbacks_t { */ void be_abi_call_set_flags(be_abi_call_t *call, be_abi_call_flags_t flags, const be_abi_callbacks_t *cb); +/** + * Set register class for call address. + * @param call The call. + * @param cls The register class for call address. + */ +void be_abi_call_set_call_address_reg_class(be_abi_call_t *call, const arch_register_class_t *cls); + void be_abi_call_param_stack(be_abi_call_t *call, int pos, unsigned alignment, unsigned space_before, unsigned space_after); void be_abi_call_param_reg(be_abi_call_t *call, int pos, const arch_register_t *reg); void be_abi_call_res_reg(be_abi_call_t *call, int pos, const arch_register_t *reg); -- 2.20.1