fix null-pointer crash with with ident same as one of the attributes
[smatch.git] / target-s390.c
blob84889c0aa7ad370eb7253dd5e2e08ed1e1baa179
1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4 #include "expression.h"
7 static void init_s390(const struct target *self)
9 intptr_ctype = &int_ctype;
10 uintptr_ctype = &uint_ctype;
12 fast16_ctype = &int_ctype;
13 ufast16_ctype = &uint_ctype;
14 fast32_ctype = &int_ctype;
15 ufast32_ctype = &uint_ctype;
18 static void predefine_s390(const struct target *self)
20 predefine("__s390__", 1, "1");
23 static const char *asm_constraint_s390(struct asm_operand *op, int c, const char *str)
25 switch (c) {
26 case 'R': case 'S': case 'T':
27 op->is_memory = true;
28 break;
30 return str;
33 const struct target target_s390 = {
34 .mach = MACH_S390,
35 .bitness = ARCH_LP32,
36 .big_endian = 1,
37 .unsigned_char = 1,
38 .size_t_long = 1,
40 .bits_in_longdouble = 64,
41 .max_fp_alignment = 8,
43 .target_64bit = &target_s390x,
45 .init = init_s390,
46 .predefine = predefine_s390,
47 .asm_constraint = asm_constraint_s390,
51 static void predefine_s390x(const struct target *self)
53 predefine("__zarch__", 1, "1");
54 predefine("__s390x__", 1, "1");
56 predefine_s390(self);
59 const struct target target_s390x = {
60 .mach = MACH_S390X,
61 .bitness = ARCH_LP64,
62 .big_endian = 1,
63 .unsigned_char = 1,
64 .has_int128 = 1,
66 .bits_in_longdouble = 64,
67 .max_fp_alignment = 8,
69 .target_32bit = &target_s390,
71 .predefine = predefine_s390x,
72 .asm_constraint = asm_constraint_s390,