home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / rtl.h < prev    next >
C/C++ Source or Header  |  1994-02-06  |  37KB  |  902 lines

  1. /* Register Transfer Language (RTL) definitions for GNU C-Compiler
  2.    Copyright (C) 1987, 1991, 1992 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.  
  21. #include "machmode.h"
  22.  
  23. #undef FFS  /* Some systems predefine this symbol; don't let it interfere.  */
  24. #undef FLOAT /* Likewise.  */
  25.  
  26. /* Register Transfer Language EXPRESSIONS CODES */
  27.  
  28. #define RTX_CODE    enum rtx_code
  29. enum rtx_code  {
  30.  
  31. #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   ENUM ,
  32. #include "rtl.def"        /* rtl expressions are documented here */
  33. #undef DEF_RTL_EXPR
  34.  
  35.   LAST_AND_UNUSED_RTX_CODE};    /* A convenient way to get a value for
  36.                    NUM_RTX_CODE.
  37.                    Assumes default enum value assignment.  */
  38.  
  39. #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
  40.                 /* The cast here, saves many elsewhere.  */
  41.  
  42. extern int rtx_length[];
  43. #define GET_RTX_LENGTH(CODE)        (rtx_length[(int)(CODE)])
  44.  
  45. extern char * const rtx_name[];
  46. #define GET_RTX_NAME(CODE)        (rtx_name[(int)(CODE)])
  47.  
  48. extern char * const rtx_format[];
  49. #define GET_RTX_FORMAT(CODE)        (rtx_format[(int)(CODE)])
  50.  
  51. extern const char rtx_class[];
  52. #define GET_RTX_CLASS(CODE)        (rtx_class[(int)(CODE)])
  53.  
  54. /* Common union for an element of an rtx.  */
  55.  
  56. typedef union rtunion_def
  57. {
  58.   HOST_WIDE_INT rtwint;
  59.   int rtint;
  60.   char *rtstr;
  61.   struct rtx_def *rtx;
  62.   struct rtvec_def *rtvec;
  63.   enum machine_mode rttype;
  64. } rtunion;
  65.  
  66. /* RTL expression ("rtx").  */
  67.  
  68. typedef struct rtx_def
  69. {
  70. #ifdef ONLY_INT_FIELDS
  71. #ifdef CODE_FIELD_BUG
  72.   unsigned int code : 16;
  73. #else
  74.   unsigned short code;
  75. #endif
  76. #else
  77.   /* The kind of expression this is.  */
  78.   enum rtx_code code : 16;
  79. #endif
  80.   /* The kind of value the expression has.  */
  81. #ifdef ONLY_INT_FIELDS
  82.   int mode : 8;
  83. #else
  84.   enum machine_mode mode : 8;
  85. #endif
  86.   /* 1 in an INSN if it can alter flow of control
  87.      within this function.  Not yet used!  */
  88.   unsigned int jump : 1;
  89.   /* 1 in an INSN if it can call another function.  Not yet used!  */
  90.   unsigned int call : 1;
  91.   /* 1 in a MEM or REG if value of this expression will never change
  92.      during the current function, even though it is not
  93.      manifestly constant.
  94.      1 in a SUBREG if it is from a promoted variable that is unsigned.
  95.      1 in a SYMBOL_REF if it addresses something in the per-function
  96.      constants pool.
  97.      1 in a CALL_INSN if it is a const call.
  98.      1 in a JUMP_INSN if it is a branch that should be annulled.  Valid from
  99.      reorg until end of compilation; cleared before used.  */
  100.   unsigned int unchanging : 1;
  101.   /* 1 in a MEM expression if contents of memory are volatile.
  102.      1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
  103.      if it is deleted.
  104.      1 in a REG expression if corresponds to a variable declared by the user.
  105.      0 for an internally generated temporary.
  106.      In a SYMBOL_REF, this flag is used for machine-specific purposes.
  107.      In a LABEL_REF or in a REG_LABEL note, this is LABEL_REF_NONLOCAL_P.  */
  108.   unsigned int volatil : 1;
  109.   /* 1 in a MEM referring to a field of a structure (not a union!).
  110.      0 if the MEM was a variable or the result of a * operator in C;
  111.      1 if it was the result of a . or -> operator (on a struct) in C.
  112.      1 in a REG if the register is used only in exit code a loop.
  113.      1 in a SUBREG expression if was generated from a variable with a 
  114.      promoted mode.
  115.      1 in a CODE_LABEL if the label is used for nonlocal gotos
  116.      and must not be deleted even if its count is zero.
  117.      1 in a LABEL_REF if this is a reference to a label outside the
  118.      current loop.
  119.      1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
  120.      together with the preceding insn.  Valid only within sched.
  121.      1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
  122.      from the target of a branch.  Valid from reorg until end of compilation;
  123.      cleared before used.  */
  124.   unsigned int in_struct : 1;
  125.   /* 1 if this rtx is used.  This is used for copying shared structure.
  126.      See `unshare_all_rtl'.
  127.      In a REG, this is not needed for that purpose, and used instead 
  128.      in `leaf_renumber_regs_insn'.
  129.      In a SYMBOL_REF, means that emit_library_call
  130.      has used it as the function.  */
  131.   unsigned int used : 1;
  132.   /* Nonzero if this rtx came from procedure integration.
  133.      In a REG, nonzero means this reg refers to the return value
  134.      of the current function.  */
  135.   unsigned integrated : 1;
  136.   /* The first element of the operands of this rtx.
  137.      The number of operands and their types are controlled
  138.      by the `code' field, according to rtl.def.  */
  139.   rtunion fld[1];
  140. } *rtx;
  141.  
  142. /* Add prototype support.  */
  143. #ifndef PROTO
  144. #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
  145. #define PROTO(ARGS) ARGS
  146. #else
  147. #define PROTO(ARGS) ()
  148. #endif
  149. #endif
  150.  
  151. #define NULL_RTX (rtx) 0
  152.  
  153. /* Define a generic NULL if one hasn't already been defined.  */
  154.  
  155. #ifndef NULL
  156. #define NULL 0
  157. #endif
  158.  
  159. #ifndef GENERIC_PTR
  160. #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
  161. #define GENERIC_PTR void *
  162. #else
  163. #define GENERIC_PTR char *
  164. #endif
  165. #endif
  166.  
  167. #ifndef NULL_PTR
  168. #define NULL_PTR ((GENERIC_PTR)0)
  169. #endif
  170.  
  171. /* Define macros to access the `code' field of the rtx.  */
  172.  
  173. #ifdef SHORT_ENUM_BUG
  174. #define GET_CODE(RTX)        ((enum rtx_code) ((RTX)->code))
  175. #define PUT_CODE(RTX, CODE)    ((RTX)->code = ((short) (CODE)))
  176. #else
  177. #define GET_CODE(RTX)        ((RTX)->code)
  178. #define PUT_CODE(RTX, CODE)    ((RTX)->code = (CODE))
  179. #endif
  180.  
  181. #define GET_MODE(RTX)        ((RTX)->mode)
  182. #define PUT_MODE(RTX, MODE)    ((RTX)->mode = (MODE))
  183.  
  184. #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
  185. #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
  186.  
  187. /* RTL vector.  These appear inside RTX's when there is a need
  188.    for a variable number of things.  The principle use is inside
  189.    PARALLEL expressions.  */
  190.  
  191. typedef struct rtvec_def{
  192.   unsigned num_elem;        /* number of elements */
  193.   rtunion elem[1];
  194. } *rtvec;
  195.  
  196. #define NULL_RTVEC (rtvec) 0
  197.  
  198. #define GET_NUM_ELEM(RTVEC)        ((RTVEC)->num_elem)
  199. #define PUT_NUM_ELEM(RTVEC, NUM)    ((RTVEC)->num_elem = (unsigned) NUM)
  200.  
  201. #define RTVEC_ELT(RTVEC, I)  ((RTVEC)->elem[(I)].rtx)
  202.  
  203. /* 1 if X is a REG.  */
  204.  
  205. #define REG_P(X) (GET_CODE (X) == REG)
  206.  
  207. /* 1 if X is a constant value that is an integer.  */
  208.  
  209. #define CONSTANT_P(X)   \
  210.   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF        \
  211.    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE        \
  212.    || GET_CODE (X) == CONST || GET_CODE (X) == HIGH)
  213.  
  214. /* General accessor macros for accessing the fields of an rtx.  */
  215.  
  216. #define XEXP(RTX, N)    ((RTX)->fld[N].rtx)
  217. #define XINT(RTX, N)    ((RTX)->fld[N].rtint)
  218. #define XWINT(RTX, N)    ((RTX)->fld[N].rtwint)
  219. #define XSTR(RTX, N)    ((RTX)->fld[N].rtstr)
  220. #define XVEC(RTX, N)    ((RTX)->fld[N].rtvec)
  221. #define XVECLEN(RTX, N)    ((RTX)->fld[N].rtvec->num_elem)
  222. #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx)
  223.  
  224. /* ACCESS MACROS for particular fields of insns.  */
  225.  
  226. /* Holds a unique number for each insn.
  227.    These are not necessarily sequentially increasing.  */
  228. #define INSN_UID(INSN)    ((INSN)->fld[0].rtint)
  229.  
  230. /* Chain insns together in sequence.  */
  231. #define PREV_INSN(INSN)    ((INSN)->fld[1].rtx)
  232. #define NEXT_INSN(INSN)    ((INSN)->fld[2].rtx)
  233.  
  234. /* The body of an insn.  */
  235. #define PATTERN(INSN)    ((INSN)->fld[3].rtx)
  236.  
  237. /* Code number of instruction, from when it was recognized.
  238.    -1 means this instruction has not been recognized yet.  */
  239. #define INSN_CODE(INSN) ((INSN)->fld[4].rtint)
  240.  
  241. /* Set up in flow.c; empty before then.
  242.    Holds a chain of INSN_LIST rtx's whose first operands point at
  243.    previous insns with direct data-flow connections to this one.
  244.    That means that those insns set variables whose next use i