#include "ircons_t.h"
#include "iropt_t.h"
#include "irop.h"
-#include "firm_common_t.h"
#include "irvrfy_t.h"
#include "irprintf.h"
#include "iredges.h"
#include "raw_bitset.h"
#include "xmalloc.h"
-#include "../bearch_t.h"
+#include "../bearch.h"
#include "../beinfo.h"
#include "bearch_ia32_t.h"
* |_|
***********************************************************************************/
-/**
- * Dumps the register requirements for either in or out.
- */
-static void dump_reg_req(FILE *F, ir_node *n, const arch_register_req_t **reqs,
- int inout) {
- char *dir = inout ? "out" : "in";
- int max = inout ? (int) arch_irn_get_n_outs(n) : get_irn_arity(n);
- char buf[1024];
- int i;
-
- memset(buf, 0, sizeof(buf));
-
- if (reqs) {
- for (i = 0; i < max; i++) {
- fprintf(F, "%sreq #%d =", dir, i);
-
- if (reqs[i]->type == arch_register_req_type_none) {
- fprintf(F, " n/a");
- }
-
- if (reqs[i]->type & arch_register_req_type_normal) {
- fprintf(F, " %s", reqs[i]->cls->name);
- }
-
- if (reqs[i]->type & arch_register_req_type_limited) {
- fprintf(F, " %s",
- arch_register_req_format(buf, sizeof(buf), reqs[i], n));
- }
-
- if (reqs[i]->type & arch_register_req_type_should_be_same) {
- unsigned other = reqs[i]->other_same;
- int i;
-
- ir_fprintf(F, " same as");
- for (i = 0; 1U << i <= other; ++i) {
- if (other & (1U << i)) {
- ir_fprintf(F, " %+F", get_irn_n(n, i));
- }
- }
- }
-
- if (reqs[i]->type & arch_register_req_type_must_be_different) {
- unsigned other = reqs[i]->other_different;
- int i;
-
- ir_fprintf(F, " different from");
- for (i = 0; 1U << i <= other; ++i) {
- if (other & (1U << i)) {
- ir_fprintf(F, " %+F", get_irn_n(n, i));
- }
- }
- }
-
- fprintf(F, "\n");
- }
-
- fprintf(F, "\n");
- }
- else {
- fprintf(F, "%sreq = N/A\n", dir);
- }
-}
-
/**
* Dumper interface for dumping ia32 nodes in vcg.
* @param n the node to dump
static int ia32_dump_node(ir_node *n, FILE *F, dump_reason_t reason) {
ir_mode *mode = NULL;
int bad = 0;
- int i, n_res, flags;
- const arch_register_req_t **reqs;
switch (reason) {
case dump_node_opcode_txt:
fputc('+', F);
}
fprintf(F, "%ld", attr->offset);
+ if (attr->no_pic_adjust) {
+ fputs("(no_pic_adjust)", F);
+ }
}
}
else {
fputc('-', F);
}
fputs(get_entity_name(attr->am_sc), F);
+ if(attr->data.am_sc_no_pic_adjust) {
+ fputs("(no_pic_adjust)", F);
+ }
}
if(attr->am_offs != 0) {
if(attr->am_offs > 0 && attr->am_sc != NULL) {
break;
case dump_node_info_txt:
- n_res = arch_irn_get_n_outs(n);
- fprintf(F, "=== IA32 attr begin ===\n");
-
- /* dump IN requirements */
- if (get_irn_arity(n) > 0) {
- reqs = get_ia32_in_req_all(n);
- dump_reg_req(F, n, reqs, 0);
- }
-
- /* dump OUT requirements */
- if (n_res > 0) {
- reqs = get_ia32_out_req_all(n);
- dump_reg_req(F, n, reqs, 1);
- }
-
- /* dump assigned registers */
- if (n_res > 0) {
- for (i = 0; i < n_res; i++) {
- const arch_register_t *reg = arch_irn_get_register(n, i);
-
- fprintf(F, "reg #%d = %s\n", i, reg ? arch_register_get_name(reg) : "n/a");
- }
- fprintf(F, "\n");
- }
+ arch_dump_reqs_and_registers(F, n);
/* dump op type */
fprintf(F, "op = ");
fprintf(F, "size = %u\n", get_ia32_copyb_size(n));
}
- fprintf(F, "n_res = %d\n", arch_irn_get_n_outs(n));
- fprintf(F, "use_frame = %d\n", is_ia32_use_frame(n));
- fprintf(F, "commutative = %d\n", is_ia32_commutative(n));
+ fprintf(F, "use_frame = %d\n", is_ia32_use_frame(n));
+ fprintf(F, "commutative = %d\n", is_ia32_commutative(n));
fprintf(F, "need stackent = %d\n", is_ia32_need_stackent(n));
- fprintf(F, "is reload = %d\n", is_ia32_is_reload(n));
- fprintf(F, "latency = %d\n", get_ia32_latency(n));
-
- /* dump flags */
- fprintf(F, "flags =");
- flags = arch_irn_get_flags(n);
- if (flags == arch_irn_flags_none) {
- fprintf(F, " none");
- }
- else {
- if (flags & arch_irn_flags_dont_spill) {
- fprintf(F, " unspillable");
- }
- if (flags & arch_irn_flags_rematerializable) {
- fprintf(F, " remat");
- }
- if (flags & arch_irn_flags_modify_flags) {
- fprintf(F, " modify_flags");
- }
- }
- fprintf(F, " (%d)\n", flags);
+ fprintf(F, "is reload = %d\n", is_ia32_is_reload(n));
+ fprintf(F, "latency = %d\n", get_ia32_latency(n));
/* dump frame entity */
fprintf(F, "frame entity = ");
fprintf(F, "\n");
#endif /* NDEBUG */
- fprintf(F, "=== IA32 attr end ===\n");
- /* end of: case dump_node_info_txt */
break;
}
return copyb_attr;
}
+ia32_climbframe_attr_t *get_ia32_climbframe_attr(ir_node *node) {
+ ia32_attr_t *attr = get_ia32_attr(node);
+ ia32_climbframe_attr_t *climbframe_attr = CAST_IA32_ATTR(ia32_climbframe_attr_t, attr);
+
+ return climbframe_attr;
+}
+
+const ia32_climbframe_attr_t *get_ia32_climbframe_attr_const(const ir_node *node) {
+ const ia32_attr_t *attr = get_ia32_attr_const(node);
+ const ia32_climbframe_attr_t *climbframe_attr = CONST_CAST_IA32_ATTR(ia32_climbframe_attr_t, attr);
+
+ return climbframe_attr;
+}
+
/**
* Gets the type of an ia32 node.
*/
attr->in_req = reqs;
}
-/**
- * Returns the result register requirements of an ia32 node.
- */
-const arch_register_req_t **get_ia32_out_req_all(const ir_node *node) {
- const ia32_attr_t *attr = get_ia32_attr_const(node);
- return attr->out_req;
-}
-
-/**
- * Sets the result register requirements of an ia32 node.
- */
-void set_ia32_out_req_all(ir_node *node, const arch_register_req_t **reqs) {
- ia32_attr_t *attr = get_ia32_attr(node);
- attr->out_req = reqs;
-}
-
/**
* Returns the argument register requirement at position pos of an ia32 node.
*/
return attr->in_req[pos];
}
-/**
- * Returns the result register requirement at position pos of an ia32 node.
- */
-const arch_register_req_t *get_ia32_out_req(const ir_node *node, int pos) {
- const ia32_attr_t *attr = get_ia32_attr_const(node);
- if(attr->out_req == NULL)
- return arch_no_register_req;
-
- return attr->out_req[pos];
-}
-
-/**
- * Sets the OUT register requirements at position pos.
- */
-void set_ia32_req_out(ir_node *node, const arch_register_req_t *req, int pos) {
- ia32_attr_t *attr = get_ia32_attr(node);
- attr->out_req[pos] = req;
-}
-
/**
* Sets the IN register requirements at position pos.
*/
-void set_ia32_req_in(ir_node *node, const arch_register_req_t *req, int pos) {
+void set_ia32_req_in(ir_node *node, const arch_register_req_t *req, int pos)
+{
ia32_attr_t *attr = get_ia32_attr(node);
attr->in_req[pos] = req;
}
/**
* Get the list of available execution units.
*/
-const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node) {
+const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node)
+{
const ia32_attr_t *attr = get_ia32_attr_const(node);
return attr->exec_units;
}
/**
* Get the exception label attribute.
*/
-unsigned get_ia32_exc_label(const ir_node *node) {
+unsigned get_ia32_exc_label(const ir_node *node)
+{
const ia32_attr_t *attr = get_ia32_attr_const(node);
return attr->data.has_except_label;
}
/**
* Set the exception label attribute.
*/
-void set_ia32_exc_label(ir_node *node, unsigned flag) {
+void set_ia32_exc_label(ir_node *node, unsigned flag)
+{
ia32_attr_t *attr = get_ia32_attr(node);
attr->data.has_except_label = flag;
}
/**
* Return the exception label id.
*/
-ir_label_t get_ia32_exc_label_id(const ir_node *node) {
+ir_label_t get_ia32_exc_label_id(const ir_node *node)
+{
const ia32_attr_t *attr = get_ia32_attr_const(node);
assert(attr->data.has_except_label);
/**
* Assign the exception label id.
*/
-void set_ia32_exc_label_id(ir_node *node, ir_label_t id) {
+void set_ia32_exc_label_id(ir_node *node, ir_label_t id)
+{
ia32_attr_t *attr = get_ia32_attr(node);
assert(attr->data.has_except_label);
*/
void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags,
const arch_register_req_t **in_reqs,
- const arch_register_req_t **out_reqs,
const be_execution_unit_t ***execution_units,
int n_res)
{
arch_irn_set_flags(node, flags);
set_ia32_in_req_all(node, in_reqs);
- set_ia32_out_req_all(node, out_reqs);
attr->exec_units = execution_units;
#ifndef NDEBUG
void
init_ia32_immediate_attributes(ir_node *res, ir_entity *symconst,
- int symconst_sign, long offset)
+ int symconst_sign, int no_pic_adjust,
+ long offset)
{
ia32_immediate_attr_t *attr = get_irn_generic_attr(res);
#ifndef NDEBUG
attr->attr.attr_type |= IA32_ATTR_ia32_immediate_attr_t;
#endif
- attr->symconst = symconst;
- attr->sc_sign = symconst_sign;
- attr->offset = offset;
+ attr->symconst = symconst;
+ attr->sc_sign = symconst_sign;
+ attr->no_pic_adjust = no_pic_adjust;
+ attr->offset = offset;
}
void init_ia32_call_attributes(ir_node* res, unsigned pop, ir_type* call_tp)
attr->pn_code = pnc;
}
+void
+init_ia32_climbframe_attributes(ir_node *res, unsigned count) {
+ ia32_climbframe_attr_t *attr = get_irn_generic_attr(res);
+
+#ifndef NDEBUG
+ attr->attr.attr_type |= IA32_ATTR_ia32_climbframe_attr_t;
+#endif
+ attr->count = count;
+}
+
/***************************************************************************************
* _ _ _
* | | | | | |
|| a->data.am_sc_sign != b->data.am_sc_sign
|| a->am_offs != b->am_offs
|| a->am_sc != b->am_sc
+ || a->data.am_sc_no_pic_adjust != b->data.am_sc_no_pic_adjust
|| a->ls_mode != b->ls_mode)
return 1;
attr_a = get_ia32_condcode_attr_const(a);
attr_b = get_ia32_condcode_attr_const(b);
- if(attr_a->pn_code != attr_b->pn_code)
+ if (attr_a->pn_code != attr_b->pn_code)
return 1;
return 0;
}
+/** Compare node attributes for call nodes. */
static int ia32_compare_call_attr(ir_node *a, ir_node *b)
{
const ia32_call_attr_t *attr_a;
attr_a = get_ia32_copyb_attr_const(a);
attr_b = get_ia32_copyb_attr_const(b);
- if(attr_a->size != attr_b->size)
+ if (attr_a->size != attr_b->size)
return 1;
return 0;
const ia32_asm_attr_t *attr_a;
const ia32_asm_attr_t *attr_b;
- if(ia32_compare_nodes_attr(a, b))
+ if (ia32_compare_nodes_attr(a, b))
return 1;
attr_a = get_ia32_asm_attr_const(a);
const ia32_immediate_attr_t *attr_a = get_ia32_immediate_attr_const(a);
const ia32_immediate_attr_t *attr_b = get_ia32_immediate_attr_const(b);
- if(attr_a->symconst != attr_b->symconst ||
- attr_a->sc_sign != attr_b->sc_sign ||
- attr_a->offset != attr_b->offset)
+ if (attr_a->symconst != attr_b->symconst
+ || attr_a->sc_sign != attr_b->sc_sign
+ || attr_a->no_pic_adjust != attr_b->no_pic_adjust
+ || attr_a->offset != attr_b->offset) {
return 1;
+ }
return 0;
}
return ia32_compare_nodes_attr(a, b);
}
+/** Compare node attributes for ClimbFrame nodes. */
+static
+int ia32_compare_climbframe_attr(ir_node *a, ir_node *b)
+{
+ const ia32_climbframe_attr_t *attr_a;
+ const ia32_climbframe_attr_t *attr_b;
+
+ if (ia32_compare_nodes_attr(a, b))
+ return 1;
+
+ attr_a = get_ia32_climbframe_attr_const(a);
+ attr_b = get_ia32_climbframe_attr_const(b);
+
+ if (attr_a->count != attr_b->count)
+ return 1;
+
+ return 0;
+}
/* copies the ia32 attributes */
static void ia32_copy_attr(const ir_node *old_node, ir_node *new_node)
const ia32_attr_t *attr_old = get_ia32_attr_const(old_node);
ia32_attr_t *attr_new = get_ia32_attr(new_node);
backend_info_t *old_info = be_get_info(old_node);
- backend_info_t *new_info;
-
- new_info = be_get_info(new_node);
+ backend_info_t *new_info = be_get_info(new_node);
/* copy the attributes */
memcpy(attr_new, attr_old, get_op_attr_size(get_irn_op(old_node)));