You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
4.3 KiB
HTML
99 lines
4.3 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>GIMPLE Exception Handling - GNU Compiler Collection (GCC) Internals</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
|
|
<meta name="generator" content="makeinfo 4.13">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="up" href="GIMPLE.html#GIMPLE" title="GIMPLE">
|
|
<link rel="prev" href="GIMPLE-instruction-set.html#GIMPLE-instruction-set" title="GIMPLE instruction set">
|
|
<link rel="next" href="Temporaries.html#Temporaries" title="Temporaries">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
|
(see below). A copy of the license is included in the section entitled
|
|
``GNU Free Documentation License''.
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
A GNU Manual
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
software. Copies published by the Free Software Foundation raise
|
|
funds for GNU development.-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="GIMPLE-Exception-Handling"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Temporaries.html#Temporaries">Temporaries</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="GIMPLE-instruction-set.html#GIMPLE-instruction-set">GIMPLE instruction set</a>,
|
|
Up: <a rel="up" accesskey="u" href="GIMPLE.html#GIMPLE">GIMPLE</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">11.4 Exception Handling</h3>
|
|
|
|
<p><a name="index-GIMPLE-Exception-Handling-2138"></a>
|
|
Other exception handling constructs are represented using
|
|
<code>GIMPLE_TRY_CATCH</code>. <code>GIMPLE_TRY_CATCH</code> has two operands. The
|
|
first operand is a sequence of statements to execute. If executing
|
|
these statements does not throw an exception, then the second operand
|
|
is ignored. Otherwise, if an exception is thrown, then the second
|
|
operand of the <code>GIMPLE_TRY_CATCH</code> is checked. The second
|
|
operand may have the following forms:
|
|
|
|
<ol type=1 start=1>
|
|
|
|
<li>A sequence of statements to execute. When an exception occurs,
|
|
these statements are executed, and then the exception is rethrown.
|
|
|
|
<li>A sequence of <code>GIMPLE_CATCH</code> statements. Each
|
|
<code>GIMPLE_CATCH</code> has a list of applicable exception types and
|
|
handler code. If the thrown exception matches one of the caught
|
|
types, the associated handler code is executed. If the handler
|
|
code falls off the bottom, execution continues after the original
|
|
<code>GIMPLE_TRY_CATCH</code>.
|
|
|
|
<li>A <code>GIMPLE_EH_FILTER</code> statement. This has a list of
|
|
permitted exception types, and code to handle a match failure. If the
|
|
thrown exception does not match one of the allowed types, the
|
|
associated match failure code is executed. If the thrown exception
|
|
does match, it continues unwinding the stack looking for the next
|
|
handler.
|
|
|
|
</ol>
|
|
|
|
<p>Currently throwing an exception is not directly represented in
|
|
GIMPLE, since it is implemented by calling a function. At some
|
|
point in the future we will want to add some way to express that
|
|
the call will throw an exception of a known type.
|
|
|
|
<p>Just before running the optimizers, the compiler lowers the
|
|
high-level EH constructs above into a set of ‘<samp><span class="samp">goto</span></samp>’s, magic
|
|
labels, and EH regions. Continuing to unwind at the end of a
|
|
cleanup is represented with a <code>GIMPLE_RESX</code>.
|
|
|
|
</body></html>
|
|
|