logo资料库

gcc internal.pdf

第1页 / 共734页
第2页 / 共734页
第3页 / 共734页
第4页 / 共734页
第5页 / 共734页
第6页 / 共734页
第7页 / 共734页
第8页 / 共734页
资料共734页,剩余部分请下载后查看
Introduction
Contributing to GCC Development
GCC and Portability
Interfacing to GCC Output
The GCC low-level runtime library
Routines for integer arithmetic
Arithmetic functions
Comparison functions
Trapping arithmetic functions
Bit operations
Routines for floating point emulation
Arithmetic functions
Conversion functions
Comparison functions
Other floating-point functions
Routines for decimal floating point emulation
Arithmetic functions
Conversion functions
Comparison functions
Routines for fixed-point fractional emulation
Arithmetic functions
Comparison functions
Conversion functions
Language-independent routines for exception handling
Miscellaneous runtime library routines
Cache control functions
Split stack functions and variables
Language Front Ends in GCC
Source Tree Structure and Build System
Configure Terms and History
Top Level Source Directory
The gcc Subdirectory
Subdirectories of gcc
Configuration in the gcc Directory
Scripts Used by configure
The config.build; config.host; and config.gcc Files
Files Created by configure
Build System in the gcc Directory
Makefile Targets
Library Source Files and Headers under the gcc Directory
Headers Installed by GCC
Building Documentation
Texinfo Manuals
Man Page Generation
Miscellaneous Documentation
Anatomy of a Language Front End
The Front End language Directory
The Front End config-lang.in File
The Front End Make-lang.in File
Anatomy of a Target Back End
Testsuites
Idioms Used in Testsuite Code
Directives used within DejaGnu tests
Syntax and Descriptions of test directives
Specify how to build the test
Specify additional compiler options
Modify the test timeout value
Skip a test for some targets
Expect a test to fail for some targets
Expect the test executable to fail
Verify compiler messages
Verify output of the test executable
Specify additional files for a test
Add checks at the end of a test
Selecting targets to which a test applies
Keywords describing target attributes
Data type sizes
Fortran-specific attributes
Vector-specific attributes
Thread Local Storage attributes
Decimal floating point attributes
ARM-specific attributes
MIPS-specific attributes
PowerPC-specific attributes
Other hardware attributes
Environment attributes
Other attributes
Local to tests in gcc.target/i386
Local to tests in gcc.target/spu/ea
Local to tests in gcc.test-framework
Features for dg-add-options
Variants of dg-require-support
Commands for use in dg-final
Scan a particular file
Scan the assembly output
Scan optimization dump files
Verify that an output files exists or not
Check for LTO tests
Checks for gcov tests
Clean up generated test files
Ada Language Testsuites
C Language Testsuites
The Java library testsuites.
Support for testing link-time optimizations
Support for testing gcov
Support for testing profile-directed optimizations
Support for testing binary compatibility
Support for torture testing using multiple options
Option specification files
Option file format
Option properties
Passes and Files of the Compiler
Parsing pass
Cilk Plus Transformation
Gimplification pass
Pass manager
Tree SSA passes
RTL passes
RTL Representation
RTL Object Types
RTL Classes and Formats
Access to Operands
Access to Special Operands
Flags in an RTL Expression
Machine Modes
Constant Expression Types
Registers and Memory
RTL Expressions for Arithmetic
Comparison Operations
Bit-Fields
Vector Operations
Conversions
Declarations
Side Effect Expressions
Embedded Side-Effects on Addresses
Assembler Instructions as Expressions
Variable Location Debug Information in RTL
Insns
RTL Representation of Function-Call Insns
Structure Sharing Assumptions
Reading RTL
GENERIC
Deficiencies
Overview
Trees
Identifiers
Containers
Types
Declarations
Working with declarations
Internal structure
Current structure hierarchy
Adding new DECL node types
Attributes in trees
Expressions
Constant expressions
References to storage
Unary and Binary Expressions
Vectors
Statements
Basic Statements
Blocks
Statement Sequences
Empty Statements
Jumps
Cleanups
OpenMP
Functions
Function Basics
Function Properties
Language-dependent trees
C and C++ Trees
Types for C++
Namespaces
Classes
Functions for C++
Statements for C++
Statements
C++ Expressions
Java Trees
GIMPLE
Tuple representation
gimple_statement_base (gsbase)
gimple_statement_with_ops
gimple_statement_with_memory_ops
GIMPLE instruction set
Exception Handling
Temporaries
Operands
Compound Expressions
Compound Lvalues
Conditional Expressions
Logical Operators
Manipulating operands
Operand vector allocation
Operand validation
Statement validation
Manipulating GIMPLE statements
Common accessors
Tuple specific accessors
GIMPLE_ASM
GIMPLE_ASSIGN
GIMPLE_BIND
GIMPLE_CALL
GIMPLE_CATCH
GIMPLE_COND
GIMPLE_DEBUG
GIMPLE_EH_FILTER
GIMPLE_LABEL
GIMPLE_NOP
GIMPLE_OMP_ATOMIC_LOAD
GIMPLE_OMP_ATOMIC_STORE
GIMPLE_OMP_CONTINUE
GIMPLE_OMP_CRITICAL
GIMPLE_OMP_FOR
GIMPLE_OMP_MASTER
GIMPLE_OMP_ORDERED
GIMPLE_OMP_PARALLEL
GIMPLE_OMP_RETURN
GIMPLE_OMP_SECTION
GIMPLE_OMP_SECTIONS
GIMPLE_OMP_SINGLE
GIMPLE_PHI
GIMPLE_RESX
GIMPLE_RETURN
GIMPLE_SWITCH
GIMPLE_TRY
GIMPLE_WITH_CLEANUP_EXPR
GIMPLE sequences
Sequence iterators
Adding a new GIMPLE statement code
Statement and operand traversals
Analysis and Optimization of GIMPLE tuples
Annotations
SSA Operands
Operand Iterators And Access Routines
Immediate Uses
Static Single Assignment
Preserving the SSA form
Preserving the virtual SSA form
Examining SSA_NAME nodes
Walking the dominator tree
Alias analysis
Memory model
Analysis and Representation of Loops
Loop representation
Loop querying
Loop manipulation
Loop-closed SSA form
Scalar evolutions
IV analysis on RTL
Number of iterations analysis
Data Dependency Analysis
Linear loop transformations framework
Omega a solver for linear programming problems
Control Flow Graph
Basic Blocks
Edges
Profile information
Maintaining the CFG
Liveness information
Machine Descriptions
Overview of How the Machine Description is Used
Everything about Instruction Patterns
Example of define_insn
RTL Template
Output Templates and Operand Substitution
C Statements for Assembler Output
Predicates
Machine-Independent Predicates
Defining Machine-Specific Predicates
Operand Constraints
Simple Constraints
Multiple Alternative Constraints
Register Class Preferences
Constraint Modifier Characters
Constraints for Particular Machines
Disable insn alternatives using the enabled attribute
Defining Machine-Specific Constraints
Testing constraints from C
Standard Pattern Names For Generation
When the Order of Patterns Matters
Interdependence of Patterns
Defining Jump Instruction Patterns
Defining Looping Instruction Patterns
Canonicalization of Instructions
Defining RTL Sequences for Code Generation
Defining How to Split Instructions
Including Patterns in Machine Descriptions.
RTL Generation Tool Options for Directory Search
Machine-Specific Peephole Optimizers
RTL to Text Peephole Optimizers
RTL to RTL Peephole Optimizers
Instruction Attributes
Defining Attributes and their Values
Attribute Expressions
Assigning Attribute Values to Insns
Example of Attribute Specifications
Computing the Length of an Insn
Constant Attributes
Mnemonic Attribute
Delay Slot Scheduling
Specifying processor pipeline description
Conditional Execution
RTL Templates Transformations
define_subst Example
Pattern Matching in define_subst
Generation of output template in define_subst
Constant Definitions
Iterators
Mode Iterators
Defining Mode Iterators
Substitution in Mode Iterators
Mode Iterator Examples
Code Iterators
Int Iterators
Subst Iterators
Target Description Macros and Functions
The Global targetm Variable
Controlling the Compilation Driver, gcc
Run-time Target Specification
Defining data structures for per-function information.
Storage Layout
Layout of Source Language Data Types
Register Usage
Basic Characteristics of Registers
Order of Allocation of Registers
How Values Fit in Registers
Handling Leaf Functions
Registers That Form a Stack
Register Classes
Obsolete Macros for Defining Constraints
Stack Layout and Calling Conventions
Basic Stack Layout
Exception Handling Support
Specifying How Stack Checking is Done
Registers That Address the Stack Frame
Eliminating Frame Pointer and Arg Pointer
Passing Function Arguments on the Stack
Passing Arguments in Registers
How Scalar Function Values Are Returned
How Large Values Are Returned
Caller-Saves Register Allocation
Function Entry and Exit
Generating Code for Profiling
Permitting tail calls
Stack smashing protection
Implementing the Varargs Macros
Trampolines for Nested Functions
Implicit Calls to Library Routines
Addressing Modes
Anchored Addresses
Condition Code Status
Representation of condition codes using (cc0)
Representation of condition codes using registers
Describing Relative Costs of Operations
Adjusting the Instruction Scheduler
Dividing the Output into Sections (Texts, Data, ...{})
Position Independent Code
Defining the Output Assembler Language
The Overall Framework of an Assembler File
Output of Data
Output of Uninitialized Variables
Output and Generation of Labels
How Initialization Functions Are Handled
Macros Controlling Initialization Routines
Output of Assembler Instructions
Output of Dispatch Tables
Assembler Commands for Exception Regions
Assembler Commands for Alignment
Controlling Debugging Information Format
Macros Affecting All Debugging Formats
Specific Options for DBX Output
Open-Ended Hooks for DBX Format
File Names in DBX Format
Macros for SDB and DWARF Output
Macros for VMS Debug Format
Cross Compilation and Floating Point
Mode Switching Instructions
Defining target-specific uses of __attribute__
Emulating TLS
Defining coprocessor specifics for MIPS targets.
Parameters for Precompiled Header Validity Checking
C++ ABI parameters
Adding support for named address spaces
Miscellaneous Parameters
Host Configuration
Host Common
Host Filesystem
Host Misc
Makefile Fragments
Target Makefile Fragments
Host Makefile Fragments
collect2
Standard Header File Directories
Memory Management and Type Information
The Inside of a GTY(())
Support for inheritance
Support for user-provided GC marking routines
User-provided marking routines for template types
Marking Roots for the Garbage Collector
Source Files Containing Type Information
How to invoke the garbage collector
Troubleshooting the garbage collector
Plugins
Loading Plugins
Plugin API
Plugin license check
Plugin initialization
Plugin callbacks
Interacting with the pass manager
Interacting with the GCC Garbage Collector
Giving information about a plugin
Registering custom attributes or pragmas
Recording information about pass execution
Controlling which passes are being run
Keeping track of available passes
Building GCC plugins
Link Time Optimization
Design Overview
LTO modes of operation
LTO file sections
Using summary information in IPA passes
Virtual clones
IPA references
Jump functions
Whole program assumptions, linker plugin and symbol visibilities
Internal flags controlling lto1
Funding Free Software
The GNU Project and GNU/Linux
GNU General Public License
GNU Free Documentation License
ADDENDUM: How to use this License for your documents
Contributors to GCC
Option Index
Concept Index
GNU Compiler Collection Internals For gcc version 4.9.0 (pre-release) (GCC) Richard M. Stallman and the GCC Developer Community
Copyright c 1988-2013 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.3 or any later version published by the Free Software Foundation; with the Invariant Sections being “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.
i Short Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Contributing to GCC Development . . . . . . . . . . . . . . . . . . . . . . . 3 1 2 GCC and Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Interfacing to GCC Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 The GCC low-level runtime library . . . . . . . . . . . . . . . . . . . . . . . 9 4 Language Front Ends in GCC . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5 Source Tree Structure and Build System. . . . . . . . . . . . . . . . . . 61 6 Testsuites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7 8 Option specification files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Passes and Files of the Compiler . . . . . . . . . . . . . . . . . . . . . . . 113 9 10 RTL Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 11 GENERIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 12 GIMPLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 13 Analysis and Optimization of GIMPLE tuples . . . . . . . . . . . . 263 14 Analysis and Representation of Loops . . . . . . . . . . . . . . . . . . . 275 15 Control Flow Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 16 Machine Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 17 Target Description Macros and Functions . . . . . . . . . . . . . . . . 419 18 Host Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 19 Makefile Fragments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 20 collect2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 21 Standard Header File Directories . . . . . . . . . . . . . . . . . . . . . . . 601 22 Memory Management and Type Information . . . . . . . . . . . . . 603 23 Plugins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 24 Link Time Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 Funding Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 The GNU Project and GNU/Linux. . . . . . . . . . . . . . . . . . . . . . . . . 633 GNU General Public License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . 647 Contributors to GCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655 Option Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
iii Table of Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 Contributing to GCC Development . . . . . . . . . . . 3 2 GCC and Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 Interfacing to GCC Output . . . . . . . . . . . . . . . . . . . . 7 4 The GCC low-level runtime library . . . . . . . . . . . 9 4.1 Routines for integer arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.1.1 Arithmetic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.1.2 Comparison functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.1.3 Trapping arithmetic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1.4 Bit operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.2 Routines for floating point emulation . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.2.1 Arithmetic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.2.2 Conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.2.3 Comparison functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.2.4 Other floating-point functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.3 Routines for decimal floating point emulation . . . . . . . . . . . . . . . . . . 16 4.3.1 Arithmetic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.3.2 Conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.3.3 Comparison functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.4 Routines for fixed-point fractional emulation . . . . . . . . . . . . . . . . . . . 22 4.4.1 Arithmetic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.4.2 Comparison functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.4.3 Conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.5 Language-independent routines for exception handling . . . . . . . . . 56 4.6 Miscellaneous runtime library routines . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.6.1 Cache control functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.6.2 Split stack functions and variables . . . . . . . . . . . . . . . . . . . . . . . . 57 5 Language Front Ends in GCC . . . . . . . . . . . . . . . . 59 6 Source Tree Structure and Build System . . . . 61 6.1 Configure Terms and History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.2 Top Level Source Directory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.3 The ‘gcc’ Subdirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.3.1 Subdirectories of ‘gcc’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.3.2 Configuration in the ‘gcc’ Directory . . . . . . . . . . . . . . . . . . . . . . 64 6.3.2.1 Scripts Used by ‘configure’ . . . . . . . . . . . . . . . . . . . . . . . . . 64
iv GNU Compiler Collection (GCC) Internals 6.3.2.2 The ‘config.build’; ‘config.host’; and ‘config.gcc’ Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6.3.2.3 Files Created by configure . . . . . . . . . . . . . . . . . . . . . . . . . 65 6.3.3 Build System in the ‘gcc’ Directory . . . . . . . . . . . . . . . . . . . . . . 66 6.3.4 Makefile Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 6.3.5 Library Source Files and Headers under the ‘gcc’ Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 6.3.6 Headers Installed by GCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 6.3.7 Building Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 6.3.7.1 Texinfo Manuals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 6.3.7.2 Man Page Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 6.3.7.3 Miscellaneous Documentation. . . . . . . . . . . . . . . . . . . . . . . . 71 6.3.8 Anatomy of a Language Front End . . . . . . . . . . . . . . . . . . . . . . . 71 6.3.8.1 The Front End ‘language’ Directory . . . . . . . . . . . . . . . . . 72 6.3.8.2 The Front End ‘config-lang.in’ File . . . . . . . . . . . . . . . 73 6.3.8.3 The Front End ‘Make-lang.in’ File . . . . . . . . . . . . . . . . . 74 6.3.9 Anatomy of a Target Back End . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 7 Testsuites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7.1 Idioms Used in Testsuite Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7.2 Directives used within DejaGnu tests . . . . . . . . . . . . . . . . . . . . . . . . . . 78 7.2.1 Syntax and Descriptions of test directives . . . . . . . . . . . . . . . . . 78 7.2.1.1 Specify how to build the test . . . . . . . . . . . . . . . . . . . . . . . . 78 7.2.1.2 Specify additional compiler options . . . . . . . . . . . . . . . . . . 79 7.2.1.3 Modify the test timeout value . . . . . . . . . . . . . . . . . . . . . . . 79 7.2.1.4 Skip a test for some targets . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.2.1.5 Expect a test to fail for some targets. . . . . . . . . . . . . . . . . 80 7.2.1.6 Expect the test executable to fail . . . . . . . . . . . . . . . . . . . . 80 7.2.1.7 Verify compiler messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 7.2.1.8 Verify output of the test executable . . . . . . . . . . . . . . . . . . 81 7.2.1.9 Specify additional files for a test . . . . . . . . . . . . . . . . . . . . . 81 7.2.1.10 Add checks at the end of a test . . . . . . . . . . . . . . . . . . . . . 81 7.2.2 Selecting targets to which a test applies . . . . . . . . . . . . . . . . . . 82 7.2.3 Keywords describing target attributes . . . . . . . . . . . . . . . . . . . . 82 7.2.3.1 Data type sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 7.2.3.2 Fortran-specific attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 7.2.3.3 Vector-specific attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 7.2.3.4 Thread Local Storage attributes . . . . . . . . . . . . . . . . . . . . . 85 7.2.3.5 Decimal floating point attributes. . . . . . . . . . . . . . . . . . . . . 85 7.2.3.6 ARM-specific attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 7.2.3.7 MIPS-specific attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.2.3.8 PowerPC-specific attributes. . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.2.3.9 Other hardware attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7.2.3.10 Environment attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7.2.3.11 Other attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.2.3.12 Local to tests in gcc.target/i386 . . . . . . . . . . . . . . . . . 91 7.2.3.13 Local to tests in gcc.target/spu/ea . . . . . . . . . . . . . . . 92 7.2.3.14 Local to tests in gcc.test-framework . . . . . . . . . . . . . . 92
v 7.2.4 Features for dg-add-options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.2.5 Variants of dg-require-support . . . . . . . . . . . . . . . . . . . . . . . . . 93 7.2.6 Commands for use in dg-final. . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.2.6.1 Scan a particular file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.2.6.2 Scan the assembly output . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.2.6.3 Scan optimization dump files . . . . . . . . . . . . . . . . . . . . . . . . 94 7.2.6.4 Verify that an output files exists or not . . . . . . . . . . . . . . 95 7.2.6.5 Check for LTO tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7.2.6.6 Checks for gcov tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7.2.6.7 Clean up generated test files . . . . . . . . . . . . . . . . . . . . . . . . . 95 7.3 Ada Language Testsuites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 7.4 C Language Testsuites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 7.5 The Java library testsuites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7.6 Support for testing link-time optimizations . . . . . . . . . . . . . . . . . . . . 99 7.7 Support for testing gcov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 7.8 Support for testing profile-directed optimizations . . . . . . . . . . . . . 100 7.9 Support for testing binary compatibility . . . . . . . . . . . . . . . . . . . . . . 101 7.10 Support for torture testing using multiple options . . . . . . . . . . . 102 8 Option specification files . . . . . . . . . . . . . . . . . . . . . 105 8.1 Option file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 8.2 Option properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 9 Passes and Files of the Compiler . . . . . . . . . . . 113 9.1 Parsing pass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 9.2 Cilk Plus Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 9.3 Gimplification pass. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 9.4 Pass manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 9.5 Tree SSA passes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 9.6 RTL passes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 10 RTL Representation . . . . . . . . . . . . . . . . . . . . . . . . 127 10.1 RTL Object Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 10.2 RTL Classes and Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 10.3 Access to Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 10.4 Access to Special Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 10.5 Flags in an RTL Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 10.6 Machine Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 10.7 Constant Expression Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 10.8 Registers and Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 10.9 RTL Expressions for Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 10.10 Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 10.11 Bit-Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 10.12 Vector Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 10.13 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 10.14 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 10.15 Side Effect Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
vi GNU Compiler Collection (GCC) Internals 10.16 Embedded Side-Effects on Addresses . . . . . . . . . . . . . . . . . . . . . . . 167 10.17 Assembler Instructions as Expressions . . . . . . . . . . . . . . . . . . . . . . 168 10.18 Variable Location Debug Information in RTL . . . . . . . . . . . . . . 168 10.19 Insns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 10.20 RTL Representation of Function-Call Insns . . . . . . . . . . . . . . . . . 177 10.21 Structure Sharing Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 10.22 Reading RTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 11 GENERIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 11.1 Deficiencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 11.2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 11.2.1 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 11.2.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 11.2.3 Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 11.3 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 11.4 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 11.4.1 Working with declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 11.4.2 Internal structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 11.4.2.1 Current structure hierarchy . . . . . . . . . . . . . . . . . . . . . . . 190 11.4.2.2 Adding new DECL node types . . . . . . . . . . . . . . . . . . . . 191 11.5 Attributes in trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 11.6 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 11.6.1 Constant expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 11.6.2 References to storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 11.6.3 Unary and Binary Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 196 11.6.4 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 11.7 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 11.7.1 Basic Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 11.7.2 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 11.7.3 Statement Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 11.7.4 Empty Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 11.7.5 Jumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 11.7.6 Cleanups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 11.7.7 OpenMP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 11.8 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 11.8.1 Function Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 11.8.2 Function Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 11.9 Language-dependent trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 11.10 C and C++ Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 11.10.1 Types for C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 11.10.2 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 11.10.3 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 11.10.4 Functions for C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 11.10.5 Statements for C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 11.10.5.1 Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 11.10.6 C++ Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 11.11 Java Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
分享到:
收藏