S/390: Simplify handling of out-of-pool execute templates
Ulrich Weigand
uweigand@de.ibm.com
Fri Jun 3 13:42:00 GMT 2005
Hello,
this patch reorganizes the way out-of-pool execute templates (on zSeries)
are handles. They are now no longer mixed into the general literal pool
handling code, but are simply emitted directly in s390_reorg.
Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux,
committed to mainline.
Bye,
Ulrich
ChangeLog:
* config/s390/s390.c (s390_add_execute): Do not handle out-of-pool
execute templates.
(s390_dump_pool): Likewise.
(s390_mainpool_start, s390_mainpool_finish): Likewise.
(s390_chunkify_start): Likewise.
(s390_dump_execute): Remove.
(s390_reorg): Handle out-of-pool execute templates.
Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.233
diff -c -p -r1.233 s390.c
*** gcc/config/s390/s390.c 26 May 2005 05:27:57 -0000 1.233
--- gcc/config/s390/s390.c 1 Jun 2005 19:47:48 -0000
*************** s390_add_execute (struct constant_pool *
*** 4672,4686 ****
if (c == NULL)
{
- rtx label = s390_execute_label (insn);
- gcc_assert (label);
-
c = (struct constant *) xmalloc (sizeof *c);
c->value = insn;
! c->label = label == const0_rtx ? gen_label_rtx () : XEXP (label, 0);
c->next = pool->execute;
pool->execute = c;
! pool->size += label == const0_rtx ? 6 : 0;
}
}
--- 4672,4683 ----
if (c == NULL)
{
c = (struct constant *) xmalloc (sizeof *c);
c->value = insn;
! c->label = gen_label_rtx ();
c->next = pool->execute;
pool->execute = c;
! pool->size += 6;
}
}
*************** s390_execute_target (rtx insn)
*** 4732,4759 ****
return pattern;
}
- /* Dump out the out-of-pool execute template insns in POOL
- at the end of the instruction stream. */
-
- static void
- s390_dump_execute (struct constant_pool *pool)
- {
- struct constant *c;
- rtx insn;
-
- for (c = pool->execute; c; c = c->next)
- {
- if (s390_execute_label (c->value) == const0_rtx)
- continue;
-
- insn = emit_label (c->label);
- INSN_ADDRESSES_NEW (insn, -1);
-
- insn = emit_insn (s390_execute_target (c->value));
- INSN_ADDRESSES_NEW (insn, -1);
- }
- }
-
/* Indicate that INSN cannot be duplicated. This is the case for
execute insns that carry a unique label. */
--- 4729,4734 ----
*************** s390_dump_pool (struct constant_pool *po
*** 4829,4837 ****
/* Output in-pool execute template insns. */
for (c = pool->execute; c; c = c->next)
{
- if (s390_execute_label (c->value) != const0_rtx)
- continue;
-
insn = emit_label_after (c->label, insn);
INSN_ADDRESSES_NEW (insn, -1);
--- 4804,4809 ----
*************** s390_dump_pool (struct constant_pool *po
*** 4851,4859 ****
/* Remove placeholder insn. */
remove_insn (pool->pool_insn);
-
- /* Output out-of-pool execute template isns. */
- s390_dump_execute (pool);
}
/* Free all memory used by POOL. */
--- 4823,4828 ----
*************** s390_mainpool_start (void)
*** 4903,4909 ****
pool->pool_insn = insn;
}
! if (s390_execute_label (insn))
{
s390_add_execute (pool, insn);
}
--- 4872,4878 ----
pool->pool_insn = insn;
}
! if (!TARGET_CPU_ZARCH && s390_execute_label (insn))
{
s390_add_execute (pool, insn);
}
*************** s390_mainpool_finish (struct constant_po
*** 4948,4956 ****
/* If the pool is empty, we're done. */
if (pool->size == 0)
{
- /* However, we may have out-of-pool execute templates. */
- s390_dump_execute (pool);
-
/* We don't actually need a base register after all. */
cfun->machine->base_reg = NULL_RTX;
--- 4917,4922 ----
*************** s390_chunkify_start (void)
*** 5103,5109 ****
}
}
! if (s390_execute_label (insn))
{
if (!curr_pool)
curr_pool = s390_start_pool (&pool_list, insn);
--- 5069,5075 ----
}
}
! if (!TARGET_CPU_ZARCH && s390_execute_label (insn))
{
if (!curr_pool)
curr_pool = s390_start_pool (&pool_list, insn);
*************** s390_reorg (void)
*** 8188,8193 ****
--- 8154,8181 ----
break;
}
+ /* Generate out-of-pool execute target insns. */
+ if (TARGET_CPU_ZARCH)
+ {
+ rtx insn, label, target;
+
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ {
+ label = s390_execute_label (insn);
+ if (!label)
+ continue;
+
+ gcc_assert (label != const0_rtx);
+
+ target = emit_label (XEXP (label, 0));
+ INSN_ADDRESSES_NEW (target, -1);
+
+ target = emit_insn (s390_execute_target (insn));
+ INSN_ADDRESSES_NEW (target, -1);
+ }
+ }
+
+ /* Try to optimize prologue and epilogue further. */
s390_optimize_prologue ();
}
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com
More information about the Gcc-patches
mailing list