Modular, Compositional, and Executable Formal Semantics for LLVM IR

被引:16
作者
Zakowski, Yannick [1 ]
Beck, Calvin [2 ]
Yoon, Irene [2 ]
Zaichuk, Ilia [3 ]
Zaliva, Vadim [4 ]
Zdancewic, Steve [2 ]
机构
[1] INRIA, Rocquencourt, France
[2] Univ Penn, Philadelphia, PA 19104 USA
[3] Taras Shevchenko Natl Univ Kyiv, Kiev, Ukraine
[4] Carnegie Mellon Univ, Pittsburgh, PA 15213 USA
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2021年 / 5卷
基金
美国国家科学基金会;
关键词
Semantics; Monads; Coq; LLVM; Verified Compilation;
D O I
10.1145/3473572
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
This paper presents a novel formal semantics, mechanized in Coq, for a large, sequential subset of the LLVM IR. In contrast to previous approaches, which use relationally-specified operational semantics, this new semantics is based on monadic interpretation of interaction trees, a structure that provides a more compositional approach to defining language semantics while retaining the ability to extract an executable interpreter. Our semantics handles many of the LLVM IR's non-trivial language features and is constructed modularly in terms of event handlers, including those that deal with nondeterminism in the specification. We show how this semantics admits compositional reasoning principles derived from the interaction trees equational theory of weak bisimulation, which we extend here to better deal with nondeterminism, and we use them to prove that the extracted reference interpreter faithfully refines the semantic model. We validate the correctness of the semantics by evaluating it on unit tests and LLVM IR programs generated by HELIX.
引用
收藏
页数:30
相关论文
共 57 条
[1]  
APPEL A, 2011, PROGRAMMING LANGUAGE, DOI DOI 10.1007/978-3-642-19718-5_1
[2]   Formal Verification of a Constant-Time Preserving C Compiler [J].
Barthe, Gilles ;
Blazy, Sandrine ;
Gregoire, Benjamin ;
Hutin, Remi ;
Laporte, Vincent ;
Pichardie, David ;
Trieu, Alix .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4
[3]   Simple relational correctness proofs for static analyses and program transformations [J].
Benton, N .
ACM SIGPLAN NOTICES, 2004, 39 (01) :14-25
[4]   A Trusted Mechanised Java']JavaScript Specification [J].
Bodin, Martin ;
Chargueraud, Arthur ;
Filaretti, Daniele ;
Gardner, Philippa ;
Maffeis, Sergio ;
Naudziuniene, Daiva ;
Schmitt, Alan ;
Smith, Gareth .
ACM SIGPLAN NOTICES, 2014, 49 (01) :87-100
[5]  
Chakraborty S, 2017, 2017 7TH INTERNATIONAL SYMPOSIUM ON EMBEDDED COMPUTING AND SYSTEM DESIGN (ISED)
[6]  
Charguéraud A, 2013, LECT NOTES COMPUT SC, V7792, P41, DOI 10.1007/978-3-642-37036-6_3
[7]   A Verified Compiler for an Impure Functional Language [J].
Chlipala, Adam .
POPL'10: PROCEEDINGS OF THE 37TH ANNUAL ACM SIGPLAN-SIGACT SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES, 2010, :93-106
[8]   EFFICIENTLY COMPUTING STATIC SINGLE ASSIGNMENT FORM AND THE CONTROL DEPENDENCE GRAPH [J].
CYTRON, R ;
FERRANTE, J ;
ROSEN, BK ;
WEGMAN, MN ;
ZADECK, FK .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1991, 13 (04) :451-490
[9]  
Ellison Charles, 2012, THESIS U ILLINOIS UR
[10]   SPIRAL: Extreme Performance Portability [J].
Franchetti, Franz ;
Low, Tze Meng ;
Popovici, Doru Thom ;
Veras, Richard M. ;
Spampinato, Daniele G. ;
Johnson, Jeremy R. ;
Puschel, Markus ;
Hoe, James C. ;
Moura, Jose M. F. .
PROCEEDINGS OF THE IEEE, 2018, 106 (11) :1935-1968