From: Christian Würdig Date: Tue, 28 Feb 2006 15:21:25 +0000 (+0000) Subject: adapted to new abi interface X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=b0c542989cfbeab0b39bc96c5f6e9120c1325a9c;p=libfirm adapted to new abi interface --- diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 803218f0a..f13ac4480 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -145,9 +145,10 @@ static const arch_register_req_t *ia32_get_irn_reg_req(const void *self, arch_re return req; } else if (is_Start_Proj(irn)) { - irn_req = ops->cg->reg_param_req[get_Proj_proj(irn)]; +/* irn_req = ops->cg->reg_param_req[get_Proj_proj(irn)]; assert(irn_req && "missing requirement for regparam"); - memcpy(req, &(irn_req->req), sizeof(*req)); + memcpy(req, &(irn_req->req), sizeof(*req)); */ + memcpy(req, &(ia32_default_req_ia32_gp.req), sizeof(*req)); return req; //return NULL; } @@ -288,6 +289,12 @@ static arch_irn_flags_t ia32_get_flags(const void *self, const ir_node *irn) { } } +static void ia32_set_stack_bias(const void *self, ir_node *irn, int bias) { + if (get_ia32_use_frame(irn)) { + /* TODO: correct offset */ + } +} + /* fill register allocator interface */ static const arch_irn_ops_if_t ia32_irn_ops_if = { @@ -295,7 +302,8 @@ static const arch_irn_ops_if_t ia32_irn_ops_if = { ia32_set_irn_reg, ia32_get_irn_reg, ia32_classify, - ia32_get_flags + ia32_get_flags, + ia32_set_stack_bias }; ia32_irn_ops_t ia32_irn_ops = { @@ -699,7 +707,7 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab const arch_register_t *reg; /* set stack parameter passing style */ - be_abi_call_set_flags(abi, BE_ABI_LEFT_TO_RIGHT); + be_abi_call_set_flags(abi, BE_ABI_FRAME_POINTER_DEDICATED, 4); /* collect the mode for each type */ modes = alloca(n * sizeof(modes[0])); diff --git a/ir/be/ia32/ia32_new_nodes.c b/ir/be/ia32/ia32_new_nodes.c index 82e24c5d3..aece7a261 100644 --- a/ir/be/ia32/ia32_new_nodes.c +++ b/ir/be/ia32/ia32_new_nodes.c @@ -559,45 +559,61 @@ void set_ia32_Immop_tarval(ir_node *node, tarval *tv) { * Return the sc attribute. */ char *get_ia32_sc(const ir_node *node) { - ia32_attr_t *attr = get_ia32_attr(node); - return attr->sc; + ia32_attr_t *attr = get_ia32_attr(node); + return attr->sc; } /** * Sets the sc attribute. */ void set_ia32_sc(ir_node *node, char *sc) { - ia32_attr_t *attr = get_ia32_attr(node); - attr->sc = copy_str(attr->sc, sc); + ia32_attr_t *attr = get_ia32_attr(node); + attr->sc = copy_str(attr->sc, sc); - if (attr->cnst) { - free(attr->cnst); - } - attr->cnst = attr->sc; + if (attr->cnst) { + free(attr->cnst); + } + attr->cnst = attr->sc; } /** * Gets the string representation of the internal const (tv or symconst) */ char *get_ia32_cnst(const ir_node *node) { - ia32_attr_t *attr = get_ia32_attr(node); - return attr->cnst; + ia32_attr_t *attr = get_ia32_attr(node); + return attr->cnst; +} + +/** + * Sets the uses_frame attribute. + */ +void set_ia32_use_frame(ir_node *node, char flag) { + ia32_attr_t *attr = get_ia32_attr(node); + attr->use_frame = flag; +} + +/** + * Gets the uses_frame attribute + */ +char get_ia32_use_frame(const ir_node *node) { + ia32_attr_t *attr = get_ia32_attr(node); + return attr->use_frame; } /** * Gets the mode of the stored/loaded value (only set for Store/Load) */ ir_mode *get_ia32_ls_mode(const ir_node *node) { - ia32_attr_t *attr = get_ia32_attr(node); - return attr->ls_mode; + ia32_attr_t *attr = get_ia32_attr(node); + return attr->ls_mode; } /** * Sets the mode of the stored/loaded value (only set for Store/Load) */ void set_ia32_ls_mode(ir_node *node, ir_mode *mode) { - ia32_attr_t *attr = get_ia32_attr(node); - attr->ls_mode = mode; + ia32_attr_t *attr = get_ia32_attr(node); + attr->ls_mode = mode; } /** diff --git a/ir/be/ia32/ia32_new_nodes.h b/ir/be/ia32/ia32_new_nodes.h index 6c9e5e661..12341c329 100644 --- a/ir/be/ia32/ia32_new_nodes.h +++ b/ir/be/ia32/ia32_new_nodes.h @@ -112,6 +112,16 @@ void set_ia32_sc(ir_node *node, char *sc); */ char *get_ia32_cnst(const ir_node *node); +/** + * Sets the uses_frame attribute. + */ +void set_ia32_use_frame(ir_node *node, char flag); + +/** + * Gets the uses_frame attribute + */ +char get_ia32_use_frame(const ir_node *node); + /** * Gets the mode of the stored/loaded value (only set for Store/Load) */ diff --git a/ir/be/ia32/ia32_nodes_attr.h b/ir/be/ia32/ia32_nodes_attr.h index ccd7f85e4..f557f06d3 100644 --- a/ir/be/ia32/ia32_nodes_attr.h +++ b/ir/be/ia32/ia32_nodes_attr.h @@ -6,7 +6,7 @@ #include "firm_types.h" #include "../bearch.h" -typedef enum { flavour_Div = 1, flavour_Mod, flavour_DivMod, flavour_Mul, flavour_Mulh } ia32_op_flavour_t; +typedef enum { flavour_Div = 1, flavour_Mod, flavour_DivMod } ia32_op_flavour_t; typedef enum { pn_EAX, pn_EDX } pn_ia32_Register; typedef enum { ia32_Normal, ia32_Const, ia32_SymConst, ia32_AddrModeD, ia32_AddrModeS } ia32_op_type_t; typedef enum { @@ -25,10 +25,10 @@ typedef enum { */ enum { - ia32_O = 1, - ia32_B = 2, - ia32_I = 4, - ia32_S = 8 + ia32_O = (1 << 0), + ia32_B = (1 << 1), + ia32_I = (1 << 2), + ia32_S = (1 << 3) }; typedef enum { @@ -62,6 +62,8 @@ typedef struct _ia32_attr_t { char *sc; /**<< symconst name */ char *cnst; /**<< points to the string representation of the constant value (either tv or sc) */ + char use_frame; /**<< indicates whether the operation uses the frame pointer or not */ + ir_mode *ls_mode; /**<< the mode of the stored/loaded value */ ia32_op_flavour_t op_flav; /**<< flavour of an op (flavour_Div/Mod/DivMod/Mul/Mulh) */ diff --git a/ir/be/ia32/ia32_spec.pl b/ir/be/ia32/ia32_spec.pl index 582e78a71..fb1f39b49 100644 --- a/ir/be/ia32/ia32_spec.pl +++ b/ir/be/ia32/ia32_spec.pl @@ -91,15 +91,15 @@ $arch = "ia32"; # Last entry of each class is the largest Firm-Mode a register can hold %reg_classes = ( "gp" => [ - { "name" => "eax", "type" => 1 }, - { "name" => "edx", "type" => 1 }, - { "name" => "ebx", "type" => 2 }, - { "name" => "ecx", "type" => 1 }, - { "name" => "esi", "type" => 2 }, - { "name" => "edi", "type" => 2 }, - { "name" => "ebp", "type" => 16 }, - { "name" => "esp", "type" => 8 }, - { "name" => "xxx", "type" => 4 }, # we need a dummy register for NoReg and Unknown nodes + { "name" => "eax", "type" => 1 }, + { "name" => "edx", "type" => 1 }, + { "name" => "ebx", "type" => 2 }, + { "name" => "ecx", "type" => 1 }, + { "name" => "esi", "type" => 2 }, + { "name" => "edi", "type" => 2 }, + { "name" => "ebp", "type" => 2 }, + { "name" => "esp", "type" => 6 }, + { "name" => "xxx", "type" => 6 }, # we need a dummy register for NoReg and Unknown nodes { "mode" => "mode_P" } ], "fp" => [