home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / LIBSRC.ZOO / libsrc / longlong / unx386.h < prev    next >
C/C++ Source or Header  |  1991-12-08  |  4KB  |  122 lines

  1. /* Definitions for Unix assembler syntax for the Intel 80386.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* This file defines the aspects of assembler syntax
  21.    that are the same for all the i386 Unix systems
  22.    (though they may differ in non-Unix systems).  */
  23.  
  24. /* Define some concatenation macros to concatenate an opcode
  25.    and one, two or three operands.  In other assembler syntaxes
  26.    they may alter the order of ther operands.  */
  27.  
  28. /* Note that the other files fail to use these
  29.    in some of the places where they should.  */
  30.  
  31. #ifdef __STDC__
  32. #define AS2(a,b,c) #a " " #b "," #c
  33. #define AS3(a,b,c,d) #a " " #b "," #c "," #d
  34. #define AS1(a,b) #a " " #b
  35. #else
  36. #define AS1(a,b) "a b"
  37. #define AS2(a,b,c) "a b,c"
  38. #define AS3(a,b,c,d) "a b,c,d"
  39. #endif  
  40.  
  41. /* Output the size-letter for an opcode.
  42.    CODE is the letter used in an operand spec (L, B, W, S or Q).
  43.    CH is the corresponding lower case letter
  44.      (except if CODE is L then CH is `l').  */
  45. #define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE))
  46.  
  47. /* Opcode suffix for fullword insn.  */
  48. #define L_SIZE "l"
  49.  
  50. /* Prefix for register names in this syntax.  */
  51. #define RP "%"
  52.  
  53. /* Prefix for immediate operands in this syntax.  */
  54. #define IP "$"
  55.  
  56. /* Indirect call instructions should use `*'.  */
  57. #define USE_STAR 1
  58.  
  59. /* Prefix for a memory-operand X.  */
  60. #define PRINT_PTR(X, FILE)
  61.  
  62. /* Delimiters that surround base reg and index reg.  */
  63. #define ADDR_BEG(FILE) putc('(', (FILE))
  64. #define ADDR_END(FILE) putc(')', (FILE))
  65.  
  66. /* Print an index register (whose rtx is IREG).  */
  67. #define PRINT_IREG(FILE,IREG) \
  68.   do                                \
  69.   { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); }    \
  70.   while (0)
  71.   
  72. /* Print an index scale factor SCALE.  */
  73. #define PRINT_SCALE(FILE,SCALE) \
  74.   if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE))
  75.  
  76. /* Print a base/index combination.
  77.    BREG is the base reg rtx, IREG is the index reg rtx,
  78.    and SCALE is the index scale factor (an integer).  */
  79.  
  80. #define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \
  81.   { ADDR_BEG (FILE);                 \
  82.     if (BREG) PRINT_REG ((BREG), 0, (FILE));    \
  83.     if ((IREG) != 0)                \
  84.       { PRINT_IREG ((FILE), (IREG));        \
  85.         PRINT_SCALE ((FILE), (SCALE)); }    \
  86.     ADDR_END (FILE); }
  87.  
  88. /* Define the syntax of pseudo-ops, labels and comments.  */
  89.  
  90. /* String containing the assembler's comment-starter.  */
  91.  
  92. #define ASM_COMMENT_START "/"
  93. #define COMMENT_BEGIN "/"
  94.  
  95. /* Output to assembler file text saying following lines
  96.    may contain character constants, extra white space, comments, etc.  */
  97.  
  98. #define ASM_APP_ON "/APP\n"
  99.  
  100. /* Output to assembler file text saying following lines
  101.    no longer contain unusual constructs.  */
  102.  
  103. #define ASM_APP_OFF "/NO_APP\n"
  104.  
  105. /* Output before read-only data.  */
  106.  
  107. #define TEXT_SECTION_ASM_OP ".text"
  108.  
  109. /* Output before writable (initialized) data.  */
  110.  
  111. #define DATA_SECTION_ASM_OP ".data"
  112.  
  113. /* Output before writable (uninitialized) data.  */
  114.  
  115. #define BSS_SECTION_ASM_OP ".bss"
  116.  
  117. /* This is how to output a command to make the user-level label named NAME
  118.    defined for reference from other files.  */
  119.  
  120. #define ASM_GLOBALIZE_LABEL(FILE,NAME)    \
  121.   (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
  122.