From 57792749098270252db0be98c7e5eef489718bd1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Wed, 11 Jan 2006 16:20:15 +0000 Subject: [PATCH] added new function for getting register from node --- ir/be/ia32/ia32_emitter.h | 2 +- ir/be/ia32/ia32_new_nodes.c | 13 +++++++++++++ ir/be/ia32/ia32_new_nodes.h | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ir/be/ia32/ia32_emitter.h b/ir/be/ia32/ia32_emitter.h index c37ea1019..047093238 100644 --- a/ir/be/ia32/ia32_emitter.h +++ b/ir/be/ia32/ia32_emitter.h @@ -17,7 +17,7 @@ const lc_arg_env_t *ia32_get_arg_env(void); void equalize_dest_src(FILE *F, ir_node *n); -int get_ia32_in_regnr(ir_node *irn, int pos); +int get_ia32_reg_nr(ir_node *irn, int posi, int in_out); const char *get_ia32_in_reg_name(ir_node *irn, int pos); void ia32_gen_routine(FILE *F, ir_graph *irg, const arch_env_t *env); diff --git a/ir/be/ia32/ia32_new_nodes.c b/ir/be/ia32/ia32_new_nodes.c index 19a6fc062..0e05f3dae 100644 --- a/ir/be/ia32/ia32_new_nodes.c +++ b/ir/be/ia32/ia32_new_nodes.c @@ -403,6 +403,19 @@ int get_ia32_out_regnr(const ir_node *node, int pos) { return attr->slots[pos]->index; } +/** + * Returns the OUT register at position pos. + */ +const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos) { + asmop_attr *attr = get_ia32_attr(node); + + assert(is_ia32_irn(node) && "Not an ia32 node."); + assert(pos < attr->n_res && "Invalid OUT position."); + assert(attr->slots[pos] && "No register assigned"); + + return attr->slots[pos]; +} + /** * Sets the number of results. */ diff --git a/ir/be/ia32/ia32_new_nodes.h b/ir/be/ia32/ia32_new_nodes.h index 5e44f7d7e..2c0189603 100644 --- a/ir/be/ia32/ia32_new_nodes.h +++ b/ir/be/ia32/ia32_new_nodes.h @@ -40,8 +40,9 @@ const arch_register_t **get_ia32_slots(const ir_node *node); void set_ia32_regreq_out(ir_node *node, const arch_register_req_t *req, int pos); void set_ia32_regreq_in(ir_node *node, const arch_register_req_t *req, int pos); -const char *get_ia32_out_reg_name(const ir_node *node, int pos); -int get_ia32_out_regnr(const ir_node *node, int pos); +const char *get_ia32_out_reg_name(const ir_node *node, int pos); +int get_ia32_out_regnr(const ir_node *node, int pos); +const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos); int is_ia32_irn(const ir_node *node); -- 2.20.1