FIRM—A Graph-Based Intermediate Representation

We present our compiler intermediate representation FIRM. Programs are always in SSA-form enabling a concise graph-based representation. We argue that this naturally encodes context information simplifying many analyses and optimizations. Instructions are connected by dependency edges relaxing the total to a partial order inside a basic block. For example alias analysis results can be directly encoded in the graph structure. The paper gives an overview of the representation and focuses on its construction. We present a simple construction algorithm which does not depend on dominance frontiers or a dominance tree. We prove that for reducible programs it produces a program in pruned and minimal SSA-form. The algorithm works incrementally so optimizations like copy propagation and constant folding can be performed on-the-fly during the construction.

[1]  Steven R. Vegdahl Phase coupling and constant generation in an optimizing microcode compiler , 1982, MICRO 15.

[2]  Alan Mycroft,et al.  Combined Code Motion and Register Allocation Using the Value State Dependence Graph , 2003, CC.

[3]  Martin Trapp,et al.  Optimierung objektorientierter Programme , 2001 .

[4]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[5]  Michael H. Paleczny,et al.  A simple graph-based intermediate representation , 1995, IR '95.

[6]  Sebastian Hack,et al.  Register Spilling and Live-Range Splitting for SSA-Form Programs , 2009, CC.

[7]  Sebastian Hack,et al.  Preference-Guided Register Assignment , 2010, CC.

[8]  Martin Trapp Optimierung objektorientierter Programme: Übersetzungstechniken, Analysen und Transformationen , 2001, Xpert.Press.

[9]  Raymond Lo,et al.  Effective Representation of Aliases and Indirect Memory Operations in SSA Form , 1996, CC.

[10]  Robert E. Tarjan,et al.  Finding Dominators in Directed Graphs , 1974, SIAM J. Comput..

[11]  Jeffrey D. Ullman,et al.  Characterizations of Reducible Flow Graphs , 1974, JACM.

[12]  Arthur B. Maccabe,et al.  The program dependence web: a representation supporting control-, data-, and demand-driven interpretation of imperative languages , 1990, PLDI '90.

[13]  Keith D. Cooper,et al.  Combining analyses, combining optimizations , 1995, TOPL.

[14]  Jong-Deok Choi,et al.  Automatic construction of sparse data flow evaluation graphs , 1991, POPL '91.

[15]  Sebastian Buchwald,et al.  Instruction selection by graph transformation , 2010, CASES '10.

[16]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1987, TOPL.

[17]  Sebastian Hack,et al.  Register allocation for programs in SSA form , 2006, CC.

[18]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.