math: array parameters can be NULL
[smatch.git] / target-ppc.c
blobc0d6068f436ac844a6020c36d4db8547857a630a
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");
19 static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char *str)
21 switch (c) {
22 case 'Z':
23 op->is_memory = true;
24 break;
26 return str;
30 static void predefine_ppc32(const struct target *self)
32 predefine_ppc(self);
35 const struct target target_ppc32 = {
36 .mach = MACH_PPC32,
37 .bitness = ARCH_LP32,
38 .big_endian = 1,
39 .unsigned_char = 1,
41 .wchar = &long_ctype,
43 .target_64bit = &target_ppc64,
45 .predefine = predefine_ppc32,
46 .asm_constraint = asm_constraint_ppc,
50 static void predefine_ppc64(const struct target *self)
52 predefine("__powerpc64__", 1, "1");
53 predefine("__ppc64__", 1, "1");
54 predefine("__PPC64__", 1, "1");
55 predefine("_ARCH_PPC64", 1, "1");
57 predefine_ppc(self);
60 const struct target target_ppc64 = {
61 .mach = MACH_PPC64,
62 .bitness = ARCH_LP64,
63 .big_endian = 1,
64 .unsigned_char = 1,
65 .has_int128 = 1,
67 .target_32bit = &target_ppc32,
69 .predefine = predefine_ppc64,
70 .asm_constraint = asm_constraint_ppc,