summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-07 11:18:32 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-07 11:18:32 +0000
commit717db2f5f33ade59217393f9169f49019962cdf1 (patch)
treecadeaae83c8f6e5a757c9f73fc245dc908c74d1b /gcc
parent1ba3670e13d1cbeb249759cf9795b9fea0af48d8 (diff)
downloadgcc-717db2f5f33ade59217393f9169f49019962cdf1.tar.gz
* i386-protos.h (x86_order_regs_for_local_alloc): Declare
* i386.c (x86_order_regs_for_local_alloc): New global function. * i386.h (REG_ALLOC_ORDER): CLeanup. (ORDER_REGS_FOR_LOCAL_ALLOC): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49574 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386-protos.h1
-rw-r--r--gcc/config/i386/i386.c44
-rw-r--r--gcc/config/i386/i386.h39
4 files changed, 63 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29ef508326e..59d48ac4936 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+Thu Feb 7 12:14:17 CET 2002 Jan Hubicka <jh@suse.cz>
+
+ * i386-protos.h (x86_order_regs_for_local_alloc): Declare
+ * i386.c (x86_order_regs_for_local_alloc): New global function.
+ * i386.h (REG_ALLOC_ORDER): CLeanup.
+ (ORDER_REGS_FOR_LOCAL_ALLOC): New.
+
2002-02-07 Richard Henderson <rth@redhat.com>
* alias.c (find_base_value): Recall base values for fixed hard regs.
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 01c4d447054..8321d478ec0 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -169,6 +169,7 @@ extern int ix86_memory_move_cost PARAMS ((enum machine_mode, enum reg_class,
extern void ix86_set_move_mem_attrs PARAMS ((rtx, rtx, rtx, rtx, rtx));
extern void emit_i387_cw_initialization PARAMS ((rtx, rtx));
extern bool ix86_fp_jump_nontrivial_p PARAMS ((enum rtx_code));
+extern void x86_order_regs_for_local_alloc PARAMS ((void));
#ifdef TREE_CODE
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7eedba3ac70..159ac165ac7 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12312,3 +12312,47 @@ ix86_svr3_asm_out_constructor (symbol, priority)
fputc ('\n', asm_out_file);
}
#endif
+
+/* Order the registers for register allocator. */
+
+void
+x86_order_regs_for_local_alloc ()
+{
+ int pos = 0;
+ int i;
+
+ /* First allocate the local general purpose registers. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (GENERAL_REGNO_P (i) && call_used_regs[i])
+ reg_alloc_order [pos++] = i;
+
+ /* Global general purpose registers. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (GENERAL_REGNO_P (i) && !call_used_regs[i])
+ reg_alloc_order [pos++] = i;
+
+ /* x87 registers come first in case we are doing FP math
+ using them. */
+ if (!TARGET_SSE_MATH)
+ for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
+ reg_alloc_order [pos++] = i;
+
+ /* SSE registers. */
+ for (i = FIRST_SSE_REG; i <= LAST_SSE_REG; i++)
+ reg_alloc_order [pos++] = i;
+ for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++)
+ reg_alloc_order [pos++] = i;
+
+ /* x87 registerts. */
+ if (TARGET_SSE_MATH)
+ for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
+ reg_alloc_order [pos++] = i;
+
+ for (i = FIRST_MMX_REG; i <= LAST_MMX_REG; i++)
+ reg_alloc_order [pos++] = i;
+
+ /* Initialize the rest of array as we do not allocate some registers
+ at all. */
+ while (pos < FIRST_PSEUDO_REGISTER)
+ reg_alloc_order [pos++] = 0;
+}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 01510473c98..e5a04ec9347 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -926,38 +926,21 @@ extern int ix86_arch;
registers listed in CALL_USED_REGISTERS, keeping the others
available for storage of persistent values.
- Three different versions of REG_ALLOC_ORDER have been tried:
+ The ORDER_REGS_FOR_LOCAL_ALLOC actually overwrite the order,
+ so this is just empty initializer for array. */
- If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
- but slower code on simple functions returning values in eax.
+#define REG_ALLOC_ORDER \
+{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, \
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
+ 48, 49, 50, 51, 52 }
- If the order is eax, ecx, edx, ... it causes reload to abort when compiling
- perl 4.036 due to not being able to create a DImode register (to hold a 2
- word union).
+/* ORDER_REGS_FOR_LOCAL_ALLOC is a macro which permits reg_alloc_order
+ to be rearranged based on a particular function. When using sse math,
+ we want to allocase SSE before x87 registers and vice vera. */
- If the order is eax, edx, ecx, ... it produces better code for simple
- functions, and a slightly slower compiler. Users complained about the code
- generated by allocating edx first, so restore the 'natural' order of things. */
+#define ORDER_REGS_FOR_LOCAL_ALLOC x86_order_regs_for_local_alloc ()
-#define REG_ALLOC_ORDER \
-/*ax,dx,cx,*/ \
-{ 0, 1, 2, \
-/* bx,si,di,bp,sp,*/ \
- 3, 4, 5, 6, 7, \
-/*r8,r9,r10,r11,*/ \
- 37,38, 39, 40, \
-/*r12,r15,r14,r13*/ \
- 41, 44, 43, 42, \
-/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \
- 21, 22, 23, 24, 25, 26, 27, 28, \
-/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
- 45, 46, 47, 48, 49, 50, 51, 52, \
-/*st,st1,st2,st3,st4,st5,st6,st7*/ \
- 8, 9, 10, 11, 12, 13, 14, 15, \
-/*,arg,cc,fpsr,dir,frame*/ \
- 16,17, 18, 19, 20, \
-/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \
- 29, 30, 31, 32, 33, 34, 35, 36 }
/* Macro to conditionally modify fixed_regs/call_used_regs. */
#define CONDITIONAL_REGISTER_USAGE \