math: array parameters can be NULL
[smatch.git] / target-riscv.c
blobd68fb585c2542a246adc3ee6bb1b837bb2e38979
1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
6 static void init_riscv(const struct target *self)
8 if (arch_cmodel == CMODEL_UNKNOWN)
9 arch_cmodel = CMODEL_MEDLOW;
10 if (fpic)
11 arch_cmodel = CMODEL_PIC;
14 static void predefine_riscv(const struct target *self)
16 static const char *cmodels[CMODEL_LAST] = {
17 [CMODEL_MEDANY] = "medany",
18 [CMODEL_MEDLOW] = "medlow",
19 [CMODEL_PIC] = "pic",
21 const char *cmodel = cmodels[arch_cmodel];
23 predefine("__riscv", 1, "1");
24 predefine("__riscv_xlen", 1, "%d", ptr_ctype.bit_size);
26 if (cmodel)
27 predefine_strong("__riscv_cmodel_%s", cmodel);
30 const struct target target_riscv32 = {
31 .mach = MACH_RISCV32,
32 .bitness = ARCH_LP32,
33 .big_endian = 0,
34 .unsigned_char = 1,
36 .target_64bit = &target_riscv64,
38 .init = init_riscv,
39 .predefine = predefine_riscv,
42 const struct target target_riscv64 = {
43 .mach = MACH_RISCV64,
44 .bitness = ARCH_LP64,
45 .big_endian = 0,
46 .unsigned_char = 1,
47 .has_int128 = 1,
49 .target_32bit = &target_riscv32,
51 .init = init_riscv,
52 .predefine = predefine_riscv,