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;
}
}
}
+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 = {
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 = {
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]));
* 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;
}
/**
*/
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)
*/
#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 {
*/
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 {
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) */
# 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" => [