diff options
Diffstat (limited to 'gcc/config/pa/pa.c')
-rw-r--r-- | gcc/config/pa/pa.c | 90 |
1 files changed, 85 insertions, 5 deletions
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index f0d15857f24..661eff59cca 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -148,6 +148,7 @@ static void output_deferred_plabels (void); #ifdef HPUX_LONG_DOUBLE_LIBRARY static void pa_hpux_init_libfuncs (void); #endif +static struct machine_function * pa_init_machine_status (void); /* Save the operands last given to a compare for use when we generate a scc or bcc insn. */ @@ -370,6 +371,8 @@ override_options (void) targetm.asm_out.unaligned_op.si = NULL; targetm.asm_out.unaligned_op.di = NULL; } + + init_machine_status = pa_init_machine_status; } static void @@ -381,6 +384,16 @@ pa_init_builtins (void) #endif } +/* Function to init struct machine_function. + This will be called, via a pointer variable, + from push_function_context. */ + +static struct machine_function * +pa_init_machine_status (void) +{ + return ggc_alloc_cleared (sizeof (machine_function)); +} + /* If FROM is a probable pointer register, mark TO as a probable pointer register with the same pointer alignment as FROM. */ @@ -4098,6 +4111,14 @@ pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) fputs ("\t.EXIT\n\t.PROCEND\n", file); + if (TARGET_SOM && TARGET_GAS) + { + /* We done with this subspace except possibly for some additional + debug information. Forget that we are in this subspace to ensure + that the next function is output in its own subspace. */ + forget_section (); + } + if (INSN_ADDRESSES_SET_P ()) { insn = get_last_nonnote_insn (); @@ -7897,8 +7918,9 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, fprintf (file, "\t.align 4\n"); ASM_OUTPUT_LABEL (file, label); fprintf (file, "\t.word P'%s\n", fname); - function_section (thunk_fndecl); } + else if (TARGET_SOM && TARGET_GAS) + forget_section (); current_thunk_number++; nbytes = ((nbytes + FUNCTION_BOUNDARY / BITS_PER_UNIT - 1) @@ -7933,6 +7955,9 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, static bool pa_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) { + if (TARGET_PORTABLE_RUNTIME) + return false; + /* Sibcalls are ok for TARGET_ELF32 as along as the linker is used in single subspace mode and the call is not indirect. As far as I know, there is no operating system support for the multiple subspace mode. @@ -7950,9 +7975,8 @@ pa_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) if (TARGET_64BIT) return false; - return (decl - && !TARGET_PORTABLE_RUNTIME - && !TREE_PUBLIC (decl)); + /* Sibcalls are only ok within a translation unit. */ + return (decl && !TREE_PUBLIC (decl)); } /* Returns 1 if the 6 operands specified in OPERANDS are suitable for @@ -9058,6 +9082,50 @@ cmpib_comparison_operator (rtx op, enum machine_mode mode) || GET_CODE (op) == LEU)); } +/* Return a string to output before text in the current function. + + This function is only used with SOM. Because we don't support + named subspaces, we can only create a new subspace or switch back + to the default text subspace. */ +const char * +som_text_section_asm_op (void) +{ + if (!TARGET_SOM) + return ""; + + if (TARGET_GAS) + { + if (cfun && !cfun->machine->in_nsubspa) + { + /* We only want to emit a .nsubspa directive once at the + start of the function. */ + cfun->machine->in_nsubspa = 1; + + /* Create a new subspace for the text. This provides + better stub placement and one-only functions. */ + if (cfun->decl + && DECL_ONE_ONLY (cfun->decl) + && !DECL_WEAK (cfun->decl)) + return + "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=24,COMDAT"; + + return "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$"; + } + else + { + /* There isn't a current function or the body of the current + function has been completed. So, we are changing to the + text section to output debugging information. Do this in + the default text section. We need to forget that we are + in the text section so that the function text_section in + varasm.c will call us the next time around. */ + forget_section (); + } + } + + return "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$"; +} + /* On hpux10, the linker will give an error if we have a reference in the read-only data section to a symbol defined in a shared library. Therefore, expressions that might require a reloc can @@ -9074,11 +9142,23 @@ pa_select_section (tree exp, int reloc, && (DECL_INITIAL (exp) == error_mark_node || TREE_CONSTANT (DECL_INITIAL (exp))) && !reloc) - readonly_data_section (); + { + if (TARGET_SOM + && DECL_ONE_ONLY (exp) + && !DECL_WEAK (exp)) + som_one_only_readonly_data_section (); + else + readonly_data_section (); + } else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c' && !(TREE_CODE (exp) == STRING_CST && flag_writable_strings) && !reloc) readonly_data_section (); + else if (TARGET_SOM + && TREE_CODE (exp) == VAR_DECL + && DECL_ONE_ONLY (exp) + && !DECL_WEAK (exp)) + som_one_only_data_section (); else data_section (); } |