OSDN Git Service

*** empty log message ***
[pf3gnuchains/gcc-fork.git] / gcc / halfpic.c
1 /* OSF/rose half-pic support functions.
2    Copyright (C) 1992 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20 /* The OSF/rose half-pic model assumes that the non-library code does
21    not need to have full PIC (position independent code), but rather,
22    that pointers to external references are put into the data section
23    and derefenced as normal pointers.  References to static data does
24    not need to be PIC-ized.
25
26    Another optimization is to have the compiler know what symbols are
27    in the shared libraries, and to only lay down the pointers to
28    things which in the library proper.  */
29
30 #include "config.h"
31
32 #ifdef HALF_PIC_INIT
33
34 #include "tree.h"
35 #include "rtl.h"
36 #include <stdio.h>
37
38 extern rtx eliminate_constant_term ();
39
40 int flag_half_pic;              /* Global half-pic flag.  */
41
42 \f
43 /* Do any half-pic initializations.  */
44
45 void
46 half_pic_init ()
47 {
48   flag_half_pic = TRUE;
49 }
50
51 \f
52 /* Encode in a declaration whether or not it is half-pic.  */
53
54 void
55 half_pic_encode (decl)
56      tree decl;
57 {
58 #if 0
59   fprintf (stderr, "\n========== Half_pic_encode\n");
60   debug_tree (decl);
61 #endif
62 }
63
64 \f
65 /* Return whether an address is half-pic.  */
66
67 int
68 half_pic_address_p (addr)
69      rtx addr;
70 {
71   char *name;
72
73   switch (GET_CODE (addr))
74     {
75     case CONST:
76       rtx offset = const0_rtx;
77       addr = eliminate_constant_term (addr, &offset);
78       if (GET_CODE (addr) != SYMBOL_REF)
79         return FALSE;
80         
81       /* fall through */
82
83     case SYMBOL_REF:
84       name = XSTR (addr, 0);
85
86       /* If this is a label, it will have a '*' in front of it.  */
87       if (name[0] == '*')
88         return FALSE;
89     }
90
91   return FALSE;
92 }
93
94 #endif /* HALF_PIC_INIT */