* @brief This file implements the creation of the achitecture specific firm
* opcodes and the coresponding node constructors for the sparc
* assembler irg.
- * @version $Id: TEMPLATE_new_nodes.c 26673 2009-10-01 16:43:13Z matze $
+ * @version $Id$
*/
#include "config.h"
/**
* Dumper interface for dumping sparc nodes in vcg.
- * @param n the node to dump
* @param F the output file
+ * @param n the node to dump
* @param reason indicates which kind of information should be dumped
- * @return 0 on success or != 0 on failure
*/
-static int sparc_dump_node(ir_node *n, FILE *F, dump_reason_t reason)
+static void sparc_dump_node(FILE *F, ir_node *n, dump_reason_t reason)
{
ir_mode *mode = NULL;
}
break;
+ case dump_node_info_txt:
+ arch_dump_reqs_and_registers(F, n);
+ break;
+
case dump_node_nodeattr_txt:
/* TODO: dump some attributes which should show up */
/* in node name in dump (e.g. consts or the like) */
+ //fputs("\n", F);
- break;
+ if (is_sparc_FrameAddr(n)) {
+ const sparc_symconst_attr_t *attr = get_sparc_symconst_attr_const(n);
+ fprintf(F, "fp_offset: 0x%X\n", attr->fp_offset);
+ }
+
+ if (is_sparc_Load(n) || is_sparc_Store(n)) {
+ const sparc_load_store_attr_t *attr = get_sparc_load_store_attr_const(n);
+ fprintf(F, "offset: 0x%lX\n", attr->offset);
+ fprintf(F, "is_frame_entity: %s\n", attr->is_frame_entity == true ? "true" : "false");
+ }
- case dump_node_info_txt:
- arch_dump_reqs_and_registers(F, n);
break;
}
-
- return 0;
}
/* ATTRIBUTE INIT SETTERS / HELPERS */
return (const sparc_attr_t *)get_irn_generic_attr_const(node);
}
-
-
sparc_load_store_attr_t *get_sparc_load_store_attr(ir_node *node)
{
assert(is_sparc_irn(node) && "need sparc node to get attributes");
return (const sparc_jmp_switch_attr_t *)get_irn_generic_attr_const(node);
}
-
sparc_cmp_attr_t *get_sparc_cmp_attr(ir_node *node)
{
assert(is_sparc_irn(node) && "need sparc node to get attributes");
return (const sparc_cmp_attr_t *)get_irn_generic_attr_const(node);
}
+
+sparc_save_attr_t *get_sparc_save_attr(ir_node *node)
+{
+ assert(is_sparc_Save(node) && "need sparc Save node to get attributes");
+ return (sparc_save_attr_t *)get_irn_generic_attr_const(node);
+}
+
+const sparc_save_attr_t *get_sparc_save_attr_const(const ir_node *node)
+{
+ assert(is_sparc_Save(node) && "need sparc Save node to get attributes");
+ return (const sparc_save_attr_t *)get_irn_generic_attr_const(node);
+}
+
/**
* Returns the argument register requirements of a sparc node.
*/
/**
* Initializes the nodes attributes.
*/
-void init_sparc_attributes(ir_node *node, arch_irn_flags_t flags,
- const arch_register_req_t **in_reqs,
- const be_execution_unit_t ***execution_units,
- int n_res)
+static void init_sparc_attributes(ir_node *node, arch_irn_flags_t flags,
+ const arch_register_req_t **in_reqs,
+ const be_execution_unit_t ***execution_units,
+ int n_res)
{
ir_graph *irg = get_irn_irg(node);
struct obstack *obst = get_irg_obstack(irg);
attr->fp_offset = 0;
}
+static void init_sparc_save_attr(ir_node *res, int initial_stacksize)
+{
+ sparc_save_attr_t *attr = get_irn_generic_attr(res);
+ attr->initial_stacksize = initial_stacksize;
+}
+
/**
* copies sparc attributes of node
*/
-static void sparc_copy_attr(const ir_node *old_node, ir_node *new_node)
+static void sparc_copy_attr(ir_graph *irg, const ir_node *old_node,
+ ir_node *new_node)
{
- ir_graph *irg = get_irn_irg(new_node);
- struct obstack *obst = get_irg_obstack(irg);
- const sparc_attr_t *attr_old = get_sparc_attr_const(old_node);
+ struct obstack *obst = get_irg_obstack(irg);
+ const sparc_attr_t *attr_old = get_sparc_attr_const(old_node);
sparc_attr_t *attr_new = get_sparc_attr(new_node);
- backend_info_t *old_info = be_get_info(old_node);
- backend_info_t *new_info = be_get_info(new_node);
+ backend_info_t *old_info = be_get_info(old_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)));
|| attr_a->is_unsigned != attr_b->is_unsigned;
}
+static int cmp_attr_sparc_save(ir_node *a, ir_node *b)
+{
+ const sparc_save_attr_t *attr_a = get_sparc_save_attr_const(a);
+ const sparc_save_attr_t *attr_b = get_sparc_save_attr_const(b);
+
+ if (cmp_attr_sparc(a, b))
+ return 1;
+
+ return attr_a->initial_stacksize != attr_b->initial_stacksize;
+}
+
/* Include the generated constructor functions */
#include "gen_sparc_new_nodes.c.inl"