1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4 #include "expression.h"
5
6
predefine_ppc(const struct target * self)7 static void predefine_ppc(const struct target *self)
8 {
9 predefine("__powerpc__", 1, "1");
10 predefine("__powerpc", 1, "1");
11 predefine("__ppc__", 1, "1");
12 predefine("__PPC__", 1, "1");
13 predefine("__PPC", 1, "1");
14 predefine("_ARCH_PPC", 1, "1");
15 if (arch_big_endian)
16 predefine("_BIG_ENDIAN", 1, "1");
17 if (ldouble_ctype.bit_size == 128) {
18 predefine("__LONGDOUBLE128", 1, "1");
19 predefine("__LONG_DOUBLE_128__", 1, "1");
20 }
21 }
22
asm_constraint_ppc(struct asm_operand * op,int c,const char * str)23 static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char *str)
24 {
25 switch (c) {
26 case 'Z':
27 op->is_memory = true;
28 break;
29 }
30 return str;
31 }
32
33
init_ppc32(const struct target * self)34 static void init_ppc32(const struct target *self)
35 {
36 fast16_ctype = &int_ctype;
37 ufast16_ctype = &uint_ctype;
38 fast32_ctype = &int_ctype;
39 ufast32_ctype = &uint_ctype;
40 }
41
predefine_ppc32(const struct target * self)42 static void predefine_ppc32(const struct target *self)
43 {
44 predefine_ppc(self);
45 }
46
47 const struct target target_ppc32 = {
48 .mach = MACH_PPC32,
49 .bitness = ARCH_LP32,
50 .big_endian = 1,
51 .unsigned_char = 1,
52
53 .wchar = &long_ctype,
54
55 .target_64bit = &target_ppc64,
56
57 .init = init_ppc32,
58 .predefine = predefine_ppc32,
59 .asm_constraint = asm_constraint_ppc,
60 };
61
62
predefine_ppc64(const struct target * self)63 static void predefine_ppc64(const struct target *self)
64 {
65 predefine("__powerpc64__", 1, "1");
66 predefine("__ppc64__", 1, "1");
67 predefine("__PPC64__", 1, "1");
68 predefine("_ARCH_PPC64", 1, "1");
69
70 predefine_ppc(self);
71 }
72
73 const struct target target_ppc64 = {
74 .mach = MACH_PPC64,
75 .bitness = ARCH_LP64,
76 .big_endian = 1,
77 .unsigned_char = 1,
78 .has_int128 = 1,
79
80 .target_32bit = &target_ppc32,
81
82 .predefine = predefine_ppc64,
83 .asm_constraint = asm_constraint_ppc,
84 };
85