Commit 5b71a4e7 by David Edelsohn Committed by David Edelsohn

rs6000.h (FUNCTION_MODE): Always use SImode.

        * config/rs6000/rs6000.h (FUNCTION_MODE): Always use SImode.
        * config/rs6000/rs6000.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): Redefine
        as hook_bool_tree_hwi_hwi_tree_true.
        (rs6000_emit_allocate_stack): Use TARGET_32BIT.
        (rs6000_emit_epilogue): Same.
        (rs6000_output_mi_thunk): Re-implement as RTL.
        * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Call
        xcoffout_declare_function if any debugging enabled.

From-SVN: r61058
parent 66e2aa7d
2003-01-08 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.h (FUNCTION_MODE): Always use SImode.
* config/rs6000/rs6000.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): Redefine
as hook_bool_tree_hwi_hwi_tree_true.
(rs6000_emit_allocate_stack): Use TARGET_32BIT.
(rs6000_emit_epilogue): Same.
(rs6000_output_mi_thunk): Re-implement as RTL.
* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Call
xcoffout_declare_function if any debugging enabled.
2003-01-08 Chris Demetriou <cgd@broadcom.com> 2003-01-08 Chris Demetriou <cgd@broadcom.com>
* config.gcc (mipsisa32r2-*-elf*, mipsisa32r2el-*-elf*): New * config.gcc (mipsisa32r2-*-elf*, mipsisa32r2el-*-elf*): New
......
...@@ -388,12 +388,8 @@ static const char alt_reg_names[][8] = ...@@ -388,12 +388,8 @@ static const char alt_reg_names[][8] =
#undef TARGET_ASM_OUTPUT_MI_THUNK #undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk #define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk
/* ??? Should work everywhere, but ask dje@watson.ibm.com before
enabling for AIX. */
#if TARGET_OBJECT_FORMAT != OBJECT_XCOFF
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
#define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall #define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
#endif
#undef TARGET_FUNCTION_OK_FOR_SIBCALL #undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall #define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall
...@@ -9916,7 +9912,7 @@ rs6000_emit_allocate_stack (size, copy_r12) ...@@ -9916,7 +9912,7 @@ rs6000_emit_allocate_stack (size, copy_r12)
&& REGNO (stack_limit_rtx) > 1 && REGNO (stack_limit_rtx) > 1
&& REGNO (stack_limit_rtx) <= 31) && REGNO (stack_limit_rtx) <= 31)
{ {
emit_insn (Pmode == SImode emit_insn (TARGET_32BIT
? gen_addsi3 (tmp_reg, ? gen_addsi3 (tmp_reg,
stack_limit_rtx, stack_limit_rtx,
GEN_INT (size)) GEN_INT (size))
...@@ -9960,19 +9956,17 @@ rs6000_emit_allocate_stack (size, copy_r12) ...@@ -9960,19 +9956,17 @@ rs6000_emit_allocate_stack (size, copy_r12)
todec = tmp_reg; todec = tmp_reg;
} }
if (Pmode == SImode) insn = emit_insn (TARGET_32BIT
insn = emit_insn (gen_movsi_update (stack_reg, stack_reg, ? gen_movsi_update (stack_reg, stack_reg,
todec, stack_reg)); todec, stack_reg)
else : gen_movdi_update (stack_reg, stack_reg,
insn = emit_insn (gen_movdi_update (stack_reg, stack_reg,
todec, stack_reg)); todec, stack_reg));
} }
else else
{ {
if (Pmode == SImode) insn = emit_insn (TARGET_32BIT
insn = emit_insn (gen_addsi3 (stack_reg, stack_reg, todec)); ? gen_addsi3 (stack_reg, stack_reg, todec)
else : gen_adddi3 (stack_reg, stack_reg, todec));
insn = emit_insn (gen_adddi3 (stack_reg, stack_reg, todec));
emit_move_insn (gen_rtx_MEM (Pmode, stack_reg), emit_move_insn (gen_rtx_MEM (Pmode, stack_reg),
gen_rtx_REG (Pmode, 12)); gen_rtx_REG (Pmode, 12));
} }
...@@ -10970,7 +10964,7 @@ rs6000_emit_epilogue (sibcall) ...@@ -10970,7 +10964,7 @@ rs6000_emit_epilogue (sibcall)
} }
else if (sp_offset != 0) else if (sp_offset != 0)
{ {
emit_insn (Pmode == SImode emit_insn (TARGET_32BIT
? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
GEN_INT (sp_offset)) GEN_INT (sp_offset))
: gen_adddi3 (sp_reg_rtx, sp_reg_rtx, : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
...@@ -10981,7 +10975,7 @@ rs6000_emit_epilogue (sibcall) ...@@ -10981,7 +10975,7 @@ rs6000_emit_epilogue (sibcall)
if (current_function_calls_eh_return) if (current_function_calls_eh_return)
{ {
rtx sa = EH_RETURN_STACKADJ_RTX; rtx sa = EH_RETURN_STACKADJ_RTX;
emit_insn (Pmode == SImode emit_insn (TARGET_32BIT
? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, sa) ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, sa)
: gen_adddi3 (sp_reg_rtx, sp_reg_rtx, sa)); : gen_adddi3 (sp_reg_rtx, sp_reg_rtx, sa));
} }
...@@ -11344,159 +11338,99 @@ rs6000_output_mi_thunk (file, thunk_fndecl, delta, vcall_offset, function) ...@@ -11344,159 +11338,99 @@ rs6000_output_mi_thunk (file, thunk_fndecl, delta, vcall_offset, function)
FILE *file; FILE *file;
tree thunk_fndecl ATTRIBUTE_UNUSED; tree thunk_fndecl ATTRIBUTE_UNUSED;
HOST_WIDE_INT delta; HOST_WIDE_INT delta;
HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED; HOST_WIDE_INT vcall_offset;
tree function; tree function;
{ {
const char *this_reg = rtx this, insn, funexp;
reg_names[ aggregate_value_p (TREE_TYPE (TREE_TYPE (function))) ? 4 : 3 ];
const char *prefix;
const char *fname;
const char *r0 = reg_names[0];
const char *toc = reg_names[2];
const char *schain = reg_names[11];
const char *r12 = reg_names[12];
char buf[512];
static int labelno = 0;
/* Small constants that can be done by one add instruction. */ reload_completed = 1;
if (delta >= -32768 && delta <= 32767) no_new_pseudos = 1;
{
if (! TARGET_NEW_MNEMONICS)
fprintf (file, "\tcal %s,%d(%s)\n", this_reg, (int) delta, this_reg);
else
fprintf (file, "\taddi %s,%s,%d\n", this_reg, this_reg, (int) delta);
}
/* 64-bit constants. If "int" is 32 bits, we'll never hit this abort. */ /* Mark the end of the (empty) prologue. */
else if (TARGET_64BIT && (delta < -2147483647 - 1 || delta > 2147483647)) emit_note (NULL, NOTE_INSN_PROLOGUE_END);
abort ();
/* Large constants that can be done by one addis instruction. */
else if ((delta & 0xffff) == 0)
asm_fprintf (file, "\t{cau|addis} %s,%s,%d\n", this_reg, this_reg,
(int) (delta >> 16));
/* 32-bit constants that can be done by an add and addis instruction. */ /* Find the "this" pointer. If the function returns a structure,
the structure return pointer is in r3. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function))))
this = gen_rtx_REG (Pmode, 4);
else else
{ this = gen_rtx_REG (Pmode, 3);
/* Break into two pieces, propagating the sign bit from the low
word to the upper word. */
int delta_low = ((delta & 0xffff) ^ 0x8000) - 0x8000;
int delta_high = (delta - delta_low) >> 16;
asm_fprintf (file, "\t{cau|addis} %s,%s,%d\n", this_reg, this_reg, /* Apply the constant offset, if required. */
delta_high); if (delta)
{
if (! TARGET_NEW_MNEMONICS) rtx delta_rtx = GEN_INT (delta);
fprintf (file, "\tcal %s,%d(%s)\n", this_reg, delta_low, this_reg); emit_insn (TARGET_32BIT
else ? gen_addsi3 (this, this, delta_rtx)
fprintf (file, "\taddi %s,%s,%d\n", this_reg, this_reg, delta_low); : gen_adddi3 (this, this, delta_rtx));
} }
/* Get the prefix in front of the names. */ /* Apply the offset from the vtable, if required. */
switch (DEFAULT_ABI) if (vcall_offset)
{ {
default: rtx vcall_offset_rtx = GEN_INT (vcall_offset);
abort (); rtx tmp = gen_rtx_REG (Pmode, 12);
case ABI_AIX: emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
prefix = "."; emit_insn (TARGET_32BIT
break; ? gen_addsi3 (tmp, tmp, vcall_offset_rtx)
: gen_adddi3 (tmp, tmp, vcall_offset_rtx));
case ABI_V4: emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp));
case ABI_AIX_NODESC: emit_insn (TARGET_32BIT
case ABI_DARWIN: ? gen_addsi3 (this, this, tmp)
prefix = ""; : gen_adddi3 (this, this, tmp));
break;
} }
/* If the function is compiled in this module, jump to it directly. /* Generate a tail call to the target function. */
Otherwise, load up its address and jump to it. */ if (!TREE_USED (function))
{
fname = XSTR (XEXP (DECL_RTL (function), 0), 0); assemble_external (function);
TREE_USED (function) = 1;
}
funexp = XEXP (DECL_RTL (function), 0);
if (current_file_function_operand (XEXP (DECL_RTL (function), 0), VOIDmode) SYMBOL_REF_FLAG (funexp) = 0;
if (current_file_function_operand (funexp, VOIDmode)
&& (! lookup_attribute ("longcall", && (! lookup_attribute ("longcall",
TYPE_ATTRIBUTES (TREE_TYPE (function))) TYPE_ATTRIBUTES (TREE_TYPE (function)))
|| lookup_attribute ("shortcall", || lookup_attribute ("shortcall",
TYPE_ATTRIBUTES (TREE_TYPE (function))))) TYPE_ATTRIBUTES (TREE_TYPE (function)))))
{ SYMBOL_REF_FLAG (funexp) = 1;
fprintf (file, "\tb %s", prefix);
assemble_name (file, fname);
if (DEFAULT_ABI == ABI_V4 && flag_pic) fputs ("@local", file);
putc ('\n', file);
}
else
{
switch (DEFAULT_ABI)
{
default:
abort ();
case ABI_AIX:
/* Set up a TOC entry for the function. */
ASM_GENERATE_INTERNAL_LABEL (buf, "Lthunk", labelno);
toc_section ();
(*targetm.asm_out.internal_label) (file, "Lthunk", labelno);
labelno++;
if (TARGET_MINIMAL_TOC)
fputs (TARGET_32BIT ? "\t.long " : DOUBLE_INT_ASM_OP, file);
else
{
fputs ("\t.tc ", file);
assemble_name (file, fname);
fputs ("[TC],", file);
}
assemble_name (file, fname);
putc ('\n', file);
function_section (current_function_decl);
if (TARGET_MINIMAL_TOC)
asm_fprintf (file, (TARGET_32BIT)
? "\t{l|lwz} %s,%s(%s)\n" : "\tld %s,%s(%s)\n", r12,
TARGET_ELF ? ".LCTOC0@toc" : ".LCTOC..1", toc);
asm_fprintf (file, (TARGET_32BIT) ? "\t{l|lwz} %s," : "\tld %s,", r12);
assemble_name (file, buf);
if (TARGET_ELF && TARGET_MINIMAL_TOC)
fputs ("-(.LCTOC1)", file);
asm_fprintf (file, "(%s)\n", TARGET_MINIMAL_TOC ? r12 : toc);
asm_fprintf (file,
(TARGET_32BIT) ? "\t{l|lwz} %s,0(%s)\n" : "\tld %s,0(%s)\n",
r0, r12);
asm_fprintf (file,
(TARGET_32BIT) ? "\t{l|lwz} %s,4(%s)\n" : "\tld %s,8(%s)\n",
toc, r12);
asm_fprintf (file, "\tmtctr %s\n", r0);
asm_fprintf (file,
(TARGET_32BIT) ? "\t{l|lwz} %s,8(%s)\n" : "\tld %s,16(%s)\n",
schain, r12);
asm_fprintf (file, "\tbctr\n");
break;
case ABI_AIX_NODESC: funexp = gen_rtx_MEM (FUNCTION_MODE, funexp);
case ABI_V4:
fprintf (file, "\tb %s", prefix);
assemble_name (file, fname);
if (flag_pic) fputs ("@plt", file);
putc ('\n', file);
break;
#if TARGET_MACHO #if TARGET_MACHO
case ABI_DARWIN: if (flag_pic)
fprintf (file, "\tb %s", prefix); funexp = machopic_indirect_call_target (funexp);
if (flag_pic && !machopic_name_defined_p (fname))
assemble_name (file, machopic_stub_name (fname));
else
assemble_name (file, fname);
putc ('\n', file);
break;
#endif #endif
}
} /* gen_sibcall expects reload to convert scratch pseudo to LR so we must
generate sibcall RTL explicitly to avoid constraint abort. */
insn = emit_call_insn (
gen_rtx_PARALLEL (VOIDmode,
gen_rtvec (4,
gen_rtx_CALL (VOIDmode,
funexp, const0_rtx),
gen_rtx_USE (VOIDmode, const0_rtx),
gen_rtx_USE (VOIDmode,
gen_rtx_REG (SImode,
LINK_REGISTER_REGNUM)),
gen_rtx_RETURN (VOIDmode))));
SIBLING_CALL_P (insn) = 1;
emit_barrier ();
/* Run just enough of rest_of_compilation to get the insns emitted.
There's not really enough bulk here to make other passes such as
instruction scheduling worth while. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
insn = get_insns ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1, 0);
final_end_function ();
reload_completed = 0;
no_new_pseudos = 0;
} }
/* A quick summary of the various types of 'constant-pool tables' /* A quick summary of the various types of 'constant-pool tables'
......
...@@ -2274,7 +2274,7 @@ do { \ ...@@ -2274,7 +2274,7 @@ do { \
/* Mode of a function address in a call instruction (for indexing purposes). /* Mode of a function address in a call instruction (for indexing purposes).
Doesn't matter on RS/6000. */ Doesn't matter on RS/6000. */
#define FUNCTION_MODE (TARGET_32BIT ? SImode : DImode) #define FUNCTION_MODE SImode
/* Define this if addresses of constant functions /* Define this if addresses of constant functions
shouldn't be put through pseudo regs where they can be cse'd. shouldn't be put through pseudo regs where they can be cse'd.
......
...@@ -296,11 +296,7 @@ toc_section () \ ...@@ -296,11 +296,7 @@ toc_section () \
putc ('.', FILE); \ putc ('.', FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \ RS6000_OUTPUT_BASENAME (FILE, NAME); \
fputs (":\n", FILE); \ fputs (":\n", FILE); \
if (write_symbols == XCOFF_DEBUG \ if (write_symbols != NO_DEBUG) \
/* When called before targetm.asm_out.output_mi_thunk, \
we won't be emitting the rest of the debug info that \
goes along with this, leading to assembler errors. */ \
&& !(current_function_is_thunk && !no_new_pseudos)) \
xcoffout_declare_function (FILE, DECL, NAME); \ xcoffout_declare_function (FILE, DECL, NAME); \
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment