1f08c3bdfSopenharmony_ci#include "symbol.h"
2f08c3bdfSopenharmony_ci#include "target.h"
3f08c3bdfSopenharmony_ci#include "machine.h"
4f08c3bdfSopenharmony_ci#include "expression.h"
5f08c3bdfSopenharmony_ci
6f08c3bdfSopenharmony_ci
7f08c3bdfSopenharmony_cistatic void init_s390(const struct target *self)
8f08c3bdfSopenharmony_ci{
9f08c3bdfSopenharmony_ci	intptr_ctype = &int_ctype;
10f08c3bdfSopenharmony_ci	uintptr_ctype = &uint_ctype;
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_ci	fast16_ctype = &int_ctype;
13f08c3bdfSopenharmony_ci	ufast16_ctype = &uint_ctype;
14f08c3bdfSopenharmony_ci	fast32_ctype = &int_ctype;
15f08c3bdfSopenharmony_ci	ufast32_ctype = &uint_ctype;
16f08c3bdfSopenharmony_ci}
17f08c3bdfSopenharmony_ci
18f08c3bdfSopenharmony_cistatic void predefine_s390(const struct target *self)
19f08c3bdfSopenharmony_ci{
20f08c3bdfSopenharmony_ci	predefine("__s390__", 1, "1");
21f08c3bdfSopenharmony_ci}
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_cistatic const char *asm_constraint_s390(struct asm_operand *op, int c, const char *str)
24f08c3bdfSopenharmony_ci{
25f08c3bdfSopenharmony_ci	switch (c) {
26f08c3bdfSopenharmony_ci	case 'R': case 'S': case 'T':
27f08c3bdfSopenharmony_ci		op->is_memory = true;
28f08c3bdfSopenharmony_ci		break;
29f08c3bdfSopenharmony_ci	}
30f08c3bdfSopenharmony_ci	return str;
31f08c3bdfSopenharmony_ci}
32f08c3bdfSopenharmony_ci
33f08c3bdfSopenharmony_ciconst struct target target_s390 = {
34f08c3bdfSopenharmony_ci	.mach = MACH_S390,
35f08c3bdfSopenharmony_ci	.bitness = ARCH_LP32,
36f08c3bdfSopenharmony_ci	.big_endian = 1,
37f08c3bdfSopenharmony_ci	.unsigned_char = 1,
38f08c3bdfSopenharmony_ci	.size_t_long = 1,
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci	.bits_in_longdouble = 64,
41f08c3bdfSopenharmony_ci	.max_fp_alignment = 8,
42f08c3bdfSopenharmony_ci
43f08c3bdfSopenharmony_ci	.target_64bit = &target_s390x,
44f08c3bdfSopenharmony_ci
45f08c3bdfSopenharmony_ci	.init = init_s390,
46f08c3bdfSopenharmony_ci	.predefine = predefine_s390,
47f08c3bdfSopenharmony_ci	.asm_constraint = asm_constraint_s390,
48f08c3bdfSopenharmony_ci};
49f08c3bdfSopenharmony_ci
50f08c3bdfSopenharmony_ci
51f08c3bdfSopenharmony_cistatic void predefine_s390x(const struct target *self)
52f08c3bdfSopenharmony_ci{
53f08c3bdfSopenharmony_ci	predefine("__zarch__", 1, "1");
54f08c3bdfSopenharmony_ci	predefine("__s390x__", 1, "1");
55f08c3bdfSopenharmony_ci
56f08c3bdfSopenharmony_ci	predefine_s390(self);
57f08c3bdfSopenharmony_ci}
58f08c3bdfSopenharmony_ci
59f08c3bdfSopenharmony_ciconst struct target target_s390x = {
60f08c3bdfSopenharmony_ci	.mach = MACH_S390X,
61f08c3bdfSopenharmony_ci	.bitness = ARCH_LP64,
62f08c3bdfSopenharmony_ci	.big_endian = 1,
63f08c3bdfSopenharmony_ci	.unsigned_char = 1,
64f08c3bdfSopenharmony_ci	.has_int128 = 1,
65f08c3bdfSopenharmony_ci
66f08c3bdfSopenharmony_ci	.bits_in_longdouble = 64,
67f08c3bdfSopenharmony_ci	.max_fp_alignment = 8,
68f08c3bdfSopenharmony_ci
69f08c3bdfSopenharmony_ci	.target_32bit = &target_s390,
70f08c3bdfSopenharmony_ci
71f08c3bdfSopenharmony_ci	.predefine = predefine_s390x,
72f08c3bdfSopenharmony_ci	.asm_constraint = asm_constraint_s390,
73f08c3bdfSopenharmony_ci};
74