axe_constants.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Andrea Di Biagio
  3. * Politecnico di Milano, 2007
  4. *
  5. * axe_constants.h
  6. * Formal Languages & Compilers Machine, 2007/2008
  7. *
  8. */
  9. #ifndef _AXE_CONSTANTS_H
  10. #define _AXE_CONSTANTS_H
  11. /* registers */
  12. #define REG_INVALID -1
  13. #define REG_0 0
  14. #define NUM_REGISTERS 31
  15. /* opcodes pseudo-M68000 */
  16. #define ADD 0
  17. #define SUB 1
  18. #define ANDL 2
  19. #define ORL 3
  20. #define EORL 4
  21. #define ANDB 5
  22. #define ORB 6
  23. #define EORB 7
  24. #define MUL 8
  25. #define DIV 9
  26. #define SHL 10
  27. #define SHR 11
  28. #define ROTL 12
  29. #define ROTR 13
  30. #define NEG 14
  31. #define SPCL 15
  32. #define ADDI 16
  33. #define SUBI 17
  34. #define ANDLI 18
  35. #define ORLI 19
  36. #define EORLI 20
  37. #define ANDBI 21
  38. #define ORBI 22
  39. #define EORBI 23
  40. #define MULI 24
  41. #define DIVI 25
  42. #define SHLI 26
  43. #define SHRI 27
  44. #define ROTLI 28
  45. #define ROTRI 29
  46. #define NOTL 30
  47. #define NOTB 31
  48. #define NOP 32
  49. #define MOVA 33
  50. #define JSR 34
  51. #define RET 35
  52. #define HALT 36
  53. #define SEQ 37
  54. #define SGE 38
  55. #define SGT 39
  56. #define SLE 40
  57. #define SLT 41
  58. #define SNE 42
  59. #define BT 43
  60. #define BF 44
  61. #define BHI 45
  62. #define BLS 46
  63. #define BCC 47
  64. #define BCS 48
  65. #define BNE 49
  66. #define BEQ 50
  67. #define BVC 51
  68. #define BVS 52
  69. #define BPL 53
  70. #define BMI 54
  71. #define BGE 55
  72. #define BLT 56
  73. #define BGT 57
  74. #define BLE 58
  75. #define LOAD 59
  76. #define STORE 60
  77. #define AXE_READ 61
  78. #define AXE_WRITE 62
  79. #define INVALID_OPCODE -1
  80. /* data types */
  81. #define INTEGER_TYPE 0
  82. #define UNKNOWN_TYPE -1
  83. /* label special values */
  84. #define LABEL_UNSPECIFIED -1
  85. /* WARNINGS */
  86. #define WARN_DIVISION_BY_ZERO 1
  87. /* SIM errorcodes */
  88. #define AXE_OK 0
  89. #define AXE_OUT_OF_MEMORY 1
  90. #define AXE_PROGRAM_NOT_INITIALIZED 2
  91. #define AXE_INVALID_INSTRUCTION 3
  92. #define AXE_VARIABLE_ID_UNSPECIFIED 4
  93. #define AXE_VARIABLE_ALREADY_DECLARED 5
  94. #define AXE_INVALID_TYPE 6
  95. #define AXE_FOPEN_ERROR 7
  96. #define AXE_FCLOSE_ERROR 8
  97. #define AXE_INVALID_INPUT_FILE 9
  98. #define AXE_FWRITE_ERROR 10
  99. #define AXE_INVALID_DATA_FORMAT 11
  100. #define AXE_INVALID_OPCODE 12
  101. #define AXE_INVALID_REGISTER_INFO 13
  102. #define AXE_INVALID_LABEL 14
  103. #define AXE_INVALID_ARRAY_SIZE 15
  104. #define AXE_INVALID_VARIABLE 16
  105. #define AXE_INVALID_ADDRESS 17
  106. #define AXE_INVALID_EXPRESSION 18
  107. #define AXE_UNKNOWN_VARIABLE 19
  108. #define AXE_LABEL_ALREADY_ASSIGNED 20
  109. #define AXE_INVALID_LABEL_MANAGER 21
  110. #define AXE_SY_TABLE_ERROR 22
  111. #define AXE_NULL_DECLARATION 23
  112. #define AXE_INVALID_CFLOW_GRAPH 24
  113. #define AXE_INVALID_REG_ALLOC 25
  114. #define AXE_REG_ALLOC_ERROR 26
  115. #define AXE_TRANSFORM_ERROR 27
  116. #define AXE_SYNTAX_ERROR 28
  117. #define AXE_UNKNOWN_ERROR 29
  118. /* DIRECTIVE TYPES */
  119. #define DIR_WORD 0
  120. #define DIR_SPACE 1
  121. #define DIR_INVALID -1
  122. /* ADDRESS TYPES */
  123. #define ADDRESS_TYPE 0
  124. #define LABEL_TYPE 1
  125. /* CODEGEN FLAGS */
  126. #define CG_DIRECT_ALL 0
  127. #define CG_INDIRECT_ALL 3
  128. #define CG_INDIRECT_DEST 1
  129. #define CG_INDIRECT_SOURCE 2
  130. /* EXPRESSION TYPES */
  131. #define IMMEDIATE 0
  132. #define REGISTER 1
  133. #define INVALID_EXPRESSION -1
  134. /* binary comparison constants */
  135. #define _LT_ 0
  136. #define _GT_ 1
  137. #define _EQ_ 2
  138. #define _NOTEQ_ 3
  139. #define _LTEQ_ 4
  140. #define _GTEQ_ 5
  141. #endif