Structural Operational Semantics for Control Flow Graph Machines

05/14/2018
by   Dmitri Garbuzov, et al.
0

Compilers use control flow graph (CFG) representations of low-level programs because they are suited to program analysis and optimizations. However, formalizing the behavior and metatheory of CFG programs is non-trivial: CFG programs don't compose well, their semantics depends on auxiliary state, and, as a consequence, they do not enjoy a simple equational theory that can be used for reasoning about the correctness of program transformations. Lambda-calculus-based intermediate representations, in contrast, have well-understood operational semantics and metatheory, including rich equational theories, all of which makes them amenable to formal verification. This paper establishes a tight equivalence between (a variant of) Levy's call-by-push-value (CBPV) calculus and a control flow graph machine whose instructions are in static single assignment (SSA) form. The correspondence is made precise via a series of abstract machines that align the transitions of the structural operational semantics of the CBPV language with the computation steps of the SSA form. The target machine, which is derived from the CBPV language, accurately captures the execution model of control flow graphs, including direct jumps, mutually recursive code blocks, and multi-argument function calls, and the closure-free subset is similar to the SSA intermediate representations found in modern compilers such as LLVM and GCC. The definitions of all the language/abstract machine semantics and the theorems relating them are fully verified in Coq.

READ FULL TEXT

Authors

page 1

page 2

page 3

page 4

07/05/2021

A Formal Semantics of the GraalVM Intermediate Representation

The optimization phase of a compiler is responsible for transforming an ...
10/10/2020

Automatically Deriving Control-Flow Graph Generators from Operational Semantics

We develop the first theory of control-flow graphs from first principles...
02/04/2021

Operational Semantics with Hierarchical Abstract Syntax Graphs

This is a motivating tutorial introduction to a semantic analysis of pro...
06/14/2022

Aeneas: Rust Verification by Functional Translation

We present Aeneas, a new verification toolchain for Rust programs based ...
03/08/2018

Semantical Equivalence of the Control Flow Graph and the Program Dependence Graph

The program dependence graph (PDG) represents data and control dependenc...
05/10/2021

How could Neural Networks understand Programs?

Semantic understanding of programs is a fundamental problem for programm...
05/31/2019

Interaction Trees: Representing Recursive and Impure Programs in Coq (Work In Progress)

We present "interaction trees" (ITrees), a general-purpose data structur...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.