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

Subversion Repositories scarts

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* M32C Pragma support
2
   Copyright (C) 2004 Free Software Foundation, Inc.
3
   Contributed by Red Hat, Inc.
4
 
5
   This file is part of GCC.
6
 
7
   GCC 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
   GCC 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 GCC; see the file COPYING.  If not, write to
19
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
 
22
#include <stdio.h>
23
#include "config.h"
24
#include "system.h"
25
#include "coretypes.h"
26
#include "tm.h"
27
#include "tree.h"
28
#include "rtl.h"
29
#include "toplev.h"
30
#include "c-pragma.h"
31
#include "cpplib.h"
32
#include "hard-reg-set.h"
33
#include "output.h"
34
#include "m32c-protos.h"
35
#include "function.h"
36
#define MAX_RECOG_OPERANDS 10
37
#include "reload.h"
38
#include "target.h"
39
 
40
/* Implements the "GCC memregs" pragma.  This pragma takes only an
41
   integer, and is semantically identical to the -memregs= command
42
   line option.  The only catch is, the programmer should only use
43
   this pragma at the beginning of the file (preferably, in some
44
   project-wide header) to avoid ABI changes related to changing the
45
   list of available "registers".  */
46
static void
47
m32c_pragma_memregs (cpp_reader * reader ATTRIBUTE_UNUSED)
48
{
49
  /* on off */
50
  tree val;
51
  enum cpp_ttype type;
52
  HOST_WIDE_INT i;
53
  static char new_number[3];
54
 
55
  type = c_lex (&val);
56
  if (type == CPP_NUMBER)
57
    {
58
      if (host_integerp (val, 1))
59
        {
60
          i = tree_low_cst (val, 1);
61
 
62
          type = c_lex (&val);
63
          if (type != CPP_EOF)
64
            warning (0, "junk at end of #pragma GCC memregs [0..16]");
65
 
66
          if (0 <= i && i <= 16)
67
            {
68
              if (!ok_to_change_target_memregs)
69
                {
70
                  warning (0,
71
                           "#pragma GCC memregs must precede any function decls");
72
                  return;
73
                }
74
              new_number[0] = (i / 10) + '0';
75
              new_number[1] = (i % 10) + '0';
76
              new_number[2] = 0;
77
              target_memregs = new_number;
78
              m32c_conditional_register_usage ();
79
            }
80
          else
81
            {
82
              warning (0, "#pragma GCC memregs takes a number [0..16]");
83
            }
84
 
85
          return;
86
        }
87
    }
88
 
89
  error ("#pragma GCC memregs takes a number [0..16]");
90
}
91
 
92
/* Implements REGISTER_TARGET_PRAGMAS.  */
93
void
94
m32c_register_pragmas (void)
95
{
96
  c_register_pragma ("GCC", "memregs", m32c_pragma_memregs);
97
}

powered by: WebSVN 2.1.0

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