Commit 22fb740d by Jan Hubicka Committed by Jan Hubicka

toplev.c (rest_of_compilation): Fix register_life_up_to_date handling...

	* toplev.c (rest_of_compilation): Fix register_life_up_to_date
	handling; move unconditional splitting before mode switching.

	* i386.md (type): Add fistp type.
	(i387, length_attr, scheduling definitions): Handle this type.
	(fix_trunc?f?i2): Revamp to use mode switching.
	(fix_trunct?f?i_nonmemory, fix_trunc?f?i_memory): New patterns.
	* i386.h (fp_cw_mode): New enum
	(OPTIMIZE_MODE_SWITCHING, NUM_MODES_FOR_MODE_SWITCHING, MODE_NEEDED,
	MODE_PRIORITY_TO_MODE, ENUM_MODE_SET): New macros.

From-SVN: r44027
parent 135d50f1
Sun Jul 15 14:07:36 CEST 2001 Jan Hubicka <jh@suse.cz>
* toplev.c (rest_of_compilation): Fix register_life_up_to_date
handling; move unconditional splitting before mode switching.
* i386.md (type): Add fistp type.
(i387, length_attr, scheduling definitions): Handle this type.
(fix_trunc?f?i2): Revamp to use mode switching.
(fix_trunct?f?i_nonmemory, fix_trunc?f?i_memory): New patterns.
* i386.h (fp_cw_mode): New enum
(OPTIMIZE_MODE_SWITCHING, NUM_MODES_FOR_MODE_SWITCHING, MODE_NEEDED,
MODE_PRIORITY_TO_MODE, ENUM_MODE_SET): New macros.
Sun Jul 15 12:53:51 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* Makefile.in (integrate.o): Add debug.h.
......
......@@ -3118,6 +3118,69 @@ extern enum reg_class const regclass_map[]; /* smalled class containing REGNO */
extern struct rtx_def *ix86_compare_op0; /* operand 0 for comparisons */
extern struct rtx_def *ix86_compare_op1; /* operand 1 for comparisons */
/* To properly truncate FP values into integers, we need to set i387 control
word. We can't emit proper mode switching code before reload, as spills
generated by reload may truncate values incorrectly, but we still can avoid
redundant computation of new control word by the mode switching pass.
The fldcw instructions are still emitted redundantly, but this is probably
not going to be noticeable problem, as most CPUs do have fast path for
the sequence.
The machinery is to emit simple truncation instructions and split them
before reload to instructions having USEs of two memory locations that
are filled by this code to old and new control word.
Post-reload pass may be later used to eliminate the redundant fildcw if
needed. */
enum fp_cw_mode {FP_CW_STORED, FP_CW_UNINITIALIZED, FP_CW_ANY};
/* Define this macro if the port needs extra instructions inserted
for mode switching in an optimizing compilation. */
#define OPTIMIZE_MODE_SWITCHING(ENTITY) 1
/* If you define `OPTIMIZE_MODE_SWITCHING', you have to define this as
initializer for an array of integers. Each initializer element N
refers to an entity that needs mode switching, and specifies the
number of different modes that might need to be set for this
entity. The position of the initializer in the initializer -
starting counting at zero - determines the integer that is used to
refer to the mode-switched entity in question. */
#define NUM_MODES_FOR_MODE_SWITCHING { FP_CW_ANY }
/* ENTITY is an integer specifying a mode-switched entity. If
`OPTIMIZE_MODE_SWITCHING' is defined, you must define this macro to
return an integer value not larger than the corresponding element
in `NUM_MODES_FOR_MODE_SWITCHING', to denote the mode that ENTITY
must be switched into prior to the execution of INSN. */
#define MODE_NEEDED(ENTITY, I) \
(GET_CODE (I) == CALL_INSN \
|| (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 \
|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
? FP_CW_UNINITIALIZED \
: recog_memoized (I) < 0 || get_attr_type (I) != TYPE_FISTP \
? FP_CW_ANY \
: FP_CW_STORED)
/* This macro specifies the order in which modes for ENTITY are
processed. 0 is the highest priority. */
#define MODE_PRIORITY_TO_MODE(ENTITY, N) N
/* Generate one or more insns to set ENTITY to MODE. HARD_REG_LIVE
is the set of hard registers live at the point where the insn(s)
are to be inserted. */
#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \
(MODE == FP_CW_STORED \
? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1), \
assign_386_stack_local (HImode, 2)), 0\
: 0)
/*
Local variables:
version-control: t
......
......@@ -3327,7 +3327,6 @@ rest_of_compilation (decl)
life_analysis (insns, rtl_dump_file, PROP_FINAL);
timevar_pop (TV_FLOW);
register_life_up_to_date = 1;
no_new_pseudos = 1;
if (warn_uninitialized || extra_warnings)
......@@ -3415,15 +3414,18 @@ rest_of_compilation (decl)
ggc_collect ();
}
/* Do unconditional splitting before register allocation to allow machine
description to add extra information not needed previously. */
split_all_insns (1);
/* Any of the several passes since flow1 will have munged register
lifetime data a bit. */
if (optimize > 0)
register_life_up_to_date = 0;
#ifdef OPTIMIZE_MODE_SWITCHING
timevar_push (TV_GCSE);
no_new_pseudos = 1;
no_new_pseudos = 0;
if (optimize_mode_switching (NULL))
{
/* We did work, and so had to regenerate global life information.
......@@ -3431,15 +3433,13 @@ rest_of_compilation (decl)
information below. */
register_life_up_to_date = 1;
}
no_new_pseudos = 0;
no_new_pseudos = 1;
timevar_pop (TV_GCSE);
#endif
timevar_push (TV_SCHED);
split_all_insns (1);
#ifdef INSN_SCHEDULING
/* Print function header into sched dump now
......
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