📄 9.6.2bc.htm
字号:
<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><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.2bb.htm'" ></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.3.htm'" ></img></td>
</tr>
</table>
<br><br>
<table>
<tr>
<td>    </td>
<td class="content">
<p>
下面我们给出求可用表达式的算法。
</p>
<font class = "definition"><p>算法9.4 可用表达式<br></font>
<p>输入:流图G,每块B的e-kill[B]和e-gen[B]已计算,开始块是B1。<br>
<p>输出:每块B的e_in[B]集合。<br>
<p>方法:执行图9.34的算法,每步的解释和算法9.3类似。<br>
<br>
e_in[B1] := Φ;<br>
e_out[B1] := e-gen[B1]; <font color="#008000">/*对初始结点B1,<br>
in和out决不会改变*/</font><br>
<font color="#0000FF">
<b>for</b></font> B ≠ B1 <b><font color="#0000FF">do</font></b> <br>
e_out[B] := U - e-kill[B];
<font size="3" color="#008000">/*初始估计值取最大*/</font><br>
change := <b><font color="#0000FF">true</font></b>;<br>
<b><font color="#0000FF">while</font></b> change <b><font color="#0000FF">do</font></b>
<font color="#0000FF"><b>begin</b></font><br>
change := <b><font color="#0000FF">false</font></b>;<br>
<b><font color="#0000FF">for</font></b> B ≠ B1 <b><font color="#0000FF">do</font></b> <b>
<font color="#0000FF">begin</font></b><br>
e_in[B] := ∩ e_out[P];<br>
    <font size="2">P是B的前驱<br></font>
oldout := e_out[B];<br>
e_out[B] := e-gen[B] ∪ (e_in[B] - e-kill[B]);<br>
<b><font color="#0000FF">if</font></b> out[B] ≠ oldout <b><font color="#0000FF">then</font></b> change :=
<font color="#0000FF"><b>true</b></font><br>
<b><font color="#0000FF">end</font></b><br>
<b><font color="#0000FF">end</font></b><br>
<center><b>图9.34    可用表达式计算算法</b></td>
</tr>
</table>
<br>
<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.2bb.htm'" ></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.6.3.htm'" ></img></td>
</tr>
</table>
</BODY>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -