📄 9.13b.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.13.htm'"></img></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.13c.htm'"></img></td>
</tr>
</table>
<br><br>
<font class="title2"><b>练习</b></font>
<table><tr><td>    </td>
<td class="content">
<a name="9.3"></a>9.3 考虑下面求矩阵A、B成绩的程序片段:
<table align=center width=100%>
<tr><td><font color="#0000FF">BEGIN</font><br>
<span lang="zh-cn"> </span><font color="#0000FF">FOR</font> i := 1
<font color="#0000FF">TO</font> n <font color="#0000FF">DO</font><br>
<span lang="zh-cn"> </span>
<font color="#0000FF">FOR</font> j := 1 <font color="#0000FF">TO</font> n
<font color="#0000FF">DO</font><br>
<span lang="zh-cn">
</span><font color="#0000FF">FOR</font> k = 1 <font color="#0000FF">TO</font> n
<font color="#0000FF">DO</font><br>
<span lang="zh-cn">
</span>c[i, j] := c[i, j] + A[i, k} * B[k, j]<br>
<font color="#0000FF">END</font></td></tr>
</table>
<span lang="zh-cn">(1)假定对数组A、B、C采用静态存储分配,每个字占用4个字节,存储器以字节为单位编址。给出该程序的三地址代码序列。</span><br>
<span lang="zh-cn">(2)构造该程序相应的流图。</span> <br>
<span lang="zh-cn">(3)删除流图中各基本块内的公共子表达式<br>
(4)指出流图中所有回边及其相应循环,并且进行循环优化。</span><table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('9.13.3.htm','','left=100,top=100,toolbar=no,scrollbars=yes,width=600,height=600')" width="32" height="32"></img>
</td></tr>
</table>
<a name="9.4"></a>
<hr size=2 align=center color=red><br>
9.4 试求出如下四元式程序中的循环并进行循环优化.<br>
I := 1<br>
<font color="#0000FF">read</font> J, K<br>
L: A := K * I<br>
B := J * I<br>
C := A * B<br>
<font color="#0000FF">write</font> C<br>
I := I + 1<br>
<font color="#0000FF">if</font> I < 100 <font color="#0000FF">goto</font> L<br>
<font color="#0000FF">halt</font>
<table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('9.13.4.htm','','left=100,top=100,toolbar=no,scrollbars = yes, width=600,height=600')" width="32" height="32"></img>
</td></tr>
</table>
<hr size=2 align=center color=red><br>
<table align=right width=300>
<tr>
<td>
<img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.13.htm'"></img></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.13c.htm'"></img></td>
</tr>
</table>
</BODY>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -