GNU Compiler Collection (GCC) Internals
This file documents the internals of the GNU compilers.
Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being “GNU General Public License” and “Funding Free Software”, the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.
Short Contents
- Introduction
- 1 Contributing to GCC Development
- 2 GCC and Portability
- 3 Interfacing to GCC Output
- 4 The GCC low-level runtime library
- 5 Language Front Ends in GCC
- 6 Source Tree Structure and Build System
- 7 Passes and Files of the Compiler
- 8 Trees: The intermediate representation used by the C and C++ front ends
- 9 Analysis and Optimization of GIMPLE Trees
- 10 RTL Representation
- 11 Control Flow Graph
- 12 Machine Descriptions
- 13 Target Description Macros and Functions
- 14 Host Configuration
- 15 Makefile Fragments
- 16
collect2 - 17 Standard Header File Directories
- 18 Memory Management and Type Information
- Funding Free Software
- The GNU Project and GNU/Linux
- GNU GENERAL PUBLIC LICENSE
- GNU Free Documentation License
- Contributors to GCC
- Option Index
- Concept Index
Table of Contents
- Introduction 1 Contributing to GCC Development 2 GCC and Portability 3 Interfacing to GCC Output 4 The GCC low-level runtime library 4.1 Routines for integer arithmetic 4.1.1 Arithmetic functions 4.1.2 Comparison functions 4.1.3 Trapping arithmetic functions 4.1.4 Bit operations
4.2 Routines for floating point emulation
4.3 Language-independent routines for exception handling
4.4 Miscellaneous runtime library routines
5 Language Front Ends in GCC
6 Source Tree Structure and Build System
- 6.1 Configure Terms and History 6.2 Top Level Source Directory 6.3 The gcc Subdirectory 6.3.1 Subdirectories of gcc 6.3.2 Configuration in the gcc Directory 6.3.2.1 Scripts Used by configure 6.3.2.2 The config.build; config.host; and config.gcc Files 6.3.2.3 Files Created by
configure
6.3.3 Build System in the gcc Directory
6.3.5 Library Source Files and Headers under the gcc Directory
6.3.6 Headers Installed by GCC
6.3.8 Anatomy of a Language Front End
6.3.9 Anatomy of a Target Back End
- 6.4.1 Idioms Used in Testsuite Code 6.4.2 Directives used within DejaGnu tests 6.4.3 Ada Language Testsuites 6.4.4 C Language Testsuites 6.4.5 The Java library testsuites. 6.4.6 Support for testing gcov 6.4.7 Support for testing profile-directed optimizations 6.4.8 Support for testing binary compatibility
7 Passes and Files of the Compiler
8 Trees: The intermediate representation used by the C and C++ front ends
9 Analysis and Optimization of GIMPLE Trees
- 9.1 GENERIC 9.2 GIMPLE 9.2.1 Interfaces 9.2.2 Temporaries 9.2.3 Expressions 9.2.3.1 Compound Expressions 9.2.3.2 Compound Lvalues 9.2.3.3 Conditional Expressions 9.2.3.4 Logical Operators
- 9.2.4.1 Blocks 9.2.4.2 Statement Sequences 9.2.4.3 Empty Statements 9.2.4.4 Loops 9.2.4.5 Selection Statements 9.2.4.6 Jumps 9.2.4.7 Cleanups 9.2.4.8 Exception Handling
- 9.5.1 Preserving the SSA form 9.5.2 Examining
SSA_NAMEnodes 9.5.3 Walking use-def chains 9.5.4 Walking the dominator tree
10 RTL Representation
- 10.1 RTL Object Types 10.2 RTL Classes and Formats 10.3 Access to Operands 10.4 Access to Special Operands 10.5 Flags in an RTL Expression 10.6 Machine Modes 10.7 Constant Expression Types 10.8 Registers and Memory 10.9 RTL Expressions for Arithmetic 10.10 Comparison Operations 10.11 Bit-Fields 10.12 Vector Operations 10.13 Conversions 10.14 Declarations 10.15 Side Effect Expressions 10.16 Embedded Side-Effects on Addresses 10.17 Assembler Instructions as Expressions 10.18 Insns 10.19 RTL Representation of Function-Call Insns 10.20 Structure Sharing Assumptions 10.21 Reading RTL
11 Control Flow Graph
- 11.1 Basic Blocks 11.2 Edges 11.3 Profile information 11.4 Maintaining the CFG 11.5 Liveness information
12 Machine Descriptions
- 12.1 Overview of How the Machine Description is Used 12.2 Everything about Instruction Patterns 12.3 Example of
define_insn12.4 RTL Template 12.5 Output Templates and Operand Substitution 12.6 C Statements for Assembler Output 12.7 Predicates 12.7.1 Machine-Independent Predicates 12.7.2 Defining Machine-Specific Predicates
- 12.8.1 Simple Constraints 12.8.2 Multiple Alternative Constraints 12.8.3 Register Class Preferences 12.8.4 Constraint Modifier Characters 12.8.5 Constraints for Particular Machines
12.9 Standard Pattern Names For Generation
12.10 When the Order of Patterns Matters
12.11 Interdependence of Patterns
12.12 Defining Jump Instruction Patterns
12.13 Defining Looping Instruction Patterns
12.14 Canonicalization of Instructions
12.15 Defining RTL Sequences for Code Generation
12.16 Defining How to Split Instructions
12.17 Including Patterns in Machine Descriptions.
12.18 Machine-Specific Peephole Optimizers
- 12.19.1 Defining Attributes and their Values 12.19.2 Attribute Expressions 12.19.3 Assigning Attribute Values to Insns 12.19.4 Example of Attribute Specifications 12.19.5 Computing the Length of an Insn 12.19.6 Constant Attributes 12.19.7 Delay Slot Scheduling 12.19.8 Specifying processor pipeline description
- 12.22.1 Mode Macros 12.22.1.1 Defining Mode Macros 12.22.1.2 String Substitution in Mode Macros 12.22.1.3 Mode Macro Examples
13 Target Description Macros and Functions
- 13.1 The Global
targetmVariable 13.2 Controlling the Compilation Driver, gcc 13.3 Run-time Target Specification 13.4 Defining data structures for per-function information. 13.5 Storage Layout 13.6 Layout of Source Language Data Types 13.7 Register Usage 13.7.1 Basic Characteristics of Registers 13.7.2 Order of Allocation of Registers 13.7.3 How Values Fit in Registers 13.7.4 Handling Leaf Functions 13.7.5 Registers That Form a Stack
13.9 Stack Layout and Calling Conventions
- 13.9.1 Basic Stack Layout 13.9.2 Exception Handling Support 13.9.3 Specifying How Stack Checking is Done 13.9.4 Registers That Address the Stack Frame 13.9.5 Eliminating Frame Pointer and Arg Pointer 13.9.6 Passing Function Arguments on the Stack 13.9.7 Passing Arguments in Registers 13.9.8 How Scalar Function Values Are Returned 13.9.9 How Large Values Are Returned 13.9.10 Caller-Saves Register Allocation 13.9.11 Function Entry and Exit 13.9.12 Generating Code for Profiling 13.9.13 Permitting tail calls
13.10 Implementing the Varargs Macros
13.11 Trampolines for Nested Functions
13.12 Implicit Calls to Library Routines
13.15 Describing Relative Costs of Operations
13.16 Adjusting the Instruction Scheduler
13.17 Dividing the Output into Sections (Texts, Data, ...)
13.18 Position Independent Code
13.19 Defining the Output Assembler Language
- 13.19.1 The Overall Framework of an Assembler File 13.19.2 Output of Data 13.19.3 Output of Uninitialized Variables 13.19.4 Output and Generation of Labels 13.19.5 How Initialization Functions Are Handled 13.19.6 Macros Controlling Initialization Routines 13.19.7 Output of Assembler Instructions 13.19.8 Output of Dispatch Tables 13.19.9 Assembler Commands for Exception Regions 13.19.10 Assembler Commands for Alignment
13.20 Controlling Debugging Information Format
- 13.20.1 Macros Affecting All Debugging Formats 13.20.2 Specific Options for DBX Output 13.20.3 Open-Ended Hooks for DBX Format 13.20.4 File Names in DBX Format 13.20.5 Macros for SDB and DWARF Output 13.20.6 Macros for VMS Debug Format
13.21 Cross Compilation and Floating Point
13.22 Mode Switching Instructions
13.23 Defining target-specific uses of attribute
13.24 Defining coprocessor specifics for MIPS targets.
13.25 Parameters for Precompiled Header Validity Checking
13.27 Miscellaneous Parameters
14 Host Configuration
15 Makefile Fragments
16 collect2
17 Standard Header File Directories
18 Memory Management and Type Information
- 18.1 The Inside of a
GTY(())18.2 Marking Roots for the Garbage Collector 18.3 Source Files Containing Type Information
Funding Free Software
The GNU Project and GNU/Linux
GNU GENERAL PUBLIC LICENSE
GNU Free Documentation License
Contributors to GCC
Option Index
Concept Index
Next: Contributing, Up: (DIR)
Introduction
This manual documents the internals of the GNU compilers, including how to port them to new targets and some information about how to write front ends for new languages. It corresponds to GCC version 4.0.1. The use of the GNU compilers is documented in a separate manual. See Introduction.
This manual is mainly a reference manual rather than a tutorial. It discusses how to contribute to GCC (see Contributing), the characteristics of the machines supported by GCC as hosts and targets (see Portability), how GCC relates to the ABIs on such systems (see Interface), and the characteristics of the languages for which GCC front ends are written (see Languages). It then describes the GCC source tree structure and build system, some of the interfaces to GCC front ends, and how support for a target system is implemented in GCC.
Additional tutorial information is linked to from http://gcc.gnu.org/readings.html.