Commit a05924f9 by Jan Hubicka Committed by Richard Henderson

Reorg reg-stack to use the standard CFG.

Co-Authored-By: Richard Henderson <rth@cygnus.com>

From-SVN: r30201
parent b517dcd2
Tue Oct 26 18:23:38 1999 Jan Hubicka <hubicka@freesoft.cz>
Richard Henderson <rth@cygnus.com>
* emit-rtl.c (emit_block_insn_before): New.
(emit_block_insn_after): New.
* basic-block.h: Declare them.
* bitmap.h: Protect from multiple inclusion.
* recog.c (scratch_operand): Handle VOIDmode correctly.
* rtl.h (JUMP_CROSS_JUMP_DEATH_MATTERS): New.
* builtins.c (expand_builtin_apply_args_1): Remove STACK_REGS hack.
* function.c (assign_parms): Likewise.
* global.c (global_conflicts): Clarify STACK_REGS commentary.
* reg-stack.c (max_uid): Remove.
(blocks, block_begin, block_end, block_drops_in): Remove.
(block_stack_in, block_out_reg_set, block_number): Remove.
(struct block_info_def, BLOCK_INFO): New.
(enum emit_where): New.
(current_block): New.
(BLOCK_NUM): Remove.
(mark_regs_pat, record_label_references): Remove.
(record_reg_life_pat, record_reg_life, find_blocks): Remove.
(nan): New.
(goto_block_pat, print_blocks, dump_stack_info): Remove.
(reg_to_stack): Simplified test for existance of fp code. Use
flow.c code. Call shorten_branches after cross-jump opt.
(check_asm_stack_operands): Renamed from record_asm_reg_life.
Return false if the asm doesn't use stack regs. Don't do life
analysis on the asm.
(emit_pop_insn): Replace function pointer arg `when' with
enum `where'. Update all callers.
(change_stack): Likewise. Update basic block end.
(emit_swap_insn): Use current_block->head to limit reverse search
for start of block. Use emit_block_insn_after.
(subst_stack_regs_pat): Handle USE and CLOBBER patterns.
(subst_asm_stack_regs): Use check_asm_stack_operands. Use direct
structure assignment instead of bcopy.
(print_stack): New.
(convert_regs_entry, convert_regs_exit): New.
(convert_regs_1, convert_regs_2): Split out from convert_regs.
Work on basic blocks and the CFG.
(convert_regs): Use them.
* i386.c (output_fix_trunc): Remove code for DImode input operand
not at top-of-stack.
* i386.c (fix_truncdfdi2, fix_truncsfdi2): Use scratch with
appropriate mode.
(fix_truncdi_1): Allow any mode scratch.
Tue Oct 26 13:30:35 1999 Richard Henderson <rth@cygnus.com> Tue Oct 26 13:30:35 1999 Richard Henderson <rth@cygnus.com>
* alpha.h (TARGET_MEM_FUNCTIONS): Define here. * alpha.h (TARGET_MEM_FUNCTIONS): Define here.
......
...@@ -333,3 +333,7 @@ extern struct edge_list *pre_edge_rev_lcm PROTO ((FILE *, int, sbitmap *, ...@@ -333,3 +333,7 @@ extern struct edge_list *pre_edge_rev_lcm PROTO ((FILE *, int, sbitmap *,
sbitmap **)); sbitmap **));
extern int compute_available PROTO ((sbitmap *, sbitmap *, extern int compute_available PROTO ((sbitmap *, sbitmap *,
sbitmap *, sbitmap *)); sbitmap *, sbitmap *));
/* In emit-rtl.c. */
extern rtx emit_block_insn_after PROTO((rtx, rtx, basic_block));
extern rtx emit_block_insn_before PROTO((rtx, rtx, basic_block));
...@@ -18,6 +18,9 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -18,6 +18,9 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _BITMAP_H
#define _BITMAP_H 1
/* Number of words to use for each element in the linked list. */ /* Number of words to use for each element in the linked list. */
#ifndef BITMAP_ELEMENT_WORDS #ifndef BITMAP_ELEMENT_WORDS
...@@ -319,3 +322,5 @@ do { \ ...@@ -319,3 +322,5 @@ do { \
word_num_ = 0; \ word_num_ = 0; \
} \ } \
} while (0) } while (0)
#endif /* _BITMAP_H */
...@@ -762,13 +762,6 @@ expand_builtin_apply_args_1 () ...@@ -762,13 +762,6 @@ expand_builtin_apply_args_1 ()
tem = gen_rtx_REG (mode, INCOMING_REGNO (regno)); tem = gen_rtx_REG (mode, INCOMING_REGNO (regno));
#ifdef STACK_REGS
/* For reg-stack.c's stack register household.
Compare with a similar piece of code in function.c. */
emit_insn (gen_rtx_USE (mode, tem));
#endif
emit_move_insn (change_address (registers, mode, emit_move_insn (change_address (registers, mode,
plus_constant (XEXP (registers, 0), plus_constant (XEXP (registers, 0),
size)), size)),
......
...@@ -3163,25 +3163,8 @@ output_fix_trunc (insn, operands) ...@@ -3163,25 +3163,8 @@ output_fix_trunc (insn, operands)
/* Jump through a hoop or two for DImode, since the hardware has no /* Jump through a hoop or two for DImode, since the hardware has no
non-popping instruction. We used to do this a different way, but non-popping instruction. We used to do this a different way, but
that was somewhat fragile and broke with post-reload splitters. */ that was somewhat fragile and broke with post-reload splitters. */
if (dimode_p) if (dimode_p && !stack_top_dies)
{ output_asm_insn ("fld\t%y1", operands);
if (! STACK_TOP_P (operands[1]))
{
rtx tmp;
output_asm_insn ("fst\t%y1", operands);
/* The scratch we allocated sure better have died. */
if (! stack_top_dies)
abort ();
tmp = operands[1];
operands[1] = operands[5];
operands[5] = tmp;
}
else if (! stack_top_dies)
output_asm_insn ("fld\t%y1", operands);
}
if (! STACK_TOP_P (operands[1])) if (! STACK_TOP_P (operands[1]))
abort (); abort ();
......
...@@ -2724,7 +2724,7 @@ ...@@ -2724,7 +2724,7 @@
(clobber (match_dup 2)) (clobber (match_dup 2))
(clobber (match_dup 3)) (clobber (match_dup 3))
(clobber (match_scratch:SI 4 "")) (clobber (match_scratch:SI 4 ""))
(clobber (match_scratch:XF 5 ""))])] (clobber (match_scratch:DF 5 ""))])]
"TARGET_80387" "TARGET_80387"
"operands[2] = assign_386_stack_local (SImode, 0); "operands[2] = assign_386_stack_local (SImode, 0);
operands[3] = assign_386_stack_local (DImode, 1);") operands[3] = assign_386_stack_local (DImode, 1);")
...@@ -2735,7 +2735,7 @@ ...@@ -2735,7 +2735,7 @@
(clobber (match_dup 2)) (clobber (match_dup 2))
(clobber (match_dup 3)) (clobber (match_dup 3))
(clobber (match_scratch:SI 4 "")) (clobber (match_scratch:SI 4 ""))
(clobber (match_scratch:XF 5 ""))])] (clobber (match_scratch:SF 5 ""))])]
"TARGET_80387" "TARGET_80387"
"operands[2] = assign_386_stack_local (SImode, 0); "operands[2] = assign_386_stack_local (SImode, 0);
operands[3] = assign_386_stack_local (DImode, 1);") operands[3] = assign_386_stack_local (DImode, 1);")
...@@ -2745,8 +2745,8 @@ ...@@ -2745,8 +2745,8 @@
(fix:DI (match_operand 1 "register_operand" "f,f"))) (fix:DI (match_operand 1 "register_operand" "f,f")))
(clobber (match_operand:SI 2 "memory_operand" "=o,o")) (clobber (match_operand:SI 2 "memory_operand" "=o,o"))
(clobber (match_operand:DI 3 "memory_operand" "=m,m")) (clobber (match_operand:DI 3 "memory_operand" "=m,m"))
(clobber (match_scratch:SI 4 "=&r,=&r")) (clobber (match_scratch:SI 4 "=&r,&r"))
(clobber (match_scratch:XF 5 "=f,f"))] (clobber (match_scratch 5 "=&f,&f"))]
"TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))" "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))"
"* return output_fix_trunc (insn, operands);" "* return output_fix_trunc (insn, operands);"
[(set_attr "type" "multi")]) [(set_attr "type" "multi")])
...@@ -2757,7 +2757,7 @@ ...@@ -2757,7 +2757,7 @@
(clobber (match_operand:SI 2 "memory_operand" "")) (clobber (match_operand:SI 2 "memory_operand" ""))
(clobber (match_operand:DI 3 "memory_operand" "")) (clobber (match_operand:DI 3 "memory_operand" ""))
(clobber (match_scratch:SI 4 "")) (clobber (match_scratch:SI 4 ""))
(clobber (match_scratch:XF 5 ""))] (clobber (match_scratch 5 ""))]
"reload_completed && !reg_overlap_mentioned_p (operands[4], operands[3])" "reload_completed && !reg_overlap_mentioned_p (operands[4], operands[3])"
[(parallel [(set (match_dup 3) (fix:DI (match_dup 1))) [(parallel [(set (match_dup 3) (fix:DI (match_dup 1)))
(clobber (match_dup 2)) (clobber (match_dup 2))
......
...@@ -50,6 +50,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -50,6 +50,7 @@ Boston, MA 02111-1307, USA. */
#include "real.h" #include "real.h"
#include "obstack.h" #include "obstack.h"
#include "bitmap.h" #include "bitmap.h"
#include "basic-block.h"
#include "ggc.h" #include "ggc.h"
/* Commonly used modes. */ /* Commonly used modes. */
...@@ -2600,6 +2601,20 @@ emit_insn_before (pattern, before) ...@@ -2600,6 +2601,20 @@ emit_insn_before (pattern, before)
return insn; return insn;
} }
/* Similar to emit_insn_before, but update basic block boundaries as well. */
rtx
emit_block_insn_before (pattern, before, block)
rtx pattern, before;
basic_block block;
{
rtx prev = PREV_INSN (before);
rtx r = emit_insn_before (pattern, before);
if (block && block->head == before)
block->head = NEXT_INSN (prev);
return r;
}
/* Make an instruction with body PATTERN and code JUMP_INSN /* Make an instruction with body PATTERN and code JUMP_INSN
and output it before the instruction BEFORE. */ and output it before the instruction BEFORE. */
...@@ -2742,6 +2757,19 @@ emit_insn_after_with_line_notes (pattern, after, from) ...@@ -2742,6 +2757,19 @@ emit_insn_after_with_line_notes (pattern, after, from)
insn); insn);
} }
/* Similar to emit_insn_after, but update basic block boundaries as well. */
rtx
emit_block_insn_after (pattern, after, block)
rtx pattern, after;
basic_block block;
{
rtx r = emit_insn_after (pattern, after);
if (block && block->end == after)
block->end = r;
return r;
}
/* Make an insn of code JUMP_INSN with body PATTERN /* Make an insn of code JUMP_INSN with body PATTERN
and output it after the insn AFTER. */ and output it after the insn AFTER. */
......
...@@ -4323,17 +4323,6 @@ assign_parms (fndecl) ...@@ -4323,17 +4323,6 @@ assign_parms (fndecl)
} }
#endif /* 0 */ #endif /* 0 */
#ifdef STACK_REGS
/* We need this "use" info, because the gcc-register->stack-register
converter in reg-stack.c needs to know which registers are active
at the start of the function call. The actual parameter loading
instructions are not always available then anymore, since they might
have been optimised away. */
if (GET_CODE (entry_parm) == REG && !(hide_last_arg && last_named))
emit_insn (gen_rtx_USE (GET_MODE (entry_parm), entry_parm));
#endif
/* ENTRY_PARM is an RTX for the parameter as it arrives, /* ENTRY_PARM is an RTX for the parameter as it arrives,
in the mode in which it arrives. in the mode in which it arrives.
STACK_PARM is an RTX for a stack slot where the parameter can live STACK_PARM is an RTX for a stack slot where the parameter can live
......
...@@ -673,16 +673,12 @@ global_conflicts () ...@@ -673,16 +673,12 @@ global_conflicts ()
#ifdef STACK_REGS #ifdef STACK_REGS
{ {
/* Pseudos can't go in stack regs at the start of a basic block /* Pseudos can't go in stack regs at the start of a basic block
that can be reached through a computed goto, since reg-stack that is reached by an abnormal edge. */
can't handle computed gotos. */
/* ??? Seems more likely that reg-stack can't handle any abnormal
edges, critical or not, computed goto or otherwise. */
edge e; edge e;
for (e = BASIC_BLOCK (b)->pred; e ; e = e->pred_next) for (e = BASIC_BLOCK (b)->pred; e ; e = e->pred_next)
if (e->flags & EDGE_ABNORMAL) if (e->flags & EDGE_ABNORMAL)
break; break;
if (e != NULL) if (e != NULL)
for (ax = FIRST_STACK_REG; ax <= LAST_STACK_REG; ax++) for (ax = FIRST_STACK_REG; ax <= LAST_STACK_REG; ax++)
record_one_conflict (ax); record_one_conflict (ax);
......
...@@ -1045,10 +1045,12 @@ scratch_operand (op, mode) ...@@ -1045,10 +1045,12 @@ scratch_operand (op, mode)
register rtx op; register rtx op;
enum machine_mode mode; enum machine_mode mode;
{ {
return (GET_MODE (op) == mode if (GET_MODE (op) != mode && mode != VOIDmode)
&& (GET_CODE (op) == SCRATCH return 0;
|| (GET_CODE (op) == REG
&& REGNO (op) < FIRST_PSEUDO_REGISTER))); return (GET_CODE (op) == SCRATCH
|| (GET_CODE (op) == REG
&& REGNO (op) < FIRST_PSEUDO_REGISTER));
} }
/* Return 1 if OP is a valid immediate operand for mode MODE. /* Return 1 if OP is a valid immediate operand for mode MODE.
......
...@@ -1410,9 +1410,10 @@ extern int condjump_in_parallel_p PROTO ((rtx)); ...@@ -1410,9 +1410,10 @@ extern int condjump_in_parallel_p PROTO ((rtx));
extern void never_reached_warning PROTO ((rtx)); extern void never_reached_warning PROTO ((rtx));
/* Flags for jump_optimize() */ /* Flags for jump_optimize() */
#define JUMP_CROSS_JUMP 1 #define JUMP_CROSS_JUMP 1
#define JUMP_NOOP_MOVES 1 #define JUMP_CROSS_JUMP_DEATH_MATTERS 2
#define JUMP_AFTER_REGSCAN 1 #define JUMP_NOOP_MOVES 1
#define JUMP_AFTER_REGSCAN 1
/* In emit-rtl.c. */ /* In emit-rtl.c. */
extern int max_reg_num PROTO ((void)); extern int max_reg_num PROTO ((void));
......
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