📄 9.3.3.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.3.1.htm'" ></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.3.3_2.htm'" ></img></td>
</tr>
</table>
<br>
<p><br>
<font class="title2"><b>9.3.2 用dag删除死代码</b></font> </p>
<table>
<tr>
<td>    </td>
<td class="content">
<p>
对应到死代码删除的dag操作相当容易实现。从dag中删掉对应到死变量的根(即没有父结点的结点),重复这个过程,直至删掉对应到死代码的所有结点。
</p>
</td>
</tr>
</table>
<p>
<p>
<p>
<p><hr size=2 width=90% align=center color=red>
<p> </p>
<font class="title2"><b>9.3.3 代数恒等的使用</b></font>
<table>
<tr>
<td>   </td>
<td class="content">
<p>
代数恒等代表了另一类重要的基本块优化。包括:
</p>
<p>
一、简单的代数变换
</p>
<p>
例如:可以利用算术恒等。如:
</p>
      x + 0 = 0 + x = x<br>
      x - 0 = x<br>
      x * 1 = 1 * x = x<br>
      x / 1 = x<br>
<p>
二、强度削弱
</p>
<p>
强度削弱是用较快的运算代替较慢的运算。例如:
</p>
      x <sup>2</sup> = x * x<br>
      2.0 * x = x + x<br>
      x / 2 = x * 0.5<br>
<p>
三、常量合并
</p>
<p>
常量合并是指在编译时完成常量表达式的计算,用结果值代替这个表达式。例如:表达式2 * 3.14可用6.28代替。
</p>
</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.3.1.htm'" ></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.3.3_2.htm'" ></td>
</tr>
</table>
</BODY>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -