added new attributes for abstract machine
[libfirm] / ir / be / ia32 / ia32_new_nodes.c
index 8da3718..fe8656a 100644 (file)
@@ -35,6 +35,7 @@
 #include "ia32_nodes_attr.h"
 #include "ia32_new_nodes.h"
 #include "gen_ia32_regalloc_if.h"
+#include "gen_ia32_machine.h"
 
 /**
  * Returns the ident of a SymConst.
@@ -976,7 +977,7 @@ void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs) {
  */
 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos) {
        ia32_attr_t *attr = get_ia32_attr(node);
-       return attr->in_req[pos];
+       return attr->in_req != NULL ? attr->in_req[pos] : NULL;
 }
 
 /**
@@ -984,7 +985,7 @@ const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos) {
  */
 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos) {
        ia32_attr_t *attr = get_ia32_attr(node);
-       return attr->out_req[pos];
+       return attr->out_req != NULL ? attr->out_req[pos] : NULL;
 }
 
 /**
@@ -1092,6 +1093,14 @@ arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos) {
        return pos < (int)attr->data.n_res ? attr->out_flags[pos] : arch_irn_flags_none;
 }
 
+/**
+ * Get the list of available execution units.
+ */
+const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node) {
+       ia32_attr_t *attr = get_ia32_attr(node);
+       return attr->exec_units;
+}
+
 #ifndef NDEBUG
 
 /**
@@ -1339,18 +1348,22 @@ const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos) {
  * Initializes the nodes attributes.
  */
 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs,
-                                                 const ia32_register_req_t **out_reqs, int n_res, unsigned latency)
+                                                 const ia32_register_req_t **out_reqs, const be_execution_unit_t ***execution_units,
+                                                 int n_res, unsigned latency)
 {
        ia32_attr_t *attr = get_ia32_attr(node);
+
        set_ia32_flags(node, flags);
        set_ia32_in_req_all(node, in_reqs);
        set_ia32_out_req_all(node, out_reqs);
        set_ia32_latency(node, latency);
+       set_ia32_n_res(node, n_res);
+
+       attr->exec_units = execution_units;
 
        attr->out_flags = NEW_ARR_D(int, get_irg_obstack(get_irn_irg(node)), n_res);
        memset(attr->out_flags, 0, n_res * sizeof(attr->out_flags[0]));
 
-       attr->data.n_res = n_res;
        memset((void *)attr->slots, 0, n_res * sizeof(attr->slots[0]));
 }