📄 9.13.7.htm
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<title>9.7的解答</title>
</head>
<body background="../images/background.gif">
<p>解:对本题程序划分基本块并构造其程序流图,结果显示在图9.7(1)中,流图中以深度为主次序为:B<sub>1</sub>, B<sub>2</sub>,
B<sub>3</sub>, B<sub>5</sub>, B<sub>7</sub>, B<sub>4</sub>, B<sub>6</sub>。</p>
<p align = "center"><img src="images/e9.7a.gif" width="529" height="358"></p>
<p align="left">(1)各基本块的到达-定值集IN[B]:</p>
<p align="left"> 从图9.7(1)的程序流图直接求GEN[B]和KILL[B],显示在表9.7(1)中。到达-定值集的计算结果显示在表9.7(2)中。</p>
<p align="left">表9.7(1)</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="55%" id="AutoNumber1">
<tr>
<td width="20%" align="center">基本块</td>
<td width="20%" align="center">GEN[B]</td>
<td width="20%" align="center">位向量</td>
<td width="20%" align="center">KILL[B]</td>
<td width="20%" align="center">位向量</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>1</sub></td>
<td width="20%" align="center">{ d<sub>1</sub> }</td>
<td width="20%" align="center">1000000000</td>
<td width="20%" align="center">{ d<sub>5</sub> }</td>
<td width="20%" align="center">0000100000</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>2</sub></td>
<td width="20%" align="center">{ d<sub>2</sub> }</td>
<td width="20%" align="center">0100000000</td>
<td width="20%" align="center">{ d<sub>9</sub> }</td>
<td width="20%" align="center">0000000010</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>3</sub></td>
<td width="20%" align="center">{ <sub> </sub> }</td>
<td width="20%" align="center">0000000000</td>
<td width="20%" align="center">{ }</td>
<td width="20%" align="center">0000000000</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>5</sub></td>
<td width="20%" align="center">{ d<sub>7</sub> }</td>
<td width="20%" align="center">0000001000</td>
<td width="20%" align="center">{ }</td>
<td width="20%" align="center">0000000000</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>7</sub></td>
<td width="20%" align="center">{ d<sub>9</sub> }</td>
<td width="20%" align="center">0000000010</td>
<td width="20%" align="center">{ d<sub>2</sub> }</td>
<td width="20%" align="center">0100000000</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>4</sub></td>
<td width="20%" align="center">{ }</td>
<td width="20%" align="center">0000000000</td>
<td width="20%" align="center">{ <sub> </sub> }</td>
<td width="20%" align="center">0000000000</td>
</tr>
<tr>
<td width="20%" align="center">B<sub>6</sub></td>
<td width="20%" align="center">{ d<sub>5</sub> }</td>
<td width="20%" align="center">0000100000</td>
<td width="20%" align="center">{ d<sub>1</sub> }</td>
<td width="20%" align="center">1000000000</td>
</tr>
</table>
<p>表9.7(2)</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="88%" id="AutoNumber2" height="150">
<tr>
<td width="7%" rowspan="2" height="33" align="center">基本块</td>
<td width="24%" colspan="2" height="16" align="center">初值</td>
<td width="23%" colspan="2" height="16" align="center">第一次迭代</td>
<td width="24%" colspan="2" height="16" align="center">第二次迭代</td>
<td width="24%" colspan="2" height="16" align="center">第三次迭代</td>
</tr>
<tr>
<td width="11%" height="16" align="center">IN[B]</td>
<td width="11%" height="16" align="center">OUT[B]</td>
<td width="11%" height="16" align="center">IN[B]</td>
<td width="12%" height="16" align="center">OUT[B]</td>
<td width="12%" height="16" align="center">IN[B]</td>
<td width="12%" height="16" align="center">OUT[B]</td>
<td width="12%" height="16" align="center">IN[B]</td>
<td width="12%" height="16" align="center">OUT[B]</td>
</tr>
<tr>
<td width="7%" height="14" align="center">B<sub>1</sub></td>
<td width="11%" height="14" align="center">0000000000</td>
<td width="11%" height="14" align="center">1000000000</td>
<td width="11%" height="14" align="center">0000000000</td>
<td width="12%" height="14" align="center">1000000000</td>
<td width="12%" height="14" align="center">0000000000</td>
<td width="12%" height="14" align="center">1000000000</td>
<td width="12%" height="14" align="center">0000000000</td>
<td width="12%" height="14" align="center">1000000000</td>
</tr>
<tr>
<td width="7%" height="16" align="center">B<sub>2</sub></td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">0100000000</td>
<td width="11%" height="16" align="center">1000100000</td>
<td width="12%" height="16" align="center">1100100000</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101000</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1101101000</td>
</tr>
<tr>
<td width="7%" height="16" align="center">B<sub>3</sub></td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">1100100010</td>
<td width="12%" height="16" align="center">1100100010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
</tr>
<tr>
<td width="7%" height="16" align="center">B<sub>5</sub></td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">0000001000</td>
<td width="11%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
</tr>
<tr>
<td width="7%" height="16" align="center">B<sub>7</sub></td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">0000000010</td>
<td width="11%" height="16" align="center">1000101010</td>
<td width="12%" height="16" align="center">1000101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1000101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1000101010</td>
</tr>
<tr>
<td width="7%" height="16" align="center">B<sub>4</sub></td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">1100100010</td>
<td width="12%" height="16" align="center">1100100010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
</tr>
<tr>
<td width="7%" height="16" align="center">B<sub>6</sub></td>
<td width="11%" height="16" align="center">0000000000</td>
<td width="11%" height="16" align="center">0000100000</td>
<td width="11%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">0100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">0100101010</td>
<td width="12%" height="16" align="center">1100101010</td>
<td width="12%" height="16" align="center">0100101010</td>
</tr>
</table>
<p>(2)各基本块中各变量的ud链:</p>
<p>
I在B<sub>3</sub>中引用点d<sub>3</sub>的ud链是{ d<sub>2</sub>, d<sub>9</sub> };<br>
I在B<sub>5</sub>中引用点d<sub>7</sub>的ud链是{ d<sub>2</sub>, d<sub>9</sub> };<br>
I在B<sub>7</sub>中引用点d<sub>9</sub>的ud链是{ d<sub>2</sub>, d<sub>9</sub> };<br>
N在B<sub>3</sub>中引用点d<sub>3</sub>的ud链是{ d<sub>1</sub>, d<sub>5</sub> };<br>
N在B<sub>5</sub>中引用点d<sub>7</sub>的ud链是{ d<sub>1</sub>, d<sub>5</sub> };<br>
N在B<sub>4</sub>中引用点d<sub>4</sub>的ud链是{ d<sub>1</sub>, d<sub>5</sub> };<br>
N在B<sub>8</sub>中引用点d<sub>5</sub>的ud链是{ d<sub>1</sub>, d<sub>5</sub> };<br>
N在B<sub>5</sub>中引用点d<sub>8</sub>的ud链是{ d<sub>7</sub> };<br>
</p>
<p>(3)各基本块出口的活跃变量集V_OUT[B]:</p>
<p>使用下面的联立方程:<br>
V_IN[B] = USE[B] <font face="宋体">∪ ( V_OUT[B] - DEF[B] )<br>
V_OUT[B] = ∪ V_IN[S]<br>
<font size="2">
S∈S[B]</font></font></p>
<p> 根据图9.7(1)的程序流图,求出USE[B]和DEF[B]显示在表9.7(3)中。已知各基本块的深度为主次序的逆序为B<sub>6</sub>, B<sub>4</sub>,
B<sub>7</sub>, B<sub>5</sub>, B<sub>3</sub>, B<sub>2</sub>, B<sub>1</sub>。各次迭代结果显示在表9.7(4)中。</p>
<p>表9.7(3)</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="75%" id="AutoNumber3">
<tr>
<td width="12%" align="center">基本块</td>
<td width="44%" align="center">DEF[B]</td>
<td width="44%" align="center">USE[B]</td>
</tr>
<tr>
<td width="12%" align="center">B<sub>1</sub></td>
<td width="44%" align="center">{ N }</td>
<td width="44%" align="center"><font face="宋体">Φ</font></td>
</tr>
<tr>
<td width="12%" align="center">B<sub>2</sub></td>
<td width="44%" align="center">{ I }</td>
<td width="44%" align="center"><font face="宋体">Φ</font></td>
</tr>
<tr>
<td width="12%" align="center">B<sub>3</sub></td>
<td width="44%" align="center"><font face="宋体">Φ</font></td>
<td width="44%" align="center">{ I, N }</td>
</tr>
<tr>
<td width="12%" align="center">B<sub>5</sub></td>
<td width="44%" align="center">{ J }</td>
<td width="44%" align="center">{ I, N }</td>
</tr>
<tr>
<td width="12%" align="center">B<sub>7</sub></td>
<td width="44%" align="center"><font face="宋体">Φ</font></td>
<td width="44%" align="center">{ I }</td>
</tr>
<tr>
<td width="12%" align="center">B<sub>4</sub></td>
<td width="44%" align="center"><font face="宋体">Φ</font></td>
<td width="44%" align="center">{ N }</td>
</tr>
<tr>
<td width="12%" align="center">B<sub>6</sub></td>
<td width="44%" align="center"><font face="宋体">Φ</font></td>
<td width="44%" align="center">{ N }</td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -