📄 9.6.1.htm.bak
字号:
<html>
<head>
<title>编译原理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link type="text/css" rel="stylesheet" href="../css/specification.css">
</head>
<BODY>
<table align=right width=300>
<tr>
<td height="26">
<img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.0.htm'" ></img></td>
<td height="26"><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.1b.htm'" ></td>
</tr>
</table>
<br><br>
<font class="title2">9.6.1 到达_定值的迭代算法</font>
<table>
<tr>
<td>    </td>
<td class="content">
<p>
对于每个基本块B,只要把每块中的语句看成是一个或多个语句的串联,就可以象上节那样定义in[B],out[B],gen[B]和kill[B]。假定每个块的gen和kill已经计算,我们可以建两组方程,见下面的(9.9),它们联系in和out。第二组方程是对所有语句都成立的一般规律(9.5)在基本块上的体现。这两组方程是
</p>
<font color="#FF0000">         in[B]=∪out[P] <br>
<font size="2">                P是B的前驱 <br></font>
         out[B]=gen[B]∪(in[B]-kill[B]) 方程(9.9) <br>
</p>
<p>
</font>如果流图有n个基本块,从(9.9)得到2n个方程。这2n个方程的求解可处理为反复计算in和out集合,如上一节解do-while语句的数据流方程(9.6)和(9.7)那样。上节的计算从空集作为所有out集合的初始估计值开始,这里,in集合的初始值为空,方程(9.6)和(9.7)只需要一次迭代,但对于更复杂的方程,事先不能确定迭代的次数。<br>
<p>
<font class = "definition">算法9.3 到达_定值</font>
</p>
<p>
输入: 每个块B的kill[B]和gen[B]已经算好的流图。
</p>
<p>
输出: 每个块的in[B]和out[B]。
</p>
<p>
方法: 使用迭代方法,由所有B的in[B]=ф开始,收敛到期望的in和out值。因为必须迭代计算in到out收敛。因此使用布尔变量change记录每遍扫描过后out是否有所改变,这个算法显示在下页的图9.30中。
</p>
</td>
</tr>
</table>
<p>
<table>
<tr>
<td><font class="yanshi">       观看演示 </font></td>
<td><font color=blue onmouseover="javascript:style.cursor='hand'" onclick="javascript:open('applet/9611/Page1.htm','_blank','menu=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,left=100,top=100,width=800,height=600')">到达_定值算法演示</font></td>
<td><img src="../images/yanshi.gif"></img></td>
</tr>
</table>
</p>
<table align=right width=300 height="30">
<tr>
<td height="26">
<img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.0.htm'" ></img></td>
<td height="26"><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.1b.htm'" ></td>
</tr>
</table>
</BODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -