Commit b0c54298 authored by Christian Würdig's avatar Christian Würdig
Browse files

adapted to new abi interface

parent 61ce0229
......@@ -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]));
......
......@@ -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;
}
/**
......
......@@ -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)
*/
......
......@@ -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) */
......
......@@ -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" => [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment