target-nios2.c 1.1 KB

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