[英]Compiler intermediate code generation three address code fjump
What does FJUMP mean in this context ? 在这种情况下 , FJUMP是什么意思?
The following is a Three Address Code (TAC) Intermediate Representation for a register machine: it contains a function called
foo
, which takes an integer parametern
and a parametera
which is an array of integers.以下是寄存器机的三地址代码(TAC)中间表示形式:它包含一个名为
foo
的函数,该函数采用一个整数参数n
和一个参数a
,该参数a
是整数数组。 Write down the high-level language counterpart in Java-like pseudocode.用类似Java的伪代码写下高级语言副本。
label Foo: res = 1 i = 1 label BAR: t1 = i LEQ n a[1] = res i = i ADD 1 res = res MUL i JUMP BAR label BAZ:
I thought a jump instruction in three address code is something like "if x goto L"? 我认为三个地址代码中的跳转指令类似于“ if x goto L”吗?
The relevant excerpt is: 相关摘录为:
t1 = i LEQ n
FJUMP t1 BAZ
Which I take to mean "if i
is less than or equal to n
, jump to BAZ
". 我的意思是“如果
i
小于或等于n
,则跳至BAZ
”。 So FJUMP
indeed does seem to denote a conditional jump (as you read it, feel free to insert the "if" and "goto" parts yourself!). 因此,
FJUMP
确实确实表示有条件的跳转(在阅读时,请FJUMP
插入“ if”和“ goto”部分!)。
You have to understand that three-address code is not a language . 您必须了解三地址代码不是一种语言 。 It is a class of intermediate representations (languages) that have similar characteristics, not unlike the classes of object-oriented or functional languages.
它是一类具有相似特征的中间表示(语言),与面向对象或功能性语言的类别相同。 As a compiler developer, you get to design your three-address code, should you opt to use such an intermediate representation.
作为编译器开发人员, 如果您选择使用这种中间表示形式,则必须设计三个地址的代码。
On a side note, I have a feeling that students of compiler theory tend to read their textbooks too literally. 顺便提一句,我觉得编译器理论的学生倾向于按字面意义阅读他们的教科书。 If you look at a bunch of reasonably modern compilers, you are likely to find recurring patterns, but they tend to differ quite significantly in the details.
如果您看一堆相当现代的编译器,您可能会发现重复出现的模式,但是它们在细节上往往有很大的不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.