• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4 #include "expression.h"
5 
6 
init_s390(const struct target * self)7 static void init_s390(const struct target *self)
8 {
9 	intptr_ctype = &int_ctype;
10 	uintptr_ctype = &uint_ctype;
11 
12 	fast16_ctype = &int_ctype;
13 	ufast16_ctype = &uint_ctype;
14 	fast32_ctype = &int_ctype;
15 	ufast32_ctype = &uint_ctype;
16 }
17 
predefine_s390(const struct target * self)18 static void predefine_s390(const struct target *self)
19 {
20 	predefine("__s390__", 1, "1");
21 }
22 
asm_constraint_s390(struct asm_operand * op,int c,const char * str)23 static const char *asm_constraint_s390(struct asm_operand *op, int c, const char *str)
24 {
25 	switch (c) {
26 	case 'R': case 'S': case 'T':
27 		op->is_memory = true;
28 		break;
29 	}
30 	return str;
31 }
32 
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,
39 
40 	.bits_in_longdouble = 64,
41 	.max_fp_alignment = 8,
42 
43 	.target_64bit = &target_s390x,
44 
45 	.init = init_s390,
46 	.predefine = predefine_s390,
47 	.asm_constraint = asm_constraint_s390,
48 };
49 
50 
predefine_s390x(const struct target * self)51 static void predefine_s390x(const struct target *self)
52 {
53 	predefine("__zarch__", 1, "1");
54 	predefine("__s390x__", 1, "1");
55 
56 	predefine_s390(self);
57 }
58 
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,
65 
66 	.bits_in_longdouble = 64,
67 	.max_fp_alignment = 8,
68 
69 	.target_32bit = &target_s390,
70 
71 	.predefine = predefine_s390x,
72 	.asm_constraint = asm_constraint_s390,
73 };
74