ANSI C optimizing compiler user guide
October 1992
INMOS document number: 72-TDS-348-01
60 Pages
© INMOS Limited 1992.
About this manual
This manual is the ANSI C Optimizing Compiler User Guide to the ANSI C toolset.
The manual provides reference and user information specific to the ANSI C optimizing compiler. It gives details of:
- command line options for invoking different levels of optimization;
- language considerations when using the optimizing compiler;
- details of pragmas which may be of use when optimizing;
- a list of error messages which may be generated by the optimizing compiler.
Examples of the local and global optimizations available are provided in the appendices.
This manual should be read in conjunction with the reference chapter for the standard ANSI C compiler, provided in the Tools Reference Manual. This is because details which are common to both compilers are not repeated in the Optimizing Compiler User Guide, including details of command line options and compiler pragmas.
Contents
Preface Host versions About this manual About the toolset documentation set Other documents occam and FORTRAN toolsets Documentation conventions
User Guide
1 Introduction 1.1 Overview 1.1.1 Advantages of using the optimizing ANSI C compiler 1.1.2 When optimization should not be used 2 User Interface 2.1 Command line options 2.1.1 Disable optimization O0 2.1.2 Enable local optimization O1 2.1.3 Enable local and global optimization O2 2.1.4 Optimize for time QT 2.1.5 Optimize for space QS 2.1.6 Enable side effects information messages 2.1.7 Disable warning messages 2.1.8 Compiler map files 2.2 Language considerations 2.2.1 const keyword 2.2.2 volatile keyword 2.2.3 register keyword 2.3 Pragmas 2.3.1 No side effects 2.4 Messages 2.4.1 Severities 2.4.2 Standard terms abstract declarator 2.4.3 ANSI trigraphs 2.4.4 Information messages 2.4.5 Warning diagnostics 2.4.6 Recoverable errors 2.4.7 Serious errors
Appendices
A Local optimization examples A.1 Peephole optimization Example A.1.1 Summary of effects A.2 Flowgraph optimizations A.2.1 Branch-chaining optimization A.2.2 Dead code elimination A.2.3 Summary of effects of flowgraph optimizations A.3 Redundant store elimination Example A.3.1 Summary of effects B Global optimization examples B.1 Common subexpression elimination Example B.1.1 Summary of effects B.2 Loop-invariant code optimization Example B.2.1 Summary of effects B.3 Global optimization example B.4 Tail-call and tail recursion optimization B.4.1 Example: (Tail-call optimization) B.4.2 Summary of effects: (Tail-call optimization) B.4.3 Example: (Tail-recursion optimization) B.4.4 Summary of effects: (Tail-recursion optimization) B.5 Workspace allocation by coloring Index