1f08c3bdfSopenharmony_ci#include "symbol.h" 2f08c3bdfSopenharmony_ci#include "target.h" 3f08c3bdfSopenharmony_ci#include "machine.h" 4f08c3bdfSopenharmony_ci 5f08c3bdfSopenharmony_ci 6f08c3bdfSopenharmony_cistatic void predefine_mips(const struct target *self) 7f08c3bdfSopenharmony_ci{ 8f08c3bdfSopenharmony_ci predefine("__mips__", 1, "1"); 9f08c3bdfSopenharmony_ci predefine("__mips", 1, "%d", ptr_ctype.bit_size); 10f08c3bdfSopenharmony_ci predefine("_MIPS_SZINT", 1, "%d", int_ctype.bit_size); 11f08c3bdfSopenharmony_ci predefine("_MIPS_SZLONG", 1, "%d", long_ctype.bit_size); 12f08c3bdfSopenharmony_ci predefine("_MIPS_SZPTR", 1, "%d", ptr_ctype.bit_size); 13f08c3bdfSopenharmony_ci 14f08c3bdfSopenharmony_ci if (arch_big_endian) { 15f08c3bdfSopenharmony_ci predefine("_MIPSEB", 1, "1"); 16f08c3bdfSopenharmony_ci predefine("__MIPSEB", 1, "1"); 17f08c3bdfSopenharmony_ci predefine("__MIPSEB__", 1, "1"); 18f08c3bdfSopenharmony_ci } else { 19f08c3bdfSopenharmony_ci predefine("_MIPSEL", 1, "1"); 20f08c3bdfSopenharmony_ci predefine("__MIPSEL", 1, "1"); 21f08c3bdfSopenharmony_ci predefine("__MIPSEL__", 1, "1"); 22f08c3bdfSopenharmony_ci } 23f08c3bdfSopenharmony_ci} 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_cistatic void predefine_mips32(const struct target *self) 27f08c3bdfSopenharmony_ci{ 28f08c3bdfSopenharmony_ci predefine_mips(self); 29f08c3bdfSopenharmony_ci} 30f08c3bdfSopenharmony_ci 31f08c3bdfSopenharmony_ciconst struct target target_mips32 = { 32f08c3bdfSopenharmony_ci .mach = MACH_MIPS32, 33f08c3bdfSopenharmony_ci .bitness = ARCH_LP32, 34f08c3bdfSopenharmony_ci .big_endian = 1, 35f08c3bdfSopenharmony_ci .unsigned_char = 0, 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ci .bits_in_longdouble = 64, 38f08c3bdfSopenharmony_ci .max_fp_alignment = 8, 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ci .target_64bit = &target_mips64, 41f08c3bdfSopenharmony_ci 42f08c3bdfSopenharmony_ci .predefine = predefine_mips32, 43f08c3bdfSopenharmony_ci}; 44f08c3bdfSopenharmony_ci 45f08c3bdfSopenharmony_ci 46f08c3bdfSopenharmony_cistatic void predefine_mips64(const struct target *self) 47f08c3bdfSopenharmony_ci{ 48f08c3bdfSopenharmony_ci predefine("__mips64", 1, "64"); 49f08c3bdfSopenharmony_ci 50f08c3bdfSopenharmony_ci predefine_mips(self); 51f08c3bdfSopenharmony_ci} 52f08c3bdfSopenharmony_ci 53f08c3bdfSopenharmony_ciconst struct target target_mips64 = { 54f08c3bdfSopenharmony_ci .mach = MACH_MIPS64, 55f08c3bdfSopenharmony_ci .bitness = ARCH_LP64, 56f08c3bdfSopenharmony_ci .big_endian = 1, 57f08c3bdfSopenharmony_ci .unsigned_char = 0, 58f08c3bdfSopenharmony_ci .has_int128 = 1, 59f08c3bdfSopenharmony_ci 60f08c3bdfSopenharmony_ci .target_32bit = &target_mips32, 61f08c3bdfSopenharmony_ci 62f08c3bdfSopenharmony_ci .predefine = predefine_mips64, 63f08c3bdfSopenharmony_ci}; 64