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 / config / amigados.c < prev    next >
C/C++ Source or Header  |  1994-02-06  |  4KB  |  159 lines

  1. /* Definitions of target machine for GNU compiler.  amiga 68000/68020 version.
  2.    Copyright (C) 1992 Free Software Foundation, Inc.
  3.    Contributed by Markus M. Wild (wild@amiga.physik.unizh.ch).
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #include "m68k.c"
  22.  
  23. /* Does operand (which is a symbolic_operand) live in text space? If
  24.    so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
  25.  
  26.    This function is used in base relative code generation. */
  27.  
  28. int
  29. read_only_operand (operand)
  30.      rtx operand;
  31. {
  32.   if (GET_CODE (operand) == CONST)
  33.     operand = XEXP (XEXP (operand, 0), 0);
  34.   if (GET_CODE (operand) == SYMBOL_REF)
  35.     return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
  36.   return 1;
  37. }
  38.  
  39.  
  40. /* the rest of the file is to implement AmigaDOS specific keywords some day.
  41.    The approach used so far used __attribute__ for this, but this required
  42.    changes to c-parse.y as well as if we'd use the common keywords used
  43.    on commercial AmigaDOS C-compilers as well. So in the future I'll probably
  44.    switch to __saveds and __interrupt keywords as well.
  45.  
  46.    The rest of this file is currently ignored, because it's no longer
  47.    working with the current gcc version. */
  48.  
  49. #if not_yet_working
  50.  
  51. #include "tree.h"
  52.  
  53. struct attribute {
  54.   tree ident;
  55.   int  saveds : 1,
  56.        interrupt : 1;
  57. };
  58.  
  59.  
  60. static struct attribute *a_tab = 0;
  61. static int a_index, a_size;
  62.  
  63. void
  64. add_attr_entry (attr)
  65.     struct attribute *attr;
  66. {
  67.   if (! a_tab)
  68.     {
  69.       a_size = 10;
  70.       a_index = 0;
  71.       a_tab  = (struct attribute *) xmalloc (a_size * sizeof (struct attribute));
  72.     }
  73.  
  74.   if (a_index == a_size)
  75.     {
  76.       a_size <<= 1;
  77.       a_tab = (struct attribute *) xrealloc (a_tab, a_size * sizeof (struct attribute));
  78.     }
  79.  
  80.   a_tab[a_index++] = *attr;
  81. }
  82.  
  83.  
  84. void
  85. attr_do_saveds (function_ident)
  86.       tree function_ident;
  87. {
  88.   struct attribute attr, *a;
  89.   int i;
  90.  
  91.   for (i = 0, a = a_tab; i < a_index; i++, a++)
  92.     if (a->ident == function_ident)
  93.       {
  94.     a->saveds = 1;
  95.     return;
  96.       }
  97.  
  98.   /* create a new entry for this function */
  99.   attr.ident     = function_ident;
  100.   attr.saveds    = 1;
  101.   attr.interrupt = 0;
  102.   add_attr_entry (&attr);
  103. }
  104.  
  105. void
  106. attr_do_interrupt (function_ident)
  107.     tree function_ident;
  108. {
  109.   struct attribute attr, *a;
  110.   int i;
  111.  
  112.   for (i = 0, a = a_tab; i < a_index; i++, a++)
  113.     if (a->ident == function_ident)
  114.       {
  115.     /* __interrupt implies __saveds */
  116.     a->saveds    = 1;
  117.     a->interrupt = 1;
  118.     return;
  119.       }
  120.  
  121.   /* create a new entry for this function */
  122.   attr.ident     = function_ident;
  123.   attr.saveds     = 1;
  124.   attr.interrupt = 1;
  125.   add_attr_entry (&attr);
  126. }
  127.  
  128. int
  129. attr_does_saveds (function_name)
  130.     char *function_name;
  131. {
  132.   tree ident = get_identifier (function_name);
  133.   struct attribute *attr;
  134.   int i;
  135.   
  136.   for (i = 0, attr = a_tab; i < a_index; i++, attr++)
  137.     if (attr->ident == ident)
  138.       return attr->saveds;
  139.  
  140.   return 0;
  141. }
  142.  
  143. int
  144. attr_does_interrupt (function_name)
  145.     char *function_name;
  146. {
  147.   tree ident = get_identifier (function_name);
  148.   struct attribute *attr;
  149.   int i;
  150.   
  151.   for (i = 0, attr = a_tab; i < a_index; i++, attr++)
  152.     if (attr->ident == ident)
  153.       return attr->interrupt;
  154.  
  155.   return 0;
  156. }
  157.  
  158. #endif
  159.