1#include "symbol.h"
2#include "target.h"
3#include "machine.h"
4#include "builtin.h"
5
6
7static void init_nios2(const struct target *self)
8{
9	fast16_ctype = &int_ctype;
10	ufast16_ctype = &uint_ctype;
11	fast32_ctype = &int_ctype;
12	ufast32_ctype = &uint_ctype;
13}
14
15static void predefine_nios2(const struct target *self)
16{
17	predefine("__NIOS2", 1, "1");
18	predefine("__NIOS2__", 1, "1");
19	predefine("__nios2", 1, "1");
20	predefine("__nios2__", 1, "1");
21
22	if (arch_big_endian) {
23		predefine("__nios2_big_endian", 1, "1");
24		predefine("__nios2_big_endian__", 1, "1");
25	} else {
26		predefine("__nios2_little_endian", 1, "1");
27		predefine("__nios2_little_endian__", 1, "1");
28	}
29}
30
31static const struct builtin_fn builtins_nios2[] = {
32	{ "__builtin_rdctl", &int_ctype, 0, { &int_ctype }},
33	{ "__builtin_wrctl", &void_ctype, 0, { &int_ctype, &int_ctype }},
34	{ "__builtin_custom_ini", &int_ctype, 0, { &int_ctype }},
35	{ }
36};
37
38const struct target target_nios2 = {
39	.mach = MACH_NIOS2,
40	.bitness = ARCH_LP32,
41
42	.bits_in_longdouble = 64,
43
44	.init = init_nios2,
45	.predefine = predefine_nios2,
46	.builtins = builtins_nios2,
47};
48