Extended public backend API.
authorManuel Mohr <manuel.mohr@kit.edu>
Fri, 14 Sep 2012 15:05:34 +0000 (17:05 +0200)
committerManuel Mohr <manuel.mohr@kit.edu>
Fri, 14 Sep 2012 15:05:34 +0000 (17:05 +0200)
Added some additional functions that allow direct access to some fields
of the backend params struct.  These functions avoid struct type,
thereby making interfacing with the jFirm library easier.

include/libfirm/be.h
ir/be/bemain.c

index b2d1099..10af37a 100644 (file)
@@ -177,6 +177,35 @@ typedef struct backend_params {
  */
 FIRM_API int be_parse_arg(const char *arg);
 
+/**
+ * Returns 1 if the backend uses big-endian byte ordering
+ * and 0 for little-endian.
+ */
+FIRM_API int be_is_big_endian(void);
+
+/**
+ * Returns size of machine words. This is usually the size
+ * of the general purpose integer registers.
+ */
+FIRM_API unsigned be_get_machine_size(void);
+
+/**
+ * Returns supported float arithmetic mode or NULL if mode_D and mode_F
+ * are supported natively.
+ * Some backends like x87 can only do arithmetic in a specific float
+ * mode (load/store are still done in the "normal" float/double modes).
+ */
+FIRM_API ir_mode *be_get_mode_float_arithmetic(void);
+
+/** Returns type used for long long or NULL if none available. */
+FIRM_API ir_type *be_get_type_long_long(void);
+
+/** Returns type used for unsigned long long or NULL if none available. */
+FIRM_API ir_type *be_get_type_unsigned_long_long(void);
+
+/** Returns type used for long double or NULL if none available. */
+FIRM_API ir_type *be_get_type_long_double(void);
+
 /**
  * Returns the backend configuration parameter.
  *
index 272a794..d5977ad 100644 (file)
@@ -362,6 +362,36 @@ const backend_params *be_get_backend_param(void)
        return isa_if->get_params();
 }
 
+int be_is_big_endian(void)
+{
+       return be_get_backend_param()->byte_order_big_endian;
+}
+
+unsigned be_get_machine_size(void)
+{
+       return be_get_backend_param()->machine_size;
+}
+
+ir_mode *be_get_mode_float_arithmetic(void)
+{
+       return be_get_backend_param()->mode_float_arithmetic;
+}
+
+ir_type *be_get_type_long_long(void)
+{
+       return be_get_backend_param()->type_long_long;
+}
+
+ir_type *be_get_type_unsigned_long_long(void)
+{
+       return be_get_backend_param()->type_unsigned_long_long;
+}
+
+ir_type *be_get_type_long_double(void)
+{
+       return be_get_backend_param()->type_long_double;
+}
+
 /**
  * Initializes the main environment for the backend.
  *