1 /* Functions for generic Darwin as target machine for GNU C compiler.
2 Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001
3 Free Software Foundation, Inc.
4 Contributed by Apple Computer Inc.
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
27 #include "hard-reg-set.h"
29 #include "insn-config.h"
30 #include "conditions.h"
31 #include "insn-flags.h"
33 #include "insn-attr.h"
38 /* need for IDENTIFIER_GLOBAL_VALUE and IDENTIFIER_LOCAL_VALUE */
43 #include "darwin-protos.h"
45 extern void machopic_output_stub PARAMS ((FILE *, const char *, const char *));
47 static int machopic_data_defined_p PARAMS ((const char *));
48 static int func_name_maybe_scoped PARAMS ((const char *));
50 /* Make everything that used to go in the text section really go there. */
52 int flag_no_mach_text_sections = 0;
55 name_needs_quotes (name)
59 while ((c = *name++) != '\0')
60 if (!isalnum (c) && c != '_')
66 * flag_pic = 1 ... generate only indirections
67 * flag_pic = 2 ... generate indirections and pure code
70 /* This module assumes that (const (symbol_ref "foo")) is a legal pic
71 reference, which will not be changed. */
73 static tree machopic_defined_list;
75 enum machopic_addr_class
76 machopic_classify_ident (ident)
79 const char *name = IDENTIFIER_POINTER (ident);
80 int lprefix = (((name[0] == '*' || name[0] == '&')
81 && (name[1] == 'L' || (name[1] == '"' && name[2] == 'L')))
88 tree temp, decl = lookup_name_darwin (ident);
94 const char *name = IDENTIFIER_POINTER (ident);
95 int len = strlen (name);
97 if ((len > 5 && !strcmp (name + len - 5, "$stub"))
98 || (len > 6 && !strcmp (name + len - 6, "$stub\"")))
99 return MACHOPIC_DEFINED_FUNCTION;
100 return MACHOPIC_DEFINED_DATA;
103 for (temp = machopic_defined_list;
105 temp = TREE_CHAIN (temp))
107 if (ident == TREE_VALUE (temp))
108 return MACHOPIC_DEFINED_DATA;
111 if (TREE_ASM_WRITTEN (ident))
112 return MACHOPIC_DEFINED_DATA;
114 return MACHOPIC_UNDEFINED;
117 /* variable declarations */
118 else if (TREE_CODE (decl) == VAR_DECL)
120 if ((DECL_INITIAL (decl)
121 || TREE_STATIC (decl))
122 && ! TREE_PUBLIC (decl))
123 return MACHOPIC_DEFINED_DATA;
126 /* function declarations */
127 else if (TREE_CODE (decl) == FUNCTION_DECL
128 && (!DECL_EXTERNAL (decl)))
130 if (TREE_STATIC (decl)
131 || TREE_ASM_WRITTEN (decl))
132 return MACHOPIC_DEFINED_FUNCTION;
135 for (temp = machopic_defined_list; temp != NULL_TREE; temp = TREE_CHAIN (temp))
137 if (ident == TREE_VALUE (temp))
139 if (TREE_CODE (decl) == FUNCTION_DECL)
140 return MACHOPIC_DEFINED_FUNCTION;
142 return MACHOPIC_DEFINED_DATA;
146 if (TREE_CODE (decl) == FUNCTION_DECL)
149 return MACHOPIC_DEFINED_FUNCTION;
151 return MACHOPIC_UNDEFINED_FUNCTION;
156 return MACHOPIC_DEFINED_DATA;
158 return MACHOPIC_UNDEFINED_DATA;
163 enum machopic_addr_class
164 machopic_classify_name (name)
167 return machopic_classify_ident (get_identifier (name));
171 machopic_ident_defined_p (ident)
174 switch (machopic_classify_ident (ident))
176 case MACHOPIC_UNDEFINED:
177 case MACHOPIC_UNDEFINED_DATA:
178 case MACHOPIC_UNDEFINED_FUNCTION:
186 machopic_data_defined_p (name)
189 switch (machopic_classify_ident (get_identifier (name)))
191 case MACHOPIC_DEFINED_DATA:
199 machopic_name_defined_p (name)
202 return machopic_ident_defined_p (get_identifier (name));
206 machopic_define_ident (ident)
209 if (!machopic_ident_defined_p (ident))
210 machopic_defined_list =
211 tree_cons (NULL_TREE, ident, machopic_defined_list);
215 machopic_define_name (name)
218 machopic_define_ident (get_identifier (name));
222 lookup_name_darwin (name)
227 if (!global_bindings_p()
228 && IDENTIFIER_LOCAL_VALUE (name))
229 val = IDENTIFIER_LOCAL_VALUE (name);
231 val = IDENTIFIER_GLOBAL_VALUE (name);
235 /* This is a static to make inline functions work. The rtx
236 representing the PIC base symbol always points to here. */
238 static char function_base[32];
240 static int current_pic_label_num;
243 machopic_function_base_name ()
245 static char *name = NULL;
246 static const char *current_name;
248 current_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
250 if (name != current_name)
252 current_function_uses_pic_offset_table = 1;
254 /* Save mucho space and time. Some of the C++ mangled names are over
255 700 characters long! Note that we produce a label containing a '-'
256 if the function we're compiling is an Objective-C method, as evinced
257 by the incredibly scientific test below. This is because code in
258 rs6000.c makes the same ugly test when loading the PIC reg. */
260 ++current_pic_label_num;
261 if (*current_name == '+' || *current_name == '-')
262 sprintf (function_base, "*\"L-%d$pb\"", current_pic_label_num);
264 sprintf (function_base, "*L%d$pb", current_pic_label_num);
269 return function_base;
272 static tree machopic_non_lazy_pointers = NULL;
274 /* Return a non-lazy pointer name corresponding to the given name,
275 either by finding it in our list of pointer names, or by generating
279 machopic_non_lazy_ptr_name (name)
282 tree temp, ident = get_identifier (name);
284 for (temp = machopic_non_lazy_pointers;
286 temp = TREE_CHAIN (temp))
288 if (ident == TREE_VALUE (temp))
289 return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
296 buffer = alloca (strlen (name) + 20);
298 strcpy (buffer, "&L");
300 strcat (buffer, name+1);
303 strcat (buffer, "_");
304 strcat (buffer, name);
307 strcat (buffer, "$non_lazy_ptr");
308 ptr_name = get_identifier (buffer);
310 machopic_non_lazy_pointers
311 = tree_cons (ptr_name, ident, machopic_non_lazy_pointers);
313 TREE_USED (machopic_non_lazy_pointers) = 0;
315 return IDENTIFIER_POINTER (ptr_name);
319 static tree machopic_stubs = 0;
321 /* Make sure the GC knows about our homemade lists. */
324 machopic_add_gc_roots ()
326 ggc_add_tree_root (&machopic_defined_list, 1);
327 ggc_add_tree_root (&machopic_non_lazy_pointers, 1);
328 ggc_add_tree_root (&machopic_stubs, 1);
331 /* Return the name of the stub corresponding to the given name,
332 generating a new stub name if necessary. */
335 machopic_stub_name (name)
338 tree temp, ident = get_identifier (name);
340 for (temp = machopic_stubs;
342 temp = TREE_CHAIN (temp))
344 if (ident == TREE_VALUE (temp))
345 return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
351 int needs_quotes = name_needs_quotes (name);
353 buffer = alloca (strlen (name) + 20);
356 strcpy (buffer, "&\"L");
358 strcpy (buffer, "&L");
361 strcat (buffer, name+1);
365 strcat (buffer, "_");
366 strcat (buffer, name);
370 strcat (buffer, "$stub\"");
372 strcat (buffer, "$stub");
373 ptr_name = get_identifier (buffer);
375 machopic_stubs = tree_cons (ptr_name, ident, machopic_stubs);
376 TREE_USED (machopic_stubs) = 0;
378 return IDENTIFIER_POINTER (ptr_name);
383 machopic_validate_stub_or_non_lazy_ptr (name, validate_stub)
387 tree temp, ident = get_identifier (name);
389 for (temp = (validate_stub ? machopic_stubs : machopic_non_lazy_pointers);
391 temp = TREE_CHAIN (temp))
392 if (ident == TREE_PURPOSE (temp))
394 /* Mark both the stub or non-lazy pointer as well as the
395 original symbol as being referenced. */
396 TREE_USED (temp) = 1;
397 if (TREE_CODE (TREE_VALUE (temp)) == IDENTIFIER_NODE)
398 TREE_SYMBOL_REFERENCED (TREE_VALUE (temp)) = 1;
402 /* Transform ORIG, which may be any data source, to the corresponding
403 source using indirections. */
406 machopic_indirect_data_reference (orig, reg)
411 if (! MACHOPIC_INDIRECT)
414 if (GET_CODE (orig) == SYMBOL_REF)
416 const char *name = XSTR (orig, 0);
418 if (machopic_data_defined_p (name))
420 rtx pic_base = gen_rtx (SYMBOL_REF, Pmode,
421 machopic_function_base_name ());
422 rtx offset = gen_rtx (CONST, Pmode,
423 gen_rtx (MINUS, Pmode, orig, pic_base));
425 #if defined (TARGET_TOC) /* i.e., PowerPC */
426 rtx hi_sum_reg = reg;
431 emit_insn (gen_rtx (SET, Pmode, hi_sum_reg,
432 gen_rtx (PLUS, Pmode, pic_offset_table_rtx,
433 gen_rtx (HIGH, Pmode, offset))));
434 emit_insn (gen_rtx (SET, Pmode, reg,
435 gen_rtx (LO_SUM, Pmode, hi_sum_reg, offset)));
439 #if defined (HAVE_lo_sum)
440 if (reg == 0) abort ();
442 emit_insn (gen_rtx (SET, VOIDmode, reg,
443 gen_rtx (HIGH, Pmode, offset)));
444 emit_insn (gen_rtx (SET, VOIDmode, reg,
445 gen_rtx (LO_SUM, Pmode, reg, offset)));
446 emit_insn (gen_rtx (USE, VOIDmode,
447 gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM)));
449 orig = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, reg);
455 ptr_ref = gen_rtx (SYMBOL_REF, Pmode,
456 machopic_non_lazy_ptr_name (name));
458 ptr_ref = gen_rtx_MEM (Pmode, ptr_ref);
459 RTX_UNCHANGING_P (ptr_ref) = 1;
463 else if (GET_CODE (orig) == CONST)
467 /* legitimize both operands of the PLUS */
468 if (GET_CODE (XEXP (orig, 0)) == PLUS)
470 base = machopic_indirect_data_reference (XEXP (XEXP (orig, 0), 0),
472 orig = machopic_indirect_data_reference (XEXP (XEXP (orig, 0), 1),
473 (base == reg ? 0 : reg));
478 if (MACHOPIC_PURE && GET_CODE (orig) == CONST_INT)
480 result = plus_constant_for_output (base, INTVAL (orig));
484 result = gen_rtx (PLUS, Pmode, base, orig);
487 if (RTX_UNCHANGING_P (base) && RTX_UNCHANGING_P (orig))
488 RTX_UNCHANGING_P (result) = 1;
490 if (MACHOPIC_JUST_INDIRECT && GET_CODE (base) == MEM)
494 emit_move_insn (reg, result);
499 result = force_reg (GET_MODE (result), result);
506 else if (GET_CODE (orig) == MEM)
507 XEXP (ptr_ref, 0) = machopic_indirect_data_reference (XEXP (orig, 0), reg);
508 /* When the target is i386, this code prevents crashes due to the
509 compiler's ignorance on how to move the PIC base register to
510 other registers. (The reload phase sometimes introduces such
512 else if (GET_CODE (orig) == PLUS
513 && GET_CODE (XEXP (orig, 0)) == REG
514 && REGNO (XEXP (orig, 0)) == PIC_OFFSET_TABLE_REGNUM
516 /* Prevent the same register from being erroneously used
517 as both the base and index registers. */
518 && GET_CODE (XEXP (orig, 1)) == CONST
522 emit_move_insn (reg, XEXP (orig, 0));
523 XEXP (ptr_ref, 0) = reg;
528 /* For MACHOPIC_INDIRECT_CALL_TARGET below, we need to beware of:
530 extern "C" { int f(); }
531 struct X { int f(); int g(); };
532 int X::f() { ::f(); }
533 int X::g() { ::f(); f();}
535 This is hairy. Both calls to "::f()" need to be indirect (i.e., to
536 appropriate symbol stubs), but since MACHOPIC_NAME_DEFINED_P calls
537 GET_IDENTIFIER which treats "f" as "X::f", and "X::f" is indeed (being)
538 defined somewhere in "X"'s inheritance hierarchy, MACHOPIC_NAME_DEFINED_P
539 returns TRUE when called with "f", which means that
540 MACHOPIC_INDIRECT_CALL_TARGET uses an "internal" call instead of an
541 indirect one as it should.
543 Our quick-n-dirty solution to this is to call the following
544 FUNC_NAME_MAYBE_SCOPED routine which (only for C++) checks whether
545 FNAME -- the name of the function which we're calling -- is NOT a
546 mangled C++ name, AND if the current function being compiled is a
547 method, and if so, use an "external" or "indirect" call.
549 Note that this function will be called ONLY when MACHOPIC_INDIRECT_TARGET_P
550 has already indicated that the target is NOT indirect.
552 This conservative solution will sometimes make indirect calls where
553 it might have been possible to make direct ones.
555 FUNC_NAME_MAYBE_SCOPED returns 1 to indicate a "C" name (not scoped),
556 which in turns means we should create a stub for an indirect call.
559 static int is_cplusplus = -1;
562 func_name_maybe_scoped (fname)
566 if (is_cplusplus < 0)
567 is_cplusplus = (strcmp (lang_identify (), "cplusplus") == 0);
571 /* If we have a method, then check whether the function we're trying to
572 call is a "C" function. If so, we should use an indirect call.
574 It turns out to be hard to tell whether "we have a method", since
575 static member functions have a TREE_CODE of FUNCTION_TYPE, as do
576 namespace-level non-member functions. So here, we always look for
577 an extern-"C"-like name, and make stubs for them no matter the
578 calling context. This is temporary, and leaves nagging suspicion
579 that improvements should be possible here. (I.e., I suspect that
580 it can still sometimes make stubs where it needn't.) */
582 /* if (1 || TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE) */
584 /* If fname is of the form "f__1X" or "f__Fv", it's C++. */
585 while (*fname == '_') ++fname; /* skip leading underscores */
588 if (fname[0] == '_' && fname[1] == '_'
589 && (fname[2] == 'F' || (fname[2] >= '0' && fname[2] <= '9')))
593 /* Not a C++ mangled name: must be "C", in which case play safe. */
600 /* Transform TARGET (a MEM), which is a function call target, to the
601 corresponding symbol_stub if necessary. Return a new MEM. */
604 machopic_indirect_call_target (target)
607 if (GET_CODE (target) != MEM)
610 if (MACHOPIC_INDIRECT && GET_CODE (XEXP (target, 0)) == SYMBOL_REF)
612 enum machine_mode mode = GET_MODE (XEXP (target, 0));
613 const char *name = XSTR (XEXP (target, 0), 0);
615 if (!machopic_name_defined_p (name) || func_name_maybe_scoped (name))
617 const char *stub_name = machopic_stub_name (name);
619 XEXP (target, 0) = gen_rtx (SYMBOL_REF, mode, stub_name);
620 RTX_UNCHANGING_P (target) = 1;
628 machopic_legitimize_pic_address (orig, mode, reg)
630 enum machine_mode mode;
637 /* First handle a simple SYMBOL_REF or LABEL_REF */
638 if (GET_CODE (orig) == LABEL_REF
639 || (GET_CODE (orig) == SYMBOL_REF
642 /* addr(foo) = &func+(foo-func) */
645 orig = machopic_indirect_data_reference (orig, reg);
647 if (GET_CODE (orig) == PLUS
648 && GET_CODE (XEXP (orig, 0)) == REG)
651 return force_reg (mode, orig);
653 emit_move_insn (reg, orig);
657 pic_base = gen_rtx (SYMBOL_REF, Pmode, machopic_function_base_name ());
659 if (GET_CODE (orig) == MEM)
663 if (reload_in_progress)
666 reg = gen_reg_rtx (Pmode);
670 if (GET_CODE (XEXP (orig, 0)) == SYMBOL_REF
671 || GET_CODE (XEXP (orig, 0)) == LABEL_REF)
673 rtx offset = gen_rtx (CONST, Pmode,
674 gen_rtx (MINUS, Pmode,
675 XEXP (orig, 0), pic_base));
676 #if defined (TARGET_TOC) /* i.e., PowerPC */
677 /* Generating a new reg may expose opportunities for
678 common subexpression elimination. */
680 (reload_in_progress ? reg : gen_reg_rtx (SImode));
682 emit_insn (gen_rtx (SET, Pmode, hi_sum_reg,
683 gen_rtx (PLUS, Pmode,
684 pic_offset_table_rtx,
685 gen_rtx (HIGH, Pmode, offset))));
686 emit_insn (gen_rtx (SET, VOIDmode, reg,
687 gen_rtx (MEM, GET_MODE (orig),
688 gen_rtx (LO_SUM, Pmode,
689 hi_sum_reg, offset))));
693 emit_insn (gen_rtx (USE, VOIDmode,
694 gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM)));
696 emit_insn (gen_rtx (SET, VOIDmode, reg,
697 gen_rtx (HIGH, Pmode,
698 gen_rtx (CONST, Pmode, offset))));
699 emit_insn (gen_rtx (SET, VOIDmode, reg,
700 gen_rtx (LO_SUM, Pmode, reg,
701 gen_rtx (CONST, Pmode, offset))));
702 pic_ref = gen_rtx (PLUS, Pmode,
703 pic_offset_table_rtx, reg);
707 #endif /* HAVE_lo_sum */
709 rtx pic = pic_offset_table_rtx;
710 if (GET_CODE (pic) != REG)
712 emit_move_insn (reg, pic);
716 emit_insn (gen_rtx (USE, VOIDmode,
717 gen_rtx (REG, Pmode, PIC_OFFSET_TABLE_REGNUM)));
720 pic_ref = gen_rtx (PLUS, Pmode,
722 gen_rtx (CONST, Pmode,
723 gen_rtx (MINUS, Pmode,
728 #if !defined (TARGET_TOC)
729 RTX_UNCHANGING_P (pic_ref) = 1;
730 emit_move_insn (reg, pic_ref);
731 pic_ref = gen_rtx (MEM, GET_MODE (orig), reg);
738 if (GET_CODE (orig) == SYMBOL_REF
739 || GET_CODE (orig) == LABEL_REF)
741 rtx offset = gen_rtx (CONST, Pmode,
742 gen_rtx (MINUS, Pmode, orig, pic_base));
743 #if defined (TARGET_TOC) /* i.e., PowerPC */
748 if (reload_in_progress)
751 reg = gen_reg_rtx (SImode);
756 emit_insn (gen_rtx (SET, Pmode, hi_sum_reg,
757 gen_rtx (PLUS, Pmode,
758 pic_offset_table_rtx,
759 gen_rtx (HIGH, Pmode, offset))));
760 emit_insn (gen_rtx (SET, VOIDmode, reg,
761 gen_rtx (LO_SUM, Pmode,
762 hi_sum_reg, offset)));
765 emit_insn (gen_rtx (SET, VOIDmode, reg,
766 gen_rtx (HIGH, Pmode, offset)));
767 emit_insn (gen_rtx (SET, VOIDmode, reg,
768 gen_rtx (LO_SUM, Pmode, reg, offset)));
769 pic_ref = gen_rtx (PLUS, Pmode,
770 pic_offset_table_rtx, reg);
774 #endif /* HAVE_lo_sum */
776 if (GET_CODE (orig) == REG)
782 rtx pic = pic_offset_table_rtx;
783 if (GET_CODE (pic) != REG)
785 emit_move_insn (reg, pic);
789 emit_insn (gen_rtx (USE, VOIDmode,
790 pic_offset_table_rtx));
792 pic_ref = gen_rtx (PLUS, Pmode,
794 gen_rtx (CONST, Pmode,
795 gen_rtx (MINUS, Pmode,
801 RTX_UNCHANGING_P (pic_ref) = 1;
803 if (GET_CODE (pic_ref) != REG)
807 emit_move_insn (reg, pic_ref);
812 return force_reg (mode, pic_ref);
821 else if (GET_CODE (orig) == SYMBOL_REF)
824 else if (GET_CODE (orig) == PLUS
825 && (GET_CODE (XEXP (orig, 0)) == MEM
826 || GET_CODE (XEXP (orig, 0)) == SYMBOL_REF
827 || GET_CODE (XEXP (orig, 0)) == LABEL_REF)
828 && XEXP (orig, 0) != pic_offset_table_rtx
829 && GET_CODE (XEXP (orig, 1)) != REG)
833 int is_complex = (GET_CODE (XEXP (orig, 0)) == MEM);
835 base = machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg);
836 orig = machopic_legitimize_pic_address (XEXP (orig, 1),
837 Pmode, (base == reg ? 0 : reg));
838 if (GET_CODE (orig) == CONST_INT)
840 pic_ref = plus_constant_for_output (base, INTVAL (orig));
845 pic_ref = gen_rtx (PLUS, Pmode, base, orig);
848 if (RTX_UNCHANGING_P (base) && RTX_UNCHANGING_P (orig))
849 RTX_UNCHANGING_P (pic_ref) = 1;
851 if (reg && is_complex)
853 emit_move_insn (reg, pic_ref);
856 /* Likewise, should we set special REG_NOTEs here? */
859 else if (GET_CODE (orig) == CONST)
861 return machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg);
864 else if (GET_CODE (orig) == MEM
865 && GET_CODE (XEXP (orig, 0)) == SYMBOL_REF)
867 rtx addr = machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg);
869 addr = gen_rtx (MEM, GET_MODE (orig), addr);
870 RTX_UNCHANGING_P (addr) = RTX_UNCHANGING_P (orig);
871 emit_move_insn (reg, addr);
880 machopic_finish (asm_out_file)
885 for (temp = machopic_stubs;
887 temp = TREE_CHAIN (temp))
889 char *sym_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
890 char *stub_name = IDENTIFIER_POINTER (TREE_PURPOSE (temp));
893 tree decl = lookup_name_darwin (TREE_VALUE (temp));
895 if (! TREE_USED (temp))
898 /* Don't emit stubs for static inline functions which have not
901 && TREE_CODE (decl) == FUNCTION_DECL
902 && DECL_INLINE (decl)
903 && ! TREE_PUBLIC (decl)
904 && ! TREE_ASM_WRITTEN (decl))
907 sym = alloca (strlen (sym_name) + 2);
908 if (sym_name[0] == '*' || sym_name[0] == '&')
909 strcpy (sym, sym_name + 1);
910 else if (sym_name[0] == '-' || sym_name[0] == '+')
911 strcpy (sym, sym_name);
913 sym[0] = '_', strcpy (sym + 1, sym_name);
915 stub = alloca (strlen (stub_name) + 2);
916 if (stub_name[0] == '*' || stub_name[0] == '&')
917 strcpy (stub, stub_name + 1);
919 stub[0] = '_', strcpy (stub + 1, stub_name);
921 machopic_output_stub (asm_out_file, sym, stub);
924 for (temp = machopic_non_lazy_pointers;
926 temp = TREE_CHAIN (temp))
928 char *sym_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
929 char *lazy_name = IDENTIFIER_POINTER (TREE_PURPOSE (temp));
931 tree decl = lookup_name_darwin (TREE_VALUE (temp));
934 if (! TREE_USED (temp))
937 if (machopic_ident_defined_p (TREE_VALUE (temp))
938 #if 0 /* add back when we have private externs */
939 || (decl && DECL_PRIVATE_EXTERN (decl))
944 assemble_align (UNITS_PER_WORD * BITS_PER_UNIT);
945 assemble_label (lazy_name);
946 assemble_integer (gen_rtx (SYMBOL_REF, Pmode, sym_name),
947 GET_MODE_SIZE (Pmode), 1);
951 machopic_nl_symbol_ptr_section ();
952 assemble_name (asm_out_file, lazy_name);
953 fprintf (asm_out_file, ":\n");
955 fprintf (asm_out_file, "\t.indirect_symbol ");
956 assemble_name (asm_out_file, sym_name);
957 fprintf (asm_out_file, "\n");
959 assemble_integer (const0_rtx, GET_MODE_SIZE (Pmode), 1);
965 machopic_operand_p (op)
968 if (MACHOPIC_JUST_INDIRECT)
970 while (GET_CODE (op) == CONST)
973 if (GET_CODE (op) == SYMBOL_REF)
974 return machopic_name_defined_p (XSTR (op, 0));
979 while (GET_CODE (op) == CONST)
982 if (GET_CODE (op) == MINUS
983 && GET_CODE (XEXP (op, 0)) == SYMBOL_REF
984 && GET_CODE (XEXP (op, 1)) == SYMBOL_REF
985 && machopic_name_defined_p (XSTR (XEXP (op, 0), 0))
986 && machopic_name_defined_p (XSTR (XEXP (op, 1), 0)))
989 #if 0 /*def TARGET_TOC*/ /* i.e., PowerPC */
990 /* Without this statement, the compiler crashes while compiling enquire.c
991 when targetting PowerPC. It is not known why this code is not needed
992 when targetting other processors. */
993 else if (GET_CODE (op) == SYMBOL_REF
994 && (machopic_classify_name (XSTR (op, 0))
995 == MACHOPIC_DEFINED_FUNCTION))