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 8This file is part of GNU CC. 9 10GNU CC is free software; you can redistribute it and/or modify 11it under the terms of the GNU General Public License as published by 12the Free Software Foundation; either version 2, or (at your option) 13any later version. 14 15GNU CC is distributed in the hope that it will be useful, 16but WITHOUT ANY WARRANTY; without even the implied warranty of 17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18GNU General Public License for more details. 19 20You should have received a copy of the GNU General Public License 21along with GNU CC; see the file COPYING. If not, write to 22the Free Software Foundation, 59 Temple Place - Suite 330, 23Boston, MA 02111-1307, USA. */ 24 25#include "config.h" 26#include "system.h" 27#include "cpplib.h" 28#include "tree.h" 29#include "c-pragma.h" 30#include "toplev.h" 31#include "ggc.h" 32#include "tm_p.h" 33 34/* Handle pragmas for compatibility with Intel's compilers. */ 35 36/* NOTE: ic960 R3.0 pragma align definition: 37 38 #pragma align [(size)] | (identifier=size[,...]) 39 #pragma noalign [(identifier)[,...]] 40 41 (all parens are optional) 42 43 - size is [1,2,4,8,16] 44 - noalign means size==1 45 - applies only to component elements of a struct (and union?) 46 - identifier applies to structure tag (only) 47 - missing identifier means next struct 48 49 - alignment rules for bitfields need more investigation. 50 51 This implementation only handles the case of no identifiers. */ 52 53void 54i960_pr_align (pfile) 55 cpp_reader *pfile ATTRIBUTE_UNUSED; 56{ 57 tree number; 58 enum cpp_ttype type; 59 int align; 60 61 type = c_lex (&number); 62 if (type == CPP_OPEN_PAREN) 63 type = c_lex (&number); 64 if (type == CPP_NAME) 65 { 66 warning ("sorry, not implemented: #pragma align NAME=SIZE"); 67 return; 68 } 69 if (type != CPP_NUMBER) 70 { 71 warning ("malformed #pragma align - ignored"); 72 return; 73 } 74 75 align = TREE_INT_CST_LOW (number); 76 switch (align) 77 { 78 case 0: 79 /* Return to last alignment. */ 80 align = i960_last_maxbitalignment / 8; 81 /* Fall through. */ 82 case 16: 83 case 8: 84 case 4: 85 case 2: 86 case 1: 87 i960_last_maxbitalignment = i960_maxbitalignment; 88 i960_maxbitalignment = align * 8; 89 break; 90 91 default: 92 /* Silently ignore bad values. */ 93 break; 94 } 95} 96 97void 98i960_pr_noalign (pfile) 99 cpp_reader *pfile ATTRIBUTE_UNUSED; 100{ 101 enum cpp_ttype type; 102 tree number; 103 104 type = c_lex (&number); 105 if (type == CPP_OPEN_PAREN) 106 type = c_lex (&number); 107 if (type == CPP_NAME) 108 { 109 warning ("sorry, not implemented: #pragma noalign NAME"); 110 return; 111 } 112 113 i960_last_maxbitalignment = i960_maxbitalignment; 114 i960_maxbitalignment = 8; 115} 116