表达式

原文:$a = b + -c$

生成 IR:

$$ \begin{aligned}

t_1 &= \mathtt{minus}~c \\ t_2 &= b + t_1 \\ a &= t_2

\end{aligned} $$

Untitled

数组引用

对于 $a[1][2]$,我们需要计算其相对于数组基地址 $a$ 的偏移地址:

$$ addr(a[1][2]) =\blue{base} + \red{1 × 12 + 2 × 4} $$

Untitled

Untitled

控制流语句

Untitled

继承属性 $B.true$, $B.false$, $S.next$ 指明了控制流跳转目标

继承属性 $S.next$

Untitled

{ ... /* S.code */ }
S.next:
	...

if 语句的翻译

Untitled

Untitled

布尔表达式