graph - 弦图和 SSA 形式程序

标签 graph compiler-optimization register-allocation ssa

我的问题是关于为什么每个 SSA 形式的程序默认都对应一个弦图。 Wikipedia defines弦图为

a chordal graph is one in which all cycles of four or more vertices have a chord, which is an edge that is not part of the cycle but connects two vertices of the cycle

这是一个取自 some lecture notes 的简单示例为了了解 SSA 表格注册分配的好处,我正在关注。作者写道:

[...] the following program and corresponding chordal graph:

confusing example

首先:我不明白这个图怎么是弦的。我意识到该程序不是 SSA 形式。然后作者将其转化为SSA形式得到这张干涉图

post-ssa example interference graph

但我还是看不出这是一个弦图,也看不出第一个图与后面的任何图有什么关系。

所有这些使得理解 SSA 程序如何产生弦交图变得非常困难。

以下是我调查过的一些来源:

  1. https://pdfs.semanticscholar.org/db6b/c047856bee4eb4e7d04f1b934864dca4b065.pdf?_ga=2.67844629.501567003.1543477413-723933249.1539714051

  2. https://homepages.dcc.ufmg.br/~fernando/publications/papers/APLAS05.pdf

  3. http://compilers.cs.uni-saarland.de/papers/ifg_ssa.pdf

  4. https://homepages.dcc.ufmg.br/~fernando/classes/dcc888/ementa/slides/SSABasedRA.pdf

最佳答案

关于您在讲义第 6 节中列出的程序:

I don't understand how is this graph is chordal. I realize that the program is not in SSA form.

您说得对,原始程序不是 SSA 形式。您也有理由对为什么它的“和弦图”是和弦感到困惑:不是。作者犯了一个小错误。他们在提到第一个程序时写的是“弦图”,他们的意思是写的是“干涉图”。

你指的第二张图是平凡弦图,因为它不包含任何循环。记住你给出的弦图的定义:

a chordal graph is one in which all cycles of four or more vertices have a chord, which is an edge that is not part of the cycle but connects two vertices of the cycle

如果有零个循环,则空洞地所有这些循环都包含一个和弦。

关于graph - 弦图和 SSA 形式程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53559767/

相关文章:

assembly - 手工编码汇编 - 实用的寄存器分配?

ios - 如何在 iOS 中创建流体图形动画

c - 添加与 ORing 性能

c - GCC asm 内联约束,寄存器分配冲突

c - GCC优化步骤

c++ - GCC:-O3 和 -Os 之间的区别

graph - 为什么有向无环图中的最长路径需要拓扑排序?

c - 从文件(C 语言)中读取整数,其中包括有向图的数据

java - 如何迭代图中的所有节点?