Treegraph-based Instruction Scheduling for Stack-based Virtual Machines

Jiin Park, Jinhyung Park, Wonjoon Song, Songwook Yoon, bernd Burgstaller, Bernhard Scholz

Research output: Contribution to journalArticle

1 Citation (Scopus)

Abstract

Given the growing interest in the JVM and Microsoft's CLI as programming language implementation targets, code generation techniques for efficient stack-code are required. Compiler infrastructures such as LLVM are attractive for their highly optimizing middleend. However, LLVM's intermediate representation is register-based, and an LLVM code generator for a stack-based virtual machine needs to bridge the fundamental differences of the register and stack-based computation models. In this paper we investigate how the semantics of a register-based IR can be mapped to stack-code. We introduce a novel program representation called treegraphs. Treegraph nodes encapsulate computations that can be represented by DFS trees. Treegraph edges manifest computations with multiple uses, which is inherently incompatible with the consuming semantics of stack-based operators. Instead of saving a multiply-used value in a temporary, our method keeps all values on the stack, which avoids costly store and load instructions. Code-generation then reduces to scheduling of treegraph nodes in the most cost-effective way. We implemented a treegraph-based instruction scheduler for the LLVM compiler infrastructure. We provide experimental results from our implementation of an LLVM backend for TinyVM, which is an embedded systems virtual machine for C.

Original languageEnglish
Pages (from-to)33-45
Number of pages13
JournalElectronic Notes in Theoretical Computer Science
Volume279
Issue number1
DOIs
Publication statusPublished - 2011 Dec 2

Fingerprint

Instruction Scheduling
Virtual Machine
Scheduling
Semantics
Code Generation
Trees (mathematics)
Embedded systems
Compiler
Computer programming languages
Infrastructure
Vertex of a graph
Scheduler
Embedded Systems
Programming Languages
Virtual machine
Costs
Multiplication
Generator
Target
Code generation

All Science Journal Classification (ASJC) codes

  • Theoretical Computer Science
  • Computer Science(all)

Cite this

Park, Jiin ; Park, Jinhyung ; Song, Wonjoon ; Yoon, Songwook ; Burgstaller, bernd ; Scholz, Bernhard. / Treegraph-based Instruction Scheduling for Stack-based Virtual Machines. In: Electronic Notes in Theoretical Computer Science. 2011 ; Vol. 279, No. 1. pp. 33-45.
@article{f02feabbe1664dbf9c1b80e66cab261f,
title = "Treegraph-based Instruction Scheduling for Stack-based Virtual Machines",
abstract = "Given the growing interest in the JVM and Microsoft's CLI as programming language implementation targets, code generation techniques for efficient stack-code are required. Compiler infrastructures such as LLVM are attractive for their highly optimizing middleend. However, LLVM's intermediate representation is register-based, and an LLVM code generator for a stack-based virtual machine needs to bridge the fundamental differences of the register and stack-based computation models. In this paper we investigate how the semantics of a register-based IR can be mapped to stack-code. We introduce a novel program representation called treegraphs. Treegraph nodes encapsulate computations that can be represented by DFS trees. Treegraph edges manifest computations with multiple uses, which is inherently incompatible with the consuming semantics of stack-based operators. Instead of saving a multiply-used value in a temporary, our method keeps all values on the stack, which avoids costly store and load instructions. Code-generation then reduces to scheduling of treegraph nodes in the most cost-effective way. We implemented a treegraph-based instruction scheduler for the LLVM compiler infrastructure. We provide experimental results from our implementation of an LLVM backend for TinyVM, which is an embedded systems virtual machine for C.",
author = "Jiin Park and Jinhyung Park and Wonjoon Song and Songwook Yoon and bernd Burgstaller and Bernhard Scholz",
year = "2011",
month = "12",
day = "2",
doi = "10.1016/j.entcs.2011.11.004",
language = "English",
volume = "279",
pages = "33--45",
journal = "Electronic Notes in Theoretical Computer Science",
issn = "1571-0661",
publisher = "Elsevier",
number = "1",

}

Treegraph-based Instruction Scheduling for Stack-based Virtual Machines. / Park, Jiin; Park, Jinhyung; Song, Wonjoon; Yoon, Songwook; Burgstaller, bernd; Scholz, Bernhard.

In: Electronic Notes in Theoretical Computer Science, Vol. 279, No. 1, 02.12.2011, p. 33-45.

Research output: Contribution to journalArticle

TY - JOUR

T1 - Treegraph-based Instruction Scheduling for Stack-based Virtual Machines

AU - Park, Jiin

AU - Park, Jinhyung

AU - Song, Wonjoon

AU - Yoon, Songwook

AU - Burgstaller, bernd

AU - Scholz, Bernhard

PY - 2011/12/2

Y1 - 2011/12/2

N2 - Given the growing interest in the JVM and Microsoft's CLI as programming language implementation targets, code generation techniques for efficient stack-code are required. Compiler infrastructures such as LLVM are attractive for their highly optimizing middleend. However, LLVM's intermediate representation is register-based, and an LLVM code generator for a stack-based virtual machine needs to bridge the fundamental differences of the register and stack-based computation models. In this paper we investigate how the semantics of a register-based IR can be mapped to stack-code. We introduce a novel program representation called treegraphs. Treegraph nodes encapsulate computations that can be represented by DFS trees. Treegraph edges manifest computations with multiple uses, which is inherently incompatible with the consuming semantics of stack-based operators. Instead of saving a multiply-used value in a temporary, our method keeps all values on the stack, which avoids costly store and load instructions. Code-generation then reduces to scheduling of treegraph nodes in the most cost-effective way. We implemented a treegraph-based instruction scheduler for the LLVM compiler infrastructure. We provide experimental results from our implementation of an LLVM backend for TinyVM, which is an embedded systems virtual machine for C.

AB - Given the growing interest in the JVM and Microsoft's CLI as programming language implementation targets, code generation techniques for efficient stack-code are required. Compiler infrastructures such as LLVM are attractive for their highly optimizing middleend. However, LLVM's intermediate representation is register-based, and an LLVM code generator for a stack-based virtual machine needs to bridge the fundamental differences of the register and stack-based computation models. In this paper we investigate how the semantics of a register-based IR can be mapped to stack-code. We introduce a novel program representation called treegraphs. Treegraph nodes encapsulate computations that can be represented by DFS trees. Treegraph edges manifest computations with multiple uses, which is inherently incompatible with the consuming semantics of stack-based operators. Instead of saving a multiply-used value in a temporary, our method keeps all values on the stack, which avoids costly store and load instructions. Code-generation then reduces to scheduling of treegraph nodes in the most cost-effective way. We implemented a treegraph-based instruction scheduler for the LLVM compiler infrastructure. We provide experimental results from our implementation of an LLVM backend for TinyVM, which is an embedded systems virtual machine for C.

UR - http://www.scopus.com/inward/record.url?scp=82255164960&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=82255164960&partnerID=8YFLogxK

U2 - 10.1016/j.entcs.2011.11.004

DO - 10.1016/j.entcs.2011.11.004

M3 - Article

VL - 279

SP - 33

EP - 45

JO - Electronic Notes in Theoretical Computer Science

JF - Electronic Notes in Theoretical Computer Science

SN - 1571-0661

IS - 1

ER -