Native Support for Explicit Stacks in LLVM

Kavon Farvardin, Simon Peyton Jones

Abstract

During compilation, an explicit model of the control stack can uniformly express a host of language features, such as concurrency and exception handling. For GHC and other compilers using such a model, LLVM is an awkward compilation target. Because of limitations in the LLVM IR, every point at which a function call returns must be split into its own function. This splitting transformation (a.k.a. “proc-point splitting” in GHC) destroys much of the function-local control-flow in the original program, rendering most of LLVM’s optimizations useless.
In this talk, I will discuss my work to extend LLVM with a new feature that supports explicit stack management, eliminating the need for the splitting transformation. Using GHC as a testbed, I will also compare the new feature against the prior splitting workaround.