added call-projnum-requirement magic
[libfirm] / ir / be / bearch.h
index 59bcacc..3801a87 100644 (file)
@@ -1,7 +1,10 @@
 #ifndef _FIRM_BEARCH_H
 #define _FIRM_BEARCH_H
 
-#include "firm_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 
 #ifdef WITH_LIBCORE
 #include <libcore/lc_opts.h>
@@ -21,8 +24,6 @@
 
 typedef struct _arch_register_class_t     arch_register_class_t;
 typedef struct _arch_register_t           arch_register_t;
-typedef struct _arch_enum_t               arch_enum_t;
-typedef struct _arch_enum_member_t        arch_enum_member_t;
 typedef struct _arch_isa_if_t             arch_isa_if_t;
 typedef struct _arch_isa_t                arch_isa_t;
 typedef struct _arch_env_t                arch_env_t;
@@ -107,33 +108,6 @@ _arch_register_for_index(const arch_register_class_t *cls, int idx)
  */
 #define arch_get_register_set_for_class(cls) ((cls)->set)
 
-/**
- * An immediate.
- */
-struct _arch_immediate_t {
-  const char *name;         /**< The name of the immediate. */
-  ir_mode *mode;            /**< The mode of the immediate. */
-};
-
-/**
- * The member of an enum.
- */
-struct _arch_enum_member_t {
-  arch_enum_t *enm;         /**< The enum, this member belongs to. */
-};
-
-/**
- * An enumeration operand type.
- *
- * Enumeration operand types can be used to describe the variants
- * of an instruction, like giving the cases for a compare (gt, lt,
- * eq, ...) some other special attributes of an instruction.
- */
-struct _arch_enum_t {
-  int n_members;                    /**< The number of members in this enum. */
-  arch_enum_member_t *members[1];   /**< The array of members. */
-};
-
 typedef enum _arch_operand_type_t {
   arch_operand_type_invalid,
   arch_operand_type_memory,
@@ -163,18 +137,23 @@ typedef enum _arch_register_req_type_t {
 
 } arch_register_req_type_t;
 
-#define arch_register_req_is_constr(x) \
-  ((x)->type & (arch_register_req_type_pair + arch_register_req_type_limited - 1) != 0)
+/**
+ * Convenience macro to check for set constraints.
+ * @param req   A pointer to register requirements.
+ * @param kind  The kind of constraint to check for (see arch_register_req_type_t).
+ * @return      1, If the kind of constraint is present, 0 if not.
+ */
+#define arch_register_req_is(req, kind) \
+       (((req)->type & (arch_register_req_type_ ## kind)) != 0)
 
 /**
  * Expresses requirements to register allocation for an operand.
  */
 typedef struct _arch_register_req_t {
-  arch_register_req_type_t type;          /**< The type of the constraint. */
-  const arch_register_class_t *cls;       /**< The register class this
-                                               constraint belongs to. */
-  union {
-    int (*limited)(const ir_node *irn, int pos, bitset_t *bs);
+       arch_register_req_type_t type;          /**< The type of the constraint. */
+       const arch_register_class_t *cls;       /**< The register class this constraint belongs to. */
+
+       int (*limited)(const ir_node *irn, int pos, bitset_t *bs);
                                           /**< In case of the 'limited'
                                             constraint, this function
                                             must put all allowable
@@ -182,16 +161,14 @@ typedef struct _arch_register_req_t {
                                             return the number of registers
                                             in the bitset. */
 
-    int pos;                             /**< In case of the equal constraint,
-                                            this gives the position of the
-                                            operand to which the register of
-                                            this should be equal to. Same for
-                                            unequal. */
-  } data;
+       ir_node *other;                                           /**< In case of "should be equal"
+                                                                                   or should be different, this gives
+                                                                                       the node to whose register this
+                                                                                       one's should be the same/different. */
 } arch_register_req_t;
 
 /**
- * Certain node classes which are relevent for the register allocator.
+ * Certain node classes which are relevant for the register allocator.
  */
 typedef enum _arch_irn_class_t {
   arch_irn_class_normal,
@@ -327,7 +304,7 @@ arch_get_irn_reg_class(const arch_env_t *env, const ir_node *irn, int pos);
 
 /**
  * Get the register allocated at a certain output operand of a node.
- * @param env The arch nvironment.
+ * @param env The arch environment.
  * @param irn The node.
  * @return    The register allocated for this operand
  */
@@ -384,6 +361,16 @@ struct _arch_irn_handler_t {
  */
 struct _arch_code_generator_if_t {
 
+
+       /**
+        * Initialize the code generator.
+        * @param file The file to dump to.
+        * @param irg  The function to generate code for.
+        * @param env  The architecture environment.
+        * @return     A newly created code generator.
+        */
+       void *(*init)(FILE *file, ir_graph *irg, const arch_env_t *env);
+
        /**
         * Called, when the graph is being normalized.
         */
@@ -444,7 +431,7 @@ struct _arch_isa_if_t {
   /**
    * Initialize the isa interface.
    */
-  void *(*init)(FILE *file_handle);
+  void *(*init)(void);
 
   /**
    * Free the isa instance.
@@ -473,12 +460,11 @@ struct _arch_isa_if_t {
   const arch_irn_handler_t *(*get_irn_handler)(const void *self);
 
   /**
-   * Produce a new code generator.
+   * Get the code generator interface.
    * @param self The this pointer.
-   * @param irg  The graph for which code shall be generated.
-   * @return     A code generator.
+   * @return     Some code generator interface.
    */
-  arch_code_generator_t *(*make_code_generator)(void *self, ir_graph *irg);
+  const arch_code_generator_if_t *(*get_code_generator)(void *self);
 
   /**
    * Get the list scheduler to use.
@@ -522,7 +508,7 @@ struct _arch_env_t {
  * @param isa The isa which shall be put into the environment.
  * @return The environment.
  */
-extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa, FILE *file_handle);
+extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa);
 
 /**
  * Add a node handler to the environment.