]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Bypass the auto-detection logic in gen-apply under MacOSX because
authorRhys Weatherley <rweather@southern-storm.com.au>
Mon, 7 Jun 2004 07:15:30 +0000 (07:15 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Mon, 7 Jun 2004 07:15:30 +0000 (07:15 +0000)
it doesn't work with Apple's version of gcc.

ChangeLog
tools/gen-apply-macosx.h [new file with mode: 0644]
tools/gen-apply.c

index b972eb5daa5ce2605d2d28a79e5e92473a59a412..8d12ed745e0c7201f55c04d8aefd933baba2acc6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * jit/jit-rules-x86.c: fix misnaming of jit_type_get_abi,
        jit_abi_stdcall, and jit_abi_fastcall.
 
+       * tools/gen-apply-macosx.h, tools/gen-apply.c: bypass the
+       auto-detection logic in gen-apply under MacOSX because
+       it doesn't work with Apple's version of gcc.
+
 2004-06-06  Miroslaw Dobrzanski-Neumann  <mne@mosaic-ag.com>
 
        * jit/jit-alloc.c (jit_flush_exec): flush cache lines properly
diff --git a/tools/gen-apply-macosx.h b/tools/gen-apply-macosx.h
new file mode 100644 (file)
index 0000000..99f0b1f
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * gen-apply-macosx.h - MacOSX-specific definitions.
+ *
+ * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef        _GEN_APPLY_MACOSX_H
+#define        _GEN_APPLY_MACOSX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define JIT_APPLY_NUM_WORD_REGS 8
+#define JIT_APPLY_NUM_FLOAT_REGS 13
+#define JIT_APPLY_PASS_STACK_FLOAT_AS_DOUBLE 0
+#define JIT_APPLY_PASS_STACK_FLOAT_AS_NFLOAT 0
+#define JIT_APPLY_PASS_STACK_DOUBLE_AS_NFLOAT 0
+#define JIT_APPLY_PASS_STACK_NFLOAT_AS_DOUBLE 1
+#define JIT_APPLY_PASS_REG_FLOAT_AS_DOUBLE 1
+#define JIT_APPLY_PASS_REG_FLOAT_AS_NFLOAT 0
+#define JIT_APPLY_PASS_REG_DOUBLE_AS_NFLOAT 0
+#define JIT_APPLY_PASS_REG_NFLOAT_AS_DOUBLE 1
+#define JIT_APPLY_RETURN_FLOAT_AS_DOUBLE 1
+#define JIT_APPLY_RETURN_FLOAT_AS_NFLOAT 0
+#define JIT_APPLY_RETURN_DOUBLE_AS_NFLOAT 0
+#define JIT_APPLY_RETURN_NFLOAT_AS_DOUBLE 1
+#define JIT_APPLY_FLOATS_IN_WORD_REGS 0
+#define JIT_APPLY_RETURN_FLOATS_AFTER 8
+#define JIT_APPLY_VARARGS_ON_STACK 0
+#define JIT_APPLY_STRUCT_RETURN_SPECIAL_REG 0
+#define JIT_APPLY_STRUCT_REG_OVERLAPS_WORD_REG 0
+#define JIT_APPLY_ALIGN_LONG_REGS 1
+#define JIT_APPLY_ALIGN_LONG_STACK 1
+#define JIT_APPLY_CAN_SPLIT_LONG 0
+#define JIT_APPLY_STRUCT_RETURN_IN_REG \
+       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define JIT_APPLY_MAX_STRUCT_IN_REG 0
+#define JIT_APPLY_X86_FASTCALL 0
+#define JIT_APPLY_PARENT_FRAME_OFFSET 0
+#define JIT_APPLY_RETURN_ADDRESS_OFFSET 0
+#define JIT_APPLY_BROKEN_FRAME_BUILTINS 1
+#define JIT_APPLY_X86_POP_STRUCT_RETURN 0
+#define JIT_APPLY_PAD_FLOAT_REGS 1
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _GEN_APPLY_MACOSX_H */
index 917fc7591ec563d5ab57747e34949191518b3c77..eed833cabe5e2d003d9f02d316cf6ac22fee5b4e 100644 (file)
@@ -48,12 +48,23 @@ the "jit-apply-rules.h" file.
        #endif
 #endif
 #endif
+#if defined(__APPLE__) && defined(__MACH__)
+       #define PLATFORM_IS_MACOSX      1
+#endif
 
 #if defined(PLATFORM_IS_GCC) || defined(PLATFORM_IS_WIN32)
 
+/*
+ * Pick up pre-defined values on platforms where auto-detection doesn't work.
+ */
+#if defined(PLATFORM_IS_MACOSX)
+       #include "gen-apply-macosx.h"
+#endif
+
 /*
  * Values that are detected.
  */
+#ifndef JIT_APPLY_NUM_WORD_REGS
 int num_word_regs = 0;
 int num_float_regs = 0;
 int pass_stack_float_as_double = 0;
@@ -77,7 +88,6 @@ int struct_return_in_reg[64];
 int align_long_regs = 0;
 int align_long_stack = 0;
 int can_split_long = 0;
-int max_apply_size = 0;
 int x86_fastcall = 0;
 int parent_frame_offset = 0;
 int return_address_offset = 0;
@@ -85,6 +95,39 @@ int broken_frame_builtins = 0;
 int max_struct_in_reg = 0;
 int x86_pop_struct_return = 0;
 int pad_float_regs = 0;
+#else
+int num_word_regs = JIT_APPLY_NUM_WORD_REGS;
+int num_float_regs = JIT_APPLY_NUM_FLOAT_REGS;
+int pass_stack_float_as_double = JIT_APPLY_PASS_STACK_FLOAT_AS_DOUBLE;
+int pass_stack_float_as_nfloat = JIT_APPLY_PASS_STACK_FLOAT_AS_NFLOAT;
+int pass_stack_double_as_nfloat = JIT_APPLY_PASS_STACK_DOUBLE_AS_NFLOAT;
+int pass_stack_nfloat_as_double = JIT_APPLY_PASS_STACK_NFLOAT_AS_DOUBLE;
+int pass_reg_float_as_double = JIT_APPLY_PASS_REG_FLOAT_AS_DOUBLE;
+int pass_reg_float_as_nfloat = JIT_APPLY_PASS_REG_FLOAT_AS_NFLOAT;
+int pass_reg_double_as_nfloat = JIT_APPLY_PASS_REG_DOUBLE_AS_NFLOAT;
+int pass_reg_nfloat_as_double = JIT_APPLY_PASS_REG_NFLOAT_AS_DOUBLE;
+int return_float_as_double = JIT_APPLY_RETURN_FLOAT_AS_DOUBLE;
+int return_float_as_nfloat = JIT_APPLY_RETURN_FLOAT_AS_NFLOAT;
+int return_double_as_nfloat = JIT_APPLY_RETURN_DOUBLE_AS_NFLOAT;
+int return_nfloat_as_double = JIT_APPLY_RETURN_NFLOAT_AS_DOUBLE;
+int floats_in_word_regs = JIT_APPLY_FLOATS_IN_WORD_REGS;
+int return_floats_after = JIT_APPLY_RETURN_FLOATS_AFTER;
+int varargs_on_stack = JIT_APPLY_VARARGS_ON_STACK;
+int struct_return_special_reg = JIT_APPLY_STRUCT_RETURN_SPECIAL_REG;
+int struct_reg_overlaps_word_reg = JIT_APPLY_STRUCT_REG_OVERLAPS_WORD_REG;
+int struct_return_in_reg[64] = JIT_APPLY_STRUCT_RETURN_IN_REG;
+int align_long_regs = JIT_APPLY_ALIGN_LONG_REGS;
+int align_long_stack = JIT_APPLY_ALIGN_LONG_STACK;
+int can_split_long = JIT_APPLY_CAN_SPLIT_LONG;
+int x86_fastcall = JIT_APPLY_X86_FASTCALL;
+int parent_frame_offset = JIT_APPLY_PARENT_FRAME_OFFSET;
+int return_address_offset = JIT_APPLY_RETURN_ADDRESS_OFFSET;
+int broken_frame_builtins = JIT_APPLY_BROKEN_FRAME_BUILTINS;
+int max_struct_in_reg = JIT_APPLY_MAX_STRUCT_IN_REG;
+int x86_pop_struct_return = JIT_APPLY_X86_POP_STRUCT_RETURN;
+int pad_float_regs = JIT_APPLY_PAD_FLOAT_REGS;
+#endif
+int max_apply_size = 0;
 
 void *mem_copy(void *dest, const void *src, unsigned int len)
 {
@@ -173,7 +216,7 @@ struct detect_struct_reg
        void *field7;
        void *field8;
 };
-static struct detect_struct_reg detect_struct_buf;
+struct detect_struct_reg detect_struct_buf;
 struct detect_struct_reg detect_struct_return(jit_nint arg1, jit_nint arg2)
 {
        struct detect_struct_reg ret;
@@ -2189,6 +2232,7 @@ int main(int argc, char *argv[])
        int size;
        int flags;
 
+#ifndef JIT_APPLY_NUM_WORD_REGS
        /* Detect the number of word registers */
        detect_word_regs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
                         14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
@@ -2281,12 +2325,13 @@ int main(int argc, char *argv[])
        /* Detect the alignment of "long" values */
        detect_long_alignment();
 
-       /* Determine the maximum sizes */
-       detect_max_sizes();
-
        /* Detect the location of parent frames and return addresses
           in the value returned by "__builtin_frame_address" */
        detect_frame_offsets();
+#endif
+
+       /* Determine the maximum sizes */
+       detect_max_sizes();
 
        /* Print the results */
        printf("/%c This file was auto-generated by \"gen-apply\" - DO NOT EDIT %c/\n\n", '*', '*');