Sat Dec 13 17:49:10 CET 2003 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / mini / mini-ppc.h
1 #ifndef __MONO_MINI_PPC_H__
2 #define __MONO_MINI_PPC_H__
3
4 #include <mono/arch/x86/x86-codegen.h>
5 #include <mono/arch/ppc/ppc-codegen.h>
6
7 #define MONO_MAX_IREGS 32
8 #define MONO_MAX_FREGS 32
9
10 #define MONO_ARCH_FRAME_ALIGNMENT 4
11
12 /* fixme: align to 16byte instead of 32byte (we align to 32byte to get 
13  * reproduceable results for benchmarks */
14 #define MONO_ARCH_CODE_ALIGNMENT 32
15
16 #define MONO_ARCH_BASEREG X86_EBP
17 #define MONO_ARCH_RETREG1 ppc_r3
18 #define MONO_ARCH_RETREG2 ppc_r4
19
20 struct MonoLMF {
21         gpointer    previous_lmf;
22         gpointer    lmf_addr;
23         MonoMethod *method;
24         guint32     ebp;
25         guint32     eip;
26 };
27
28 #define MONO_ARCH_EMULATE_FCONV_TO_I8 1
29 #define MONO_ARCH_EMULATE_LCONV_TO_R8 1
30 #define MONO_ARCH_EMULATE_LCONV_TO_R4 1
31 #define MONO_ARCH_EMULATE_LCONV_TO_R8_UN 1
32 #define MONO_ARCH_EMULATE_FREM 1
33
34 /* deal with some of the ABI differences here */
35 #ifdef __APPLE__
36 #define PPC_RET_ADDR_OFFSET 8
37 #define PPC_STACK_ALIGNMENT 16
38 #define PPC_STACK_PARAM_OFFSET 24
39 #define PPC_MINIMAL_STACK_SIZE 24
40 #define PPC_FIRST_ARG_REG ppc_r3
41 #define PPC_LAST_ARG_REG ppc_r10
42 #define PPC_FIRST_FPARG_REG ppc_f1
43 #define PPC_LAST_FPARG_REG ppc_f13
44 #define PPC_PASS_STRUCTS_BY_VALUE 1
45 #else
46 /* Linux */
47 #define PPC_RET_ADDR_OFFSET 4
48 #define PPC_STACK_ALIGNMENT 16
49 #define PPC_STACK_PARAM_OFFSET 8
50 #define PPC_MINIMAL_STACK_SIZE 8
51 #define PPC_FIRST_ARG_REG ppc_r3
52 #define PPC_LAST_ARG_REG ppc_r10
53 #define PPC_FIRST_FPARG_REG ppc_f1
54 #define PPC_LAST_FPARG_REG ppc_f8
55 /* set the next to 0 once inssel-ppc.brg is updated */
56 #define PPC_PASS_STRUCTS_BY_VALUE 1
57 #define PPC_SMALL_RET_STRUCT_IN_REG 1
58 #endif
59
60 #define PPC_NUM_REG_ARGS (PPC_LAST_ARG_REG-PPC_FIRST_ARG_REG+1)
61 #define PPC_NUM_REG_FPARGS (PPC_LAST_FPARG_REG-PPC_FIRST_FPARG_REG+1)
62
63 #endif /* __MONO_MINI_PPC_H__ */