]>
gcc.gnu.org Git - gcc.git/blob - gcc/config/pru/pru-pragma.c
1 /* PRU target specific pragmas
2 Copyright (C) 2015-2020 Free Software Foundation, Inc.
3 Contributed by Dimitar Dimitrov <dimitar@dinux.eu>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
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/>. */
21 #define IN_TARGET_CODE 1
25 #include "coretypes.h"
30 #include "c-family/c-pragma.h"
31 #include "c-family/c-common.h"
32 #include "diagnostic-core.h"
34 #include "pru-protos.h"
37 /* Implements the "pragma CTABLE_ENTRY" pragma. This pragma takes a
38 CTABLE index and an address, and instructs the compiler that
39 LBCO/SBCO can be used on that base address.
41 WARNING: Only immediate constant addresses are currently supported. */
43 pru_pragma_ctable_entry (cpp_reader
* reader ATTRIBUTE_UNUSED
)
45 tree ctable_index
, base_addr
;
48 type
= pragma_lex (&ctable_index
);
49 if (type
== CPP_NUMBER
&& tree_fits_uhwi_p (ctable_index
))
51 type
= pragma_lex (&base_addr
);
52 if (type
== CPP_NUMBER
&& tree_fits_uhwi_p (base_addr
))
54 unsigned HOST_WIDE_INT i
= tree_to_uhwi (ctable_index
);
55 unsigned HOST_WIDE_INT base
= tree_to_uhwi (base_addr
);
57 type
= pragma_lex (&base_addr
);
59 error ("junk at end of %<#pragma CTABLE_ENTRY%>");
60 else if (i
>= ARRAY_SIZE (pru_ctable
))
61 error ("%<CTABLE_ENTRY%> index %" HOST_WIDE_INT_PRINT
"d"
63 else if (pru_ctable
[i
].valid
&& pru_ctable
[i
].base
!= base
)
64 error ("redefinition of %<CTABLE_ENTRY "
65 "%" HOST_WIDE_INT_PRINT
"d%>", i
);
69 warning (0, "%<CTABLE_ENTRY%> base address is not "
71 pru_ctable
[i
].base
= base
;
72 pru_ctable
[i
].valid
= true;
77 error ("malformed %<#pragma CTABLE_ENTRY%> variable address");
80 /* Implements REGISTER_TARGET_PRAGMAS. */
82 pru_register_pragmas (void)
84 c_register_pragma (NULL
, "ctable_entry", pru_pragma_ctable_entry
);
85 c_register_pragma (NULL
, "CTABLE_ENTRY", pru_pragma_ctable_entry
);
This page took 0.043717 seconds and 5 git commands to generate.