shouldn't be here anymore
[libfirm] / ir / be / bearch_t.h
index 4262e46..80c7f62 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -40,7 +40,7 @@
 struct arch_register_t {
        const char                  *name;        /**< The name of the register. */
        const arch_register_class_t *reg_class;   /**< The class the register belongs to. */
-       int                         index;        /**< The index of the register in the class. */
+       unsigned                    index;        /**< The index of the register in the class. */
        arch_register_type_t        type;         /**< The type of the register. */
        void                        *data;        /**< Custom data. */
 };
@@ -51,12 +51,14 @@ _arch_register_get_class(const arch_register_t *reg)
        return reg->reg_class;
 }
 
-static INLINE int _arch_register_get_index(const arch_register_t *reg)
+static INLINE
+unsigned _arch_register_get_index(const arch_register_t *reg)
 {
        return reg->index;
 }
 
-static INLINE const char *_arch_register_get_name(const arch_register_t *reg)
+static INLINE
+const char *_arch_register_get_name(const arch_register_t *reg)
 {
        return reg->name;
 }
@@ -79,10 +81,13 @@ static INLINE const char *_arch_register_get_name(const arch_register_t *reg)
  * Like general purpose or floating point.
  */
 struct arch_register_class_t {
-       const char *name;               /**< The name of the register class. */
-       int n_regs;                     /**< Number of registers in this class. */
-       ir_mode *mode;                  /**< The mode of the register class. */
-       const arch_register_t *regs;    /**< The array of registers. */
+       unsigned                     index;  /**< index of this register class */
+       const char                  *name;   /**< The name of the register class.*/
+       unsigned                     n_regs; /**< Number of registers in this
+                                                 class. */
+       ir_mode                     *mode;   /**< The mode of the register class.*/
+       const arch_register_t       *regs;   /**< The array of registers. */
+       arch_register_class_flags_t  flags;  /**< register class flags. */
 };
 
 /** return the number of registers in this register class */
@@ -94,10 +99,16 @@ struct arch_register_class_t {
 /** return the name of this register class */
 #define arch_register_class_name(cls) ((cls)->name)
 
+/** return the index of this register class */
+#define arch_register_class_index(cls)  ((cls)->index)
+
+/** return the register class flags */
+#define arch_register_class_flags(cls) ((cls)->flags)
+
 static INLINE const arch_register_t *
-_arch_register_for_index(const arch_register_class_t *cls, int idx)
+_arch_register_for_index(const arch_register_class_t *cls, unsigned idx)
 {
-       assert(0 <= idx && idx < cls->n_regs);
+       assert(idx < cls->n_regs);
        return &cls->regs[idx];
 }
 
@@ -121,16 +132,11 @@ struct arch_register_req_t {
 
        const unsigned *limited;            /**< allowed register bitset */
 
-       int other_same;                     /**< The in number which shall have
-                                                                                    the same res (should_be_same)*/
-       int other_different;                /**< The other node from which this
-                                                                                    one's register must be different
-                                                                                        (case must_be_different). */
-};
-
-struct arch_flag_t {
-       const char *name;
-       unsigned    index;
+       unsigned other_same;                /**< Bitmask of ins which should use the
+                                                same register (should_be_same). */
+       unsigned other_different;           /**< Bitmask of ins which shall use a
+                                                different register
+                                                (must_be_different) */
 };
 
 /**
@@ -396,8 +402,10 @@ struct arch_isa_t {
        const arch_isa_if_t   *impl;
        const arch_register_t *sp;        /** The stack pointer register. */
        const arch_register_t *bp;        /** The base pointer register. */
-       const int             stack_dir;  /** -1 for decreasing, 1 for increasing. */
+       const int              stack_dir; /** -1 for decreasing, 1 for increasing. */
        const be_main_env_t   *main_env;  /** the be main environment */
+       const int              spill_cost;  /** cost for a be_Spill node */
+       const int              reload_cost; /** cost for a be_Reload node */
 };
 
 #define arch_isa_stack_dir(isa)  ((isa)->stack_dir)
@@ -425,14 +433,14 @@ struct arch_isa_if_t {
         * Get the the number of register classes in the isa.
         * @return The number of register classes.
         */
-       int (*get_n_reg_class)(const void *self);
+       unsigned (*get_n_reg_class)(const void *self);
 
        /**
         * Get the i-th register class.
         * @param i The number of the register class.
         * @return The register class.
         */
-       const arch_register_class_t *(*get_reg_class)(const void *self, int i);
+       const arch_register_class_t *(*get_reg_class)(const void *self, unsigned i);
 
        /**
         * Get the register class which shall be used to store a value of a given mode.
@@ -445,10 +453,10 @@ struct arch_isa_if_t {
        /**
         * Get the ABI restrictions for procedure calls.
         * @param self        The this pointer.
-        * @param method_type The type of the method (procedure) in question.
+        * @param call_type   The call type of the method (procedure) in question.
         * @param p           The array of parameter locations to be filled.
         */
-       void (*get_call_abi)(const void *self, ir_type *method_type, be_abi_call_t *abi);
+       void (*get_call_abi)(const void *self, ir_type *call_type, be_abi_call_t *abi);
 
        /**
         * The irn handler for this architecture.
@@ -498,7 +506,8 @@ struct arch_isa_if_t {
 
        /**
         * Returns an 2-dim array of execution units, @p irn can be executed on.
-        * The first dimension is the type, the second the allowed units of this type.
+        * The first dimension is the type, the second the allowed units of this
+        * type.
         * Each dimension is a NULL terminated list.
         * @param self  The isa object.
         * @param irn   The node.
@@ -520,8 +529,8 @@ struct arch_isa_if_t {
 
        /**
         * Return an ordered list of irgs where code should be generated for.
-         * If NULL is returned, all irg will be taken into account and they will be
-         * generated in an arbitrary order.
+        * If NULL is returned, all irg will be taken into account and they will be
+        * generated in an arbitrary order.
         * @param self   The isa object.
         * @param irgs   A flexible array ARR_F of length 0 where the backend can append the desired irgs.
         * @return A flexible array ARR_F containing all desired irgs in the desired order.