aboutsummaryrefslogtreecommitdiffstats
path: root/target-s390.c
blob: 84889c0aa7ad370eb7253dd5e2e08ed1e1baa179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "symbol.h"
#include "target.h"
#include "machine.h"
#include "expression.h"


static void init_s390(const struct target *self)
{
	intptr_ctype = &int_ctype;
	uintptr_ctype = &uint_ctype;

	fast16_ctype = &int_ctype;
	ufast16_ctype = &uint_ctype;
	fast32_ctype = &int_ctype;
	ufast32_ctype = &uint_ctype;
}

static void predefine_s390(const struct target *self)
{
	predefine("__s390__", 1, "1");
}

static const char *asm_constraint_s390(struct asm_operand *op, int c, const char *str)
{
	switch (c) {
	case 'R': case 'S': case 'T':
		op->is_memory = true;
		break;
	}
	return str;
}

const struct target target_s390 = {
	.mach = MACH_S390,
	.bitness = ARCH_LP32,
	.big_endian = 1,
	.unsigned_char = 1,
	.size_t_long = 1,

	.bits_in_longdouble = 64,
	.max_fp_alignment = 8,

	.target_64bit = &target_s390x,

	.init = init_s390,
	.predefine = predefine_s390,
	.asm_constraint = asm_constraint_s390,
};


static void predefine_s390x(const struct target *self)
{
	predefine("__zarch__", 1, "1");
	predefine("__s390x__", 1, "1");

	predefine_s390(self);
}

const struct target target_s390x = {
	.mach = MACH_S390X,
	.bitness = ARCH_LP64,
	.big_endian = 1,
	.unsigned_char = 1,
	.has_int128 = 1,

	.bits_in_longdouble = 64,
	.max_fp_alignment = 8,

	.target_32bit = &target_s390,

	.predefine = predefine_s390x,
	.asm_constraint = asm_constraint_s390,
};