1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4
5
predefine_mips(const struct target * self)6 static void predefine_mips(const struct target *self)
7 {
8 predefine("__mips__", 1, "1");
9 predefine("__mips", 1, "%d", ptr_ctype.bit_size);
10 predefine("_MIPS_SZINT", 1, "%d", int_ctype.bit_size);
11 predefine("_MIPS_SZLONG", 1, "%d", long_ctype.bit_size);
12 predefine("_MIPS_SZPTR", 1, "%d", ptr_ctype.bit_size);
13
14 if (arch_big_endian) {
15 predefine("_MIPSEB", 1, "1");
16 predefine("__MIPSEB", 1, "1");
17 predefine("__MIPSEB__", 1, "1");
18 } else {
19 predefine("_MIPSEL", 1, "1");
20 predefine("__MIPSEL", 1, "1");
21 predefine("__MIPSEL__", 1, "1");
22 }
23 }
24
25
predefine_mips32(const struct target * self)26 static void predefine_mips32(const struct target *self)
27 {
28 predefine_mips(self);
29 }
30
31 const struct target target_mips32 = {
32 .mach = MACH_MIPS32,
33 .bitness = ARCH_LP32,
34 .big_endian = 1,
35 .unsigned_char = 0,
36
37 .bits_in_longdouble = 64,
38 .max_fp_alignment = 8,
39
40 .target_64bit = &target_mips64,
41
42 .predefine = predefine_mips32,
43 };
44
45
predefine_mips64(const struct target * self)46 static void predefine_mips64(const struct target *self)
47 {
48 predefine("__mips64", 1, "64");
49
50 predefine_mips(self);
51 }
52
53 const struct target target_mips64 = {
54 .mach = MACH_MIPS64,
55 .bitness = ARCH_LP64,
56 .big_endian = 1,
57 .unsigned_char = 0,
58 .has_int128 = 1,
59
60 .target_32bit = &target_mips32,
61
62 .predefine = predefine_mips64,
63 };
64