OSDN Git Service

* toplev.c (rest_of_compilation): Fix register_life_up_to_date
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / i386.h
index 5869602..408ea2b 100644 (file)
@@ -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 */
 \f
+/* 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)
+
+\f
 /*
 Local variables:
 version-control: t