param_key: fix container of when no struct member is referenced
[smatch.git] / target-ppc.c
blob6c0c0737482c1ec8a9ade29d3cb7f61b8073f682
1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4 #include "expression.h"
7 static void predefine_ppc(const struct target *self)
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");
23 static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char *str)
25 switch (c) {
26 case 'Z':
27 op->is_memory = true;
28 break;
30 return str;
34 static void init_ppc32(const struct target *self)
36 fast16_ctype = &int_ctype;
37 ufast16_ctype = &uint_ctype;
38 fast32_ctype = &int_ctype;
39 ufast32_ctype = &uint_ctype;
42 static void predefine_ppc32(const struct target *self)
44 predefine_ppc(self);
47 const struct target target_ppc32 = {
48 .mach = MACH_PPC32,
49 .bitness = ARCH_LP32,
50 .big_endian = 1,
51 .unsigned_char = 1,
53 .wchar = &long_ctype,
55 .target_64bit = &target_ppc64,
57 .init = init_ppc32,
58 .predefine = predefine_ppc32,
59 .asm_constraint = asm_constraint_ppc,
63 static void predefine_ppc64(const struct target *self)
65 predefine("__powerpc64__", 1, "1");
66 predefine("__ppc64__", 1, "1");
67 predefine("__PPC64__", 1, "1");
68 predefine("_ARCH_PPC64", 1, "1");
70 predefine_ppc(self);
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,
80 .target_32bit = &target_ppc32,
82 .predefine = predefine_ppc64,
83 .asm_constraint = asm_constraint_ppc,