summaryrefslogtreecommitdiffstats
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authordaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-11 23:55:45 +0000
committerdaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-11 23:55:45 +0000
commitd2b48f0c58acd993a34ce2ab25166ef727a12cce (patch)
tree33e26cb48c7e5455995d1edba975d67cf78cad99 /gcc/builtins.c
parentf6e79f69bcfd79a673dc4ab19db9af5513c87dbb (diff)
downloadppe42-gcc-d2b48f0c58acd993a34ce2ab25166ef727a12cce.tar.gz
ppe42-gcc-d2b48f0c58acd993a34ce2ab25166ef727a12cce.zip
2009-06-11 David Daney <ddaney@caviumnetworks.com>
PR c/39252 * doc/extend.texi ( __builtin_unreachable): Document new builtin. * builtins.c (expand_builtin_unreachable): New function. (expand_builtin): Handle BUILT_IN_UNREACHABLE case. * builtins.def (BUILT_IN_UNREACHABLE): Add new builtin. * cfgcleanup.c (try_optimize_cfg): Delete empty blocks with no successors. * cfgrtl.c (rtl_verify_flow_info): Handle empty blocks when searching for missing barriers. 2009-06-11 David Daney <ddaney@caviumnetworks.com> PR c/39252 * gcc.dg/builtin-unreachable-1.c: New test. * gcc.dg/builtin-unreachable-2.c: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148403 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index a555e4fa14b..98919780e28 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5298,6 +5298,17 @@ expand_builtin_trap (void)
emit_barrier ();
}
+/* Expand a call to __builtin_unreachable. We do nothing except emit
+ a barrier saying that control flow will not pass here.
+
+ It is the responsibility of the program being compiled to ensure
+ that control flow does never reach __builtin_unreachable. */
+static void
+expand_builtin_unreachable (void)
+{
+ emit_barrier ();
+}
+
/* Expand EXP, a call to fabs, fabsf or fabsl.
Return NULL_RTX if a normal call should be emitted rather than expanding
the function inline. If convenient, the result should be placed
@@ -6795,6 +6806,10 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
expand_builtin_trap ();
return const0_rtx;
+ case BUILT_IN_UNREACHABLE:
+ expand_builtin_unreachable ();
+ return const0_rtx;
+
case BUILT_IN_PRINTF:
target = expand_builtin_printf (exp, target, mode, false);
if (target)
OpenPOWER on IntegriCloud