summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/optabs.c62
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gnat.dg/assert.ads5
-rw-r--r--gcc/testsuite/gnat.dg/controlled_record.adb15
-rw-r--r--gcc/testsuite/gnat.dg/controlled_record.ads16
6 files changed, 83 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a16b05640f7..28c4534b708 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * optabs.c (maybe_encapsulate_block): New function extracted from...
+ (emit_libcall_block): ...here. Invoke it on the block of insns to
+ maybe emit REG_LIBCALL/REG_RETVAL notes around the block.
+ (emit_no_conflict_block): Likewise.
+
2006-07-16 Eric Botcazou <ebotcazou@libertysurf.fr>
* doc/install.texi (sparc-sun-solaris2*): Add GMP version number.
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 5b50f9dceed..a961bd49b53 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3218,6 +3218,38 @@ no_conflict_move_test (rtx dest, rtx set, void *p0)
p->must_stay = true;
}
+/* Encapsulate the block starting at FIRST and ending with LAST, which is
+ logically equivalent to EQUIV, so it gets manipulated as a unit if it
+ is possible to do so. */
+
+static void
+maybe_encapsulate_block (rtx first, rtx last, rtx equiv)
+{
+ if (!flag_non_call_exceptions || !may_trap_p (equiv))
+ {
+ /* We can't attach the REG_LIBCALL and REG_RETVAL notes when the
+ encapsulated region would not be in one basic block, i.e. when
+ there is a control_flow_insn_p insn between FIRST and LAST. */
+ bool attach_libcall_retval_notes = true;
+ rtx insn, next = NEXT_INSN (last);
+
+ for (insn = first; insn != next; insn = NEXT_INSN (insn))
+ if (control_flow_insn_p (insn))
+ {
+ attach_libcall_retval_notes = false;
+ break;
+ }
+
+ if (attach_libcall_retval_notes)
+ {
+ REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
+ REG_NOTES (first));
+ REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first,
+ REG_NOTES (last));
+ }
+ }
+}
+
/* Emit code to perform a series of operations on a multi-word quantity, one
word at a time.
@@ -3339,10 +3371,7 @@ emit_no_conflict_block (rtx insns, rtx target, rtx op0, rtx op1, rtx equiv)
else
first = NEXT_INSN (prev);
- /* Encapsulate the block so it gets manipulated as a unit. */
- REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
- REG_NOTES (first));
- REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, REG_NOTES (last));
+ maybe_encapsulate_block (first, last, equiv);
return last;
}
@@ -3496,30 +3525,7 @@ emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
else
first = NEXT_INSN (prev);
- /* Encapsulate the block so it gets manipulated as a unit. */
- if (!flag_non_call_exceptions || !may_trap_p (equiv))
- {
- /* We can't attach the REG_LIBCALL and REG_RETVAL notes
- when the encapsulated region would not be in one basic block,
- i.e. when there is a control_flow_insn_p insn between FIRST and LAST.
- */
- bool attach_libcall_retval_notes = true;
- next = NEXT_INSN (last);
- for (insn = first; insn != next; insn = NEXT_INSN (insn))
- if (control_flow_insn_p (insn))
- {
- attach_libcall_retval_notes = false;
- break;
- }
-
- if (attach_libcall_retval_notes)
- {
- REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
- REG_NOTES (first));
- REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first,
- REG_NOTES (last));
- }
- }
+ maybe_encapsulate_block (first, last, equiv);
}
/* Nonzero if we can perform a comparison of mode MODE straightforwardly.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 92606e25ba2..9e7e540c9fa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-16 Olivier Hainque <hainque@adacore.com>
+
+ * gnat.dg/assert.ads: New file.
+ * gnat.dg/controlled_record.ads: Likewise.
+ * gnat.dg/controlled_record.adb: Likewise.
+
2006-07-15 Lee Millward <lee.millward@gmail.com>
PR c++/28292
diff --git a/gcc/testsuite/gnat.dg/assert.ads b/gcc/testsuite/gnat.dg/assert.ads
new file mode 100644
index 00000000000..81a912a8ad2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/assert.ads
@@ -0,0 +1,5 @@
+package Assert is
+
+ procedure Assert (Condition : Boolean);
+
+end Assert;
diff --git a/gcc/testsuite/gnat.dg/controlled_record.adb b/gcc/testsuite/gnat.dg/controlled_record.adb
new file mode 100644
index 00000000000..89a9380b9d2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/controlled_record.adb
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-O2" }
+
+with Ada.Text_IO; use Ada.Text_IO;
+with Assert;
+
+package body Controlled_Record is
+
+ procedure Assert_Invariants (PA : Point_T) is
+ PB : Point_T;
+ begin
+ Assert.Assert (PB.Pos = PA.Pos);
+ end;
+
+end Controlled_Record;
diff --git a/gcc/testsuite/gnat.dg/controlled_record.ads b/gcc/testsuite/gnat.dg/controlled_record.ads
new file mode 100644
index 00000000000..71a57372c96
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/controlled_record.ads
@@ -0,0 +1,16 @@
+with Ada.Finalization;
+
+package Controlled_Record is
+
+ type Point_T is limited private;
+ procedure Assert_Invariants (PA : Point_T);
+
+private
+
+ type Coords_T is array (1 .. 2) of Natural;
+
+ type Point_T is new Ada.Finalization.Controlled with record
+ Pos : Coords_T := (0, 0);
+ end record;
+
+end Controlled_Record;