OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [config/] [c4x/] [c4x-c.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* Subroutines for the C front end on the TMS320C[34]x
2
   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3
   Free Software Foundation, Inc.
4
 
5
   Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
6
              and Herman Ten Brugge (Haj.Ten.Brugge@net.HCC.nl).
7
 
8
This file is part of GCC.
9
 
10
GCC is free software; you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 2, or (at your option)
13
any later version.
14
 
15
GCC is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
GNU General Public License for more details.
19
 
20
You should have received a copy of the GNU General Public License
21
along with GCC; see the file COPYING.  If not, write to
22
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
Boston, MA 02110-1301, USA.  */
24
 
25
#include "config.h"
26
#include "system.h"
27
#include "coretypes.h"
28
#include "tm.h"
29
#include "tree.h"
30
#include "toplev.h"
31
#include "cpplib.h"
32
#include "c-pragma.h"
33
#include "tm_p.h"
34
 
35
static int c4x_parse_pragma (const char *, tree *, tree *);
36
 
37
/* Handle machine specific pragmas for compatibility with existing
38
   compilers for the C3x/C4x.
39
 
40
   pragma                                  attribute
41
   ----------------------------------------------------------
42
   CODE_SECTION(symbol,"section")          section("section")
43
   DATA_SECTION(symbol,"section")          section("section")
44
   FUNC_CANNOT_INLINE(function)
45
   FUNC_EXT_CALLED(function)
46
   FUNC_IS_PURE(function)                  const
47
   FUNC_IS_SYSTEM(function)
48
   FUNC_NEVER_RETURNS(function)            noreturn
49
   FUNC_NO_GLOBAL_ASG(function)
50
   FUNC_NO_IND_ASG(function)
51
   INTERRUPT(function)                     interrupt
52
 
53
   */
54
 
55
/* Parse a C4x pragma, of the form ( function [, "section"] ) \n.
56
   FUNC is loaded with the IDENTIFIER_NODE of the function, SECT with
57
   the STRING_CST node of the string.  If SECT is null, then this
58
   pragma doesn't take a section string.  Returns 0 for a good pragma,
59
   -1 for a malformed pragma.  */
60
#define BAD(gmsgid, arg) \
61
  do { warning (OPT_Wpragmas, gmsgid, arg); return -1; } while (0)
62
 
63
static int
64
c4x_parse_pragma (name, func, sect)
65
     const char *name;
66
     tree *func;
67
     tree *sect;
68
{
69
  tree f, s, x;
70
 
71
  if (c_lex (&x) != CPP_OPEN_PAREN)
72
    BAD ("missing '(' after '#pragma %s' - ignored", name);
73
 
74
  if (c_lex (&f) != CPP_NAME)
75
    BAD ("missing function name in '#pragma %s' - ignored", name);
76
 
77
  if (sect)
78
    {
79
      if (c_lex (&x) != CPP_COMMA)
80
        BAD ("malformed '#pragma %s' - ignored", name);
81
      if (c_lex (&s) != CPP_STRING)
82
        BAD ("missing section name in '#pragma %s' - ignored", name);
83
      *sect = s;
84
    }
85
 
86
  if (c_lex (&x) != CPP_CLOSE_PAREN)
87
    BAD ("missing ')' for '#pragma %s' - ignored", name);
88
 
89
  if (c_lex (&x) != CPP_EOF)
90
    warning (OPT_Wpragmas, "junk at end of '#pragma %s'", name);
91
 
92
  *func = f;
93
  return 0;
94
}
95
 
96
void
97
c4x_pr_CODE_SECTION (pfile)
98
     cpp_reader *pfile ATTRIBUTE_UNUSED;
99
{
100
  tree func, sect;
101
 
102
  if (c4x_parse_pragma ("CODE_SECTION", &func, &sect))
103
    return;
104
  code_tree = chainon (code_tree,
105
                       build_tree_list (func,
106
                                        build_tree_list (NULL_TREE, sect)));
107
}
108
 
109
void
110
c4x_pr_DATA_SECTION (pfile)
111
     cpp_reader *pfile ATTRIBUTE_UNUSED;
112
{
113
  tree func, sect;
114
 
115
  if (c4x_parse_pragma ("DATA_SECTION", &func, &sect))
116
    return;
117
  data_tree = chainon (data_tree,
118
                       build_tree_list (func,
119
                                        build_tree_list (NULL_TREE, sect)));
120
}
121
 
122
void
123
c4x_pr_FUNC_IS_PURE (pfile)
124
     cpp_reader *pfile ATTRIBUTE_UNUSED;
125
{
126
  tree func;
127
 
128
  if (c4x_parse_pragma ("FUNC_IS_PURE", &func, 0))
129
    return;
130
  pure_tree = chainon (pure_tree, build_tree_list (func, NULL_TREE));
131
}
132
 
133
void
134
c4x_pr_FUNC_NEVER_RETURNS (pfile)
135
     cpp_reader *pfile ATTRIBUTE_UNUSED;
136
{
137
  tree func;
138
 
139
  if (c4x_parse_pragma ("FUNC_NEVER_RETURNS", &func, 0))
140
    return;
141
  noreturn_tree = chainon (noreturn_tree, build_tree_list (func, NULL_TREE));
142
}
143
 
144
void
145
c4x_pr_INTERRUPT (pfile)
146
     cpp_reader *pfile ATTRIBUTE_UNUSED;
147
{
148
  tree func;
149
 
150
  if (c4x_parse_pragma ("INTERRUPT", &func, 0))
151
    return;
152
  interrupt_tree = chainon (interrupt_tree, build_tree_list (func, NULL_TREE));
153
}
154
 
155
/* Used for FUNC_CANNOT_INLINE, FUNC_EXT_CALLED, FUNC_IS_SYSTEM,
156
   FUNC_NO_GLOBAL_ASG, and FUNC_NO_IND_ASG.  */
157
void
158
c4x_pr_ignored (pfile)
159
     cpp_reader *pfile ATTRIBUTE_UNUSED;
160
{
161
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.