]>
Commit | Line | Data |
---|---|---|
43fabf7d JW |
1 | /* Intel 80960 specific, C compiler specific functions. |
2 | Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000 | |
3 | Free Software Foundation, Inc. | |
4 | Contributed by Steven McGeady, Intel Corp. | |
5 | Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson | |
6 | Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support. | |
7 | ||
7ec022b2 | 8 | This file is part of GCC. |
43fabf7d | 9 | |
7ec022b2 | 10 | GCC is free software; you can redistribute it and/or modify |
43fabf7d JW |
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 | ||
7ec022b2 | 15 | GCC is distributed in the hope that it will be useful, |
43fabf7d JW |
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 | |
7ec022b2 | 21 | along with GCC; see the file COPYING. If not, write to |
43fabf7d JW |
22 | the Free Software Foundation, 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. */ | |
24 | ||
25 | #include "config.h" | |
26 | #include "system.h" | |
4977bab6 ZW |
27 | #include "coretypes.h" |
28 | #include "tm.h" | |
43fabf7d JW |
29 | #include "cpplib.h" |
30 | #include "tree.h" | |
31 | #include "c-pragma.h" | |
43fabf7d JW |
32 | #include "toplev.h" |
33 | #include "ggc.h" | |
34 | #include "tm_p.h" | |
35 | ||
36 | /* Handle pragmas for compatibility with Intel's compilers. */ | |
37 | ||
38 | /* NOTE: ic960 R3.0 pragma align definition: | |
39 | ||
40 | #pragma align [(size)] | (identifier=size[,...]) | |
41 | #pragma noalign [(identifier)[,...]] | |
42 | ||
43 | (all parens are optional) | |
44 | ||
45 | - size is [1,2,4,8,16] | |
46 | - noalign means size==1 | |
47 | - applies only to component elements of a struct (and union?) | |
48 | - identifier applies to structure tag (only) | |
49 | - missing identifier means next struct | |
50 | ||
51 | - alignment rules for bitfields need more investigation. | |
52 | ||
53 | This implementation only handles the case of no identifiers. */ | |
54 | ||
55 | void | |
56 | i960_pr_align (pfile) | |
57 | cpp_reader *pfile ATTRIBUTE_UNUSED; | |
58 | { | |
59 | tree number; | |
60 | enum cpp_ttype type; | |
61 | int align; | |
62 | ||
63 | type = c_lex (&number); | |
64 | if (type == CPP_OPEN_PAREN) | |
65 | type = c_lex (&number); | |
66 | if (type == CPP_NAME) | |
67 | { | |
68 | warning ("sorry, not implemented: #pragma align NAME=SIZE"); | |
69 | return; | |
70 | } | |
71 | if (type != CPP_NUMBER) | |
72 | { | |
73 | warning ("malformed #pragma align - ignored"); | |
74 | return; | |
75 | } | |
76 | ||
77 | align = TREE_INT_CST_LOW (number); | |
78 | switch (align) | |
79 | { | |
80 | case 0: | |
81 | /* Return to last alignment. */ | |
82 | align = i960_last_maxbitalignment / 8; | |
83 | /* Fall through. */ | |
84 | case 16: | |
85 | case 8: | |
86 | case 4: | |
87 | case 2: | |
88 | case 1: | |
89 | i960_last_maxbitalignment = i960_maxbitalignment; | |
90 | i960_maxbitalignment = align * 8; | |
91 | break; | |
92 | ||
93 | default: | |
94 | /* Silently ignore bad values. */ | |
95 | break; | |
96 | } | |
97 | } | |
98 | ||
99 | void | |
100 | i960_pr_noalign (pfile) | |
101 | cpp_reader *pfile ATTRIBUTE_UNUSED; | |
102 | { | |
103 | enum cpp_ttype type; | |
104 | tree number; | |
105 | ||
106 | type = c_lex (&number); | |
107 | if (type == CPP_OPEN_PAREN) | |
108 | type = c_lex (&number); | |
109 | if (type == CPP_NAME) | |
110 | { | |
111 | warning ("sorry, not implemented: #pragma noalign NAME"); | |
112 | return; | |
113 | } | |
114 | ||
115 | i960_last_maxbitalignment = i960_maxbitalignment; | |
116 | i960_maxbitalignment = 8; | |
117 | } |