Back to results

McGill University

A goto-elimination method and its implementation for the McCAT C compiler /

Abstract

dc:description.abstract

In designing optimizing and parallelizing compilers, it is often simpler and more efficient to deal with programs that have structured control flow. Although most programmers naturally program in a structured fashion, there remain many important programs and benchmarks that include some number of goto statements, thus rendering the entire program unstructured. Such unstructured programs cannot be handled with compilers built with analyses and transformations for structured programs. In this thesis we present a straight-forward algorithm to structure C programs by eliminating all goto statements. The method works directly on a high-level abstract syntax tree (AST) representation of the program and could easily be integrated into any compiler that uses an AST-based intermediate representation. The actual algorithm proceeds by eliminating each goto by first applying a sequence of goto-movement transformations followed by the appropriate goto-elimination transformation. Our McCAT (McGill Compiler Architecture Testbed) optimizing/parallelizing C compiler is based on a compositional representation of the program, and hence does not support unrestricted use of gotos directly. We have implemented the method within the framework of the McCat compiler. We present some experimental results and study the cost of structuring. The results show that applying a small number of simple transformations eliminates all the goto statements, usually with a minimal effect on the execution speed. Thus, we can exploit structured representations for designing compilers, while paying a minimal penalty due to structuring.

Degree

thesis:*
Name thesis:degree_name
Master of Science
Grantor dc:publisher
McGill University
Year dc:date.issued
1995

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • Erosa, Ana Maria
Advisor dc:contributor.advisor
  • Hendren, Laurie (Supervisor)

Subjects

dc:subject × 1

Rights

dc:rights
Statement dc:rights
  • All items in eScholarship@McGill are protected by copyright with all rights reserved unless otherwise indicated.
Language dc:language.iso
en

Identifiers

dc:identifier.*
OCLC
897938049
Dc Identifier Other
hyrax:x633f2516

Chain of custody

source
Harvested from
McGill University
Base URL
mcgill.scholaris.ca/server/oai/request
Last updated
2026-11-27
Source record
OAI-PMH GetRecord
related terms
citation

Erosa, Ana Maria. A goto-elimination method and its implementation for the McCAT C compiler /. McGill University, 1995. https://doi.org/10.82308/27114