2019.10.21

The increasing significance of intermediate representations in compilers

THE IMPORTANCE OF IRS TO COMPILERS

THE DIFFERENT IR FORMS

The form of an IR can be classified as either hierarchical or flat. A hierarchical IR allows nested structures.

大概浅台词在说MAPLE是hierarchical,LLVM的IR是flat,然后应该会比较二者的优劣了吧。

Hierarchical的优点

A hierarchical IR can be represented internally in the form of trees (the data structure preferred by compilers) without loss of accuracy.


Lying somewhere between hierarchical and flat IRs is the language of an abstract stack machine. ... Using the language of a stack machine as the IR has been a common practice from the first IR defined for Pascal, called p-code, to the current-day Java bytecode or CIL (Common Intermediate Language).

不是很懂他的思路,为什么要提出这个概念?

IRS FOR PROGRAM DELIVERY

JUST-IN-TIME COMPILATION

STANDARDIZING IRS

IR DESIGN ATTRIBUTES

  • Completeness

    这个不必说,要能够完全传达源程序的意图。

  • Semantic gap

    为了保护知识产权所以IR要足够低层次?这是什么逻辑?

  • Hardware neutrality

    he IR must not have built-in assumptions of any special hardware characteristic. Any execution model apparent in the IR should be a reflection of the programming language and not the hardware platform. This will ensure it can be compiled to the widest range of machines, and implies that the level of the IR cannot be too low.

  • Manually programmable

  • Extensibility

  • Simplicity

  • Program information

  • Analysis information