Proceedings of the GCC Developers’ Summit

June 17th–19th, 2008 Ottawa, Ontario Canada

Contents

Enabling dynamic selection of optimal optimization passes in GCC 7 Grigori Fursin

Using GCC Instead of Grep and Sed 9 Taras Glek

Middle-End Array Expressions 11 Richard Guenther

Adding Coding Rule Checking Capabilities to the GCC Toolchain 13 Guillem Marpons

Improving the precision of GCCs debug information 15 Michael Matz

Towards an implementation of Co-Array Fortran 17 Toon Moene

Exploiting front end knowledge to effortlessly create Python modules 19 Gaius Mulley

A Plan to Fix Local Variable Debug Information in GCC 21 Alexandre Oliva

Improving GCC Infrastructure for Streamization 23 Sebastian Pop

Feedback Directed Optimization using Synthetic Edge Profiles from Hardware Event Sampling 25 Vinodha Ramasamy

A Superoptimizer Analysis of Multiway Branch Code Generation 27 Roger Anthony Sayle Non-stop Multi-Threaded Debugging in GDB 29 Nathan Sidwell

A New ELF Linker 31 Ian Lance Taylor

Incremental Compilation for GCC 33 Tom Tromey Conference Organizers

Andrew J. Hutton, Steamballoon, Inc., Symposium, Thin Lines Mountaineering C. Craig Ross, Linux Symposium

Review Committee

Andrew J. Hutton, Steamballoon, Inc., Linux Symposium, Thin Lines Mountaineering Ben Elliston, IBM Janis Johnson, IBM Mark Mitchell, CodeSourcery Toshi Morita Diego Novillo, Google Gerald Pfeifer, Novell Ian Lance Taylor, Google C. Craig Ross, Linux Symposium

Proceedings Formatting Team John W. Lockhart, , Inc. Authors retain copyright to all submitted papers, but have granted unlimited redistribution rights to all as a condition of submission. Enabling dynamic selection of optimal optimization passes in GCC

Grigori Fursin Your affiliation [email protected]

Abstract

• 7 • 8 • Enabling dynamic selection of optimal optimization passes in GCC Using GCC Instead of Grep and Sed

Taras Glek Your affiliation [email protected]

Abstract

• 9 • 10 • Using GCC Instead of Grep and Sed Middle-End Array Expressions

Richard Guenther Your affiliation [email protected]

Abstract

We are implementing support for array objects as first- class citizens of the tree middle-end. This allows to retain expressions that operate on array objects, such as allowed by the Fortran 9x language, to survive until the high-level loop transformation passes. Those bene- fit from the lesser work on loop and dependence analy- sis. Lowering those expressions leveraging work done by the GRAPHITE project allows to do a better job of what is currently done by the frontend and allows faster code to be generated.

As a design and implementation proposal we expect this to be a medium term project as for utilization it requires modifications of the Fortran frontend as well as merg- ing GRAPHITE and/or fallback lowering code in the middle-end to handle all expressions on array objects as allowed by the Fortran standard.

We also present a proposal for a GCC extension to allow utilizing the new facility from C and C++ using VLA types and builtin functions.

• 11 • 12 • Middle-End Array Expressions Adding Coding Rule Checking Capabilities to the GCC Toolchain

Guillem Marpons Your affiliation [email protected]

Abstract

• 13 • 14 • Adding Coding Rule Checking Capabilities to the GCC Toolchain Improving the precision of GCCs debug information

Michael Matz Your affiliation [email protected]

Abstract

• 15 • 16 • Improving the precision of GCCs debug information Towards an implementation of Co-Array Fortran

Toon Moene Your affiliation [email protected]

Abstract

Co-array Fortran is an extension of Fortran having been defined around a decade ago to allow for asyn- chronous parallel programming within the Fortran lan- guage, as opposed to methods outside the language (via the OpenMP standard and the MPI library). It will be part of the upcoming Fortran 2008 Standard.

As the description by one of its authors mentions:

"A Fortran program containing co-arrays is interpreted as if it were replicated a fixed number of times and all copies were executed asynchronously. Each copy has its own set of data objects and is called an image. The ar- ray syntax of Fortran is extended with additional trailing subscripts in square brackets to give a clear and straight- forward representation of access to data on other im- ages."

The presentation will describe the changes in the parser, intermediate representation and run-time library of GNU Fortran necessary to implement co-array Fortran. In addition, it necessarily will discuss various paradigms in parallel computing.

• 17 • 18 • Towards an implementation of Co-Array Fortran Exploiting front end knowledge to effortlessly create Python modules

Gaius Mulley

gaius@.org

Abstract

This paper presents the techniques used in GNU Modula-2 to automatically generate swig header files from definition and implementation modules. The swig interface files allow any swig supported scripting lan- guage to interface to an implementation module com- piled as a shared library. The advantage with this tech- nique is that most of the information necessary to con- struct these swig interface files is already known by the front end compiler. The compiler works out whether parameters are in, out or inout by examining their us- age in the initial basic-block of each procedure. It also translates globally exported simple typed variables, enu- meration types and allows exceptions to be thrown and caught by the library and scripting language respec- tively.

This technique has been coupled with the automatic cre- ation of shared libraries, initialisation and finalisation sections and dependency linking. Thus it allows users to recompile legacy code as a series of shared libraries and present them as a set of Python, Perl or TCL mod- ules by including some additional flags on the compiler command line.

• 19 • 20 • Exploiting front end knowledge to effortlessly create Python modules A Plan to Fix Local Variable Debug Information in GCC

Alexandre Oliva Your affiliation [email protected]

Abstract

• 21 • 22 • A Plan to Fix Local Variable Debug Information in GCC Improving GCC Infrastructure for Streamization

Sebastian Pop Your affiliation [email protected]

Abstract

GCC needs a strategy to support future multicore ar- chitectures, which will certainly include heterogeneous accelerator-like designs with explicit management of scratchpad memories; some have further restrictions, for example SIMD, with limited synchronisation capabili- ties. Meanwhile, we also anticipate that some platforms will offer hardware support for streaming, transactions and speculation.

The purpose of this paper is to give a survey and eval- uation of some automatic and manual techniques for improving support for such targets in GCC. We focus on translation of sequential code for such platforms i.e. the translation to vector operations and to task graphs and their communication and memory access opera- tions. We conclude with recommendations for strategic development of the compiler to meet these challenges.

Authors: Harsha Jagasia, Paul H J Kelly, Razya Ladel- sky, Antoniu Pop, Sebastian Pop, Jan Sjodin

• 23 • 24 • Improving GCC Infrastructure for Streamization Feedback Directed Optimization using Synthetic Edge Profiles from Hardware Event Sampling

Vinodha Ramasamy Your affiliation [email protected]

Abstract

• 25 • 26 • Feedback Directed Optimization using Synthetic Edge Profiles from Hardware Event Sampling A Superoptimizer Analysis of Multiway Branch Code Generation

Roger Anthony Sayle Your affiliation [email protected]

Abstract

Code Generation

The high-level of abstraction of the multiway branch, exemplified by C/C++’s switch statement, Pascal/Ada’s case and FORTRAN’s computed GOTO, allows a com- piler a large degree of freedom in its implementation. Typically compilers generate code selected from a few common patterns, such as jump tables and/or trees of conditional branches. However, for most switch state- ments there exists a vast number of possible implemen- tations.

To assess the relative merits of these alternatives, and evaluate the selection strategies used by different com- pilers, a switch-statement "superoptimizer" has been de- veloped. This exhaustively enumerates code sequences implementing a specified multiway branch. Each se- quence is evaluated against a simple cost model for code-size, average and worst-case performance (option- ally using profile information). Backend timings for several architectures are parameterized by microbench- marking. The results and insights from applying this su- peroptimizer to a corpus of "real-world" examples will be discussed.

• 27 • 28 • A Superoptimizer Analysis of Multiway Branch Code Generation Non-stop Multi-Threaded Debugging in GDB

Nathan Sidwell Your affiliation [email protected]

Abstract

When debugging a multi-threaded program, should a debugger stop all threads when any thread stops, or should it stop only those threads that have something to report, like a breakpoint hit? When debugging a live system, the latter approach may be less intrusive, as threads other than those under inspection can continue to respond to external events. We have implemented this behavior, which we call non-stop debugging, in the GNU Debugger, GDB. We have adapted GDB’s control commands, strengthened GDB’s event loop, extended GDB’s remote protocol, and implemented new tech- niques for inserting, removing, and stepping past break- points.

This project lifts long-standing restrictions in GDB’s thread support, using a number of interesting tech- niques. It opens a way to supporting multi-process and multi-core debugging.

• 29 • 30 • Non-stop Multi-Threaded Debugging in GDB A New ELF Linker

Ian Lance Taylor Your affiliation [email protected]

Abstract

• 31 • 32 • A New ELF Linker Incremental Compilation for GCC

Tom Tromey Your affiliation [email protected]

Abstract

• 33 • 34 • Incremental Compilation for GCC