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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [m32c/] [m32c-pragma.c] - Blame information for rev 282

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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