home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / vbcc / machines / amiga68k / machine.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-31  |  5.3 KB  |  150 lines

  1. /*  $VER: vbcc (machine.h amiga68k) V0.4    */
  2.  
  3. /*  Here should be routines to emulate the target's data types on   */
  4. /*  the host machine. Currently there are only macros so that the   */
  5. /*  host's arithmetic will be used.                                 */
  6.  
  7. /*  Declaration of the data types of the target machine.            */
  8. /*  zchar, zshort, zint and zlong are the basic signed integers.    */
  9. /*  zuchar, zushort, zuint and zulong are the basic unsigned ints.  */
  10. /*  zfloat and zdouble are float and double, of course.             */
  11. /*  zpointer is a generic pointer. Currently vbcc only supports     */
  12. /*  targets where all pointers have the same representation.        */
  13. typedef signed char zchar;
  14. typedef unsigned char zuchar;
  15. typedef signed short zshort;
  16. typedef unsigned short zushort;
  17. typedef signed int zint;
  18. typedef unsigned int zuint;
  19. typedef signed long zlong;
  20. typedef unsigned long zulong;
  21. typedef float zfloat;
  22. typedef double zdouble;
  23. typedef unsigned long zpointer;
  24.  
  25. /*  These functions convert data types of the target machine.       */
  26. /*  E.g. zl2zul takes a zlong and yields a zulong.                  */
  27. #define zc2zl(x) ((zlong)(x))
  28. #define zs2zl(x) ((zlong)(x))
  29. #define zi2zl(x) ((zlong)(x))
  30. #define zl2zc(x) ((zchar)(x))
  31. #define zl2zs(x) ((zshort)(x))
  32. #define zl2zi(x) ((zint)(x))
  33. #define zl2zul(x) ((zulong)(x))
  34. #define zuc2zul(x) ((zulong)(x))
  35. #define zus2zul(x) ((zulong)(x))
  36. #define zui2zul(x) ((zulong)(x))
  37. #define zul2zuc(x) ((zuchar)(x))
  38. #define zul2zus(x) ((zushort)(x))
  39. #define zul2zui(x) ((zuint)(x))
  40. #define zul2zl(x) ((zlong)(x))
  41. #define zf2zd(x) ((zdouble)(x))
  42. #define zd2zf(x) ((zfloat)(x))
  43. #define zl2zd(x) ((zdouble)(x))
  44. #define zd2zl(x) ((zlong)(x))
  45. #define zul2zd(x) ((zdouble)(x))
  46. #define zd2zul(x) ((zulong)(x))
  47. /*  Note that zul2zp must yield a valid null-pointer on the target  */
  48. /*  machine if the zulong is zero.                                  */
  49. #define zul2zp(x) ((zpointer)(x))
  50. #define zp2zul(x) ((zulong)(x))
  51.  
  52. /*  These functions convert data types of the host machine into     */
  53. /*  data types of the target machine and the other way round.       */
  54. #define l2zl(x) ((zlong)(x))
  55. #define zl2l(x) ((long)(x))
  56. #define ul2zul(x) ((zulong)(x))
  57. #define zul2ul(x) ((unsigned long)(x))
  58. #define d2zd(x) ((zdouble)(x))
  59. #define zd2d(x) ((double)(x))
  60.  
  61. /*  These functions perform arithmetic and logical operations on    */
  62. /*  the data types of the target machine.                           */
  63. #define zlmult(a,b) ((a)*(b))
  64. #define zulmult(a,b) ((a)*(b))
  65. #define zdmult(a,b) ((a)*(b))
  66. #define zldiv(a,b) ((a)/(b))
  67. #define zuldiv(a,b) ((a)/(b))
  68. #define zddiv(a,b) ((a)/(b))
  69. #define zlmod(a,b) ((a)%(b))
  70. #define zulmod(a,b) ((a)%(b))
  71. #define zllshift(a,b) ((a)<<(b))
  72. #define zullshift(a,b) ((a)<<(b))
  73. #define zlrshift(a,b) ((a)>>(b))
  74. #define zulrshift(a,b) ((a)>>(b))
  75. #define zladd(a,b) ((a)+(b))
  76. #define zuladd(a,b) ((a)+(b))
  77. #define zdadd(a,b) ((a)+(b))
  78. #define zlsub(a,b) ((a)-(b))
  79. #define zulsub(a,b) ((a)-(b))
  80. #define zdsub(a,b) ((a)-(b))
  81. #define zlor(a,b)   ((a)|(b))
  82. #define zulor(a,b)   ((a)|(b))
  83. #define zland(a,b)   ((a)&(b))
  84. #define zuland(a,b)   ((a)&(b))
  85. #define zlxor(a,b)   ((a)^(b))
  86. #define zulxor(a,b)   ((a)^(b))
  87. #define zlkompl(a)  (~(a))
  88. #define zulkompl(a)  (~(a))
  89. #define zdkompl(a)  (~(a))
  90.  
  91. /*  Comparison functions. Must return non-zero if equation is true. */
  92. #define zlleq(a,b) ((a)<=(b))
  93. #define zulleq(a,b) ((a)<=(b))
  94. #define zdleq(a,b) ((a)<=(b))
  95. #define zdeqto(a,b)    ((a)==(b))
  96. #define zleqto(a,b) ((a)==(b))
  97. #define zuleqto(a,b) ((a)==(b))
  98. #define zpleq(a,b)     ((a)<=(b))
  99. #define zpeqto(a,b)     ((a)==(b))
  100.  
  101.  
  102. /*  This struct can be used to implement machine-specific           */
  103. /*  addressing-modes.                                               */
  104. struct AddressingMode{
  105.     int basereg;
  106.     long dist;
  107.     int skal;
  108.     int dreg;
  109. };
  110.  
  111. /*  The number of registers of the target machine.                  */
  112. #define MAXR 24
  113.  
  114. /*  Number of commandline-options the code-generator accepts.       */
  115. #define MAXGF 20
  116.  
  117. /*  If this is set to zero vbcc will not generate ICs where the     */
  118. /*  target operand is the same as the 2nd source operand.           */
  119. /*  This can sometimes simplify the code-generator, but usually     */
  120. /*  the code is better if the code-generator allows it.             */
  121. #define USEQ2ASZ 0
  122.  
  123. /*  This specifies the smallest integer type that can be added to a */
  124. /*  pointer.                                                        */
  125. #define MINADDI2P SHORT
  126.  
  127. /*  If the bytes of an integer are ordered most significant byte    */
  128. /*  byte first and then decreasing set BIGENDIAN to 1.              */
  129. #define BIGENDIAN 1
  130.  
  131. /*  If the bytes of an integer are ordered lest significant byte    */
  132. /*  byte first and then increasing set LITTLEENDIAN to 1.           */
  133. #define LITTLEENDIAN 0
  134.  
  135. /*  Note that BIGENDIAN and LITTLEENDIAN are mutually exclusive.    */
  136.  
  137. /*  If switch-statements should be generated as a sequence of       */
  138. /*  SUB,TST,BEQ ICs rather than COMPARE,BEQ ICs set this to 1.      */
  139. /*  This can yield better code on some machines.                    */
  140. #define SWITCHSUBS 1
  141.  
  142. /*  In optimizing compilation certain library memcpy/strcpy-calls   */
  143. /*  with length known at compile-time will be inlined using an      */
  144. /*  ASSIGN-IC if the size is less or equal to INLINEMEMCPY.         */
  145. /*  The type used for the ASSIGN-IC will be UNSIGNED|CHAR.          */
  146. #define INLINEMEMCPY (1<<30)
  147.  
  148.  
  149.  
  150.