You are on page 1of 8

C C++ EC++ ADA 95 FORTRAN

OPTIMIZING COMPILERS

Software Development Tools for Embedded Applications


OPTIMIZING C, C++, EC++, ADA 95, & FORTRAN COMPILERS

G reen Hills' Optimizing C,


C++, Embedded C++
(EC++), Ada 95, and FORTRAN C

Compilers consist of a Language-


Specific Front-End, a Global
OPTIMIZING COMPILERS

Optimizer, and a Target-Specific


Optimizer and Code Generator.
All Green Hills compilers use the C++
same Global Optimizer regardless
of language or target, and the same Global
Target-Specific Optimizers and Optimizer
Code Generators regardless of lan-
guage. Optimizations may be op- Ta r g e t -
tionally weighted for either maxi- EC++ Specific
mum speed or minimum size. Optimizer

This modular approach to compiler Code


building allows Green Hills Soft- Generator
ware to add support for new micro- Ada 95
processors quickly while maintain-
ing a high degree of reliability.

The Green Hills Tool Chain con-


sists of a Macro Assembler, Librar- FORTRAN
ian, Linker and Utility Programs.
The Macro Assembler assembles
compiler-generated or user-coded
assembly language files into object Green Hills' Optimizing C, C++, EC++, Ada 95 and FORTRAN Compilers support 16 CPU families and use the same global
files. The Librarian manages ob- optimizer and code generator. Code may be optimized for maximum speed or for minimum code size on a module by module basis.

ject file libraries. The Linker links


object files and object file libraries GLOBAL OPTIMIZER Green Hills' Optimizing Compilers
into executable programs. also perform advanced global opti-
Green Hills' Optimizing Compilers
mizations rarely found in compet-
perform many standard global opti-
ing compilers, including:
COMPILER OUTPUT mizations:
Evaluate constant expressions Optimize loop control: use
Green Hills' compilers can emit hardware loop counter
assembly language files for the Reduce constant multiplies
Reduce constant divides Implement portable initialized
Macro Assembler to assemble into
global register variables and
ELF object files. For specific tar- Reduce subscript strength
values
gets, they can emit ELF object files Eliminate dead code
directly, which is significantly Inline functions manually and
Propagate constants, values,
faster. automatically, across languages
subexpressions, and machine
and compilations
state across blocks
Green Hills' ELF compilers can Optimize loop computations: Register structs and unions
emit DWARF 1.1 debug remove loop invariants, cache Optimize function entry/exit
information for comprehensive lvalues in registers Minimize code size
source-level debugging in MULTI. Allocate data by size and use to
COFF or BSD debug information Superscalar pipeline scheduling
minimize wasted space
is available for selected target
Remove tail recursion
processors.
Unroll loops

n
2 Green Hills Software, Inc.
COMPILERS

Optimizations can significantly de- For any built-in function, the code LINKER ENHANCEMENTS
crease program size and increase generator can generate a specified
execution speed. Green Hills' com- inline instruction sequence. Multiple sections
pilers typically apply more than Support for weak externals
100 optimizations to each program,

OPTIMIZING COMPILERS
Comprehensive section map
producing fast code with a small EMBEDDED SUPPORT directives
footprint. The Green Hills Embedded Fea-
ROM/RAM section placement
tures Package enhances the Com-
PEEPHOLE OPTIMIZER pilers, Macro Assembler, Linker,
Runtime Libraries, and Utility Pro- RUNTIME LIBRARY
The Green Hills target-independent grams to support embedded appli-
multi-pass Peephole Optimizer is ENHANCEMENTS
cations.
the distilled descendant of 18 Startup routine to copy initial
highly tuned target-specific peep- data values from ROM to RAM
hole optimizers. It has more than COMPILER ENHANCEMENTS and clear BSS RAM
70 separate peephole optimiza- ROMable code and data Startup routine to relocate
tions, including: initialized pointers for PIC/PID
ROMable consts and strings
Renumber registers to delete Space-saving embedded versions
moves PIC (Position Independent Code)
of fopen, fclose, printf, scanf, etc.
Eliminate redundant loads and PID (Position Independent Data)
stores SDA (Small Data Area), also
Zero Data Area and Tiny Data
TOOL CHAIN
Multiply and add/sub =>
MADD/MSUB Area on some targets The Green Hills Macro-Assem-
bler has many embedded features
Combine instructions Section renaming
such as support for weak symbols
Use bit field extract/insert Support for weak external and section renaming control.
symbols
The Green Hills Librarian is
Built-in functions such as __EI compatible with the Unix ar
PIPELINE SCHEDULER (enable interrupts) and __DI librarian.
Modern pipelined machines have (disable interrupts)
multicycle instructions that can The Green Hills Linker supports
Interrupt service routines in C a comprehensive set of embedded
overlap other instructions. The
Green Hills multi-pass instruction Enhanced "asm" facility features including automatic con-
Pipeline Scheduler maximizes struction of C++ static construc-
Efficient calling sequence tor and destructor lists, incremen-
throughput by overlapping
multicycle instructions. It often tal linking (-r), partial linking
achieves perfect instruction MACRO ASSEMBLER (-A), and full image maps in vari-
schedules. ENHANCEMENTS ous formats.

Support for weak externals


CODE GENERATOR UTILITY PROGRAMS
Multiple sections
The code generator for each target Green Hills provides 23 utility
Macros
processor includes all Green Hills' programs for format conversion,
Absolute sections information retrieval, and other
target-specific optimizations:
ORG statement useful functions in support of the
Expression tree reshaper compilation process.
Emits debug information so
Coloring register allocator
MULTI can debug the user's
Inline built-in functions assembly file
Optimistic code generation

"Optimizing C, C++, EC++, Ada 95, and FORTRAN Compilers" 3 n


C

OPTIMIZING C COMPILERS
The Green Hills Optimizing C ANSI keywords signed and from placing the same informa-
Compilers are fully Unix compat- volatile in a non-ANSI tion in the .comment section
OPTIMIZING C COMPILERS

ible in command line options and environment. when generating COFF or ELF
C source language. The maximum object files directly.
ANSI - Sets the compiler in
compiler limits, such as number of
Permissive ANSI compatibility Allow // style comments in
functions per compilation, nesting
mode. C - Allows C++ style comments,
level of loops, etc., meet or exceed
Strict ANSI - Strict ANSI mode and C as well.
those of both Unix C and ANSI C.
Green Hills C has compiled the is 100% compliant with the Concat 2 Symbols
Unix kernel, libraries, and utilities ANSI X3.159-1989 standard and Separated by Comment -
for many different microproces- does not allow nonstandard Allows /* */ as concatenation in
sors. Green Hills C also supports constructs. K & R C.
the Berkeley Unix C extensions Allow GNU Syntax
and Kanji in comments and string C OPTIONS Extensions - Supports GNU
literals. Green Hills C conforms Green Hills C contains many extensions, such as #import,
fully to ANSI X3.159-1989 specific language options so code zero size arrays, compound
Standard C (ISO/IEC 9899 and can meet specific needs. These statements as part of expressions,
FIPS PUB 160). options include: inline functions, and the
Ignore Duplicate #include - __inline__keyword.
C VERSIONS Ignores an #include directive if Japanese Automotive C -
Green Hills C supports many attempting to include a file Enables a set of extensions to
versions of the C language: already included. ANSI C used by Japanese
K + R - For C source files, Allow macros to be automobile manufacturers.
interpret the source code as the C Re#defined - Suppresses the Allow extern to be
version documented in warning or error normally given Initialized - Allows variables
Kernigham & Ritchie, first when two #define directives declared with the extern storage
edition, and compatible with the provide different values for the class to accept initial values.
portable C compiler, or PCC. same preprocessor symbol. Disallow Old Fashioned
Transition Mode - Selects a Allow #pragma asm and Syntax - Does not recognize
mode of ANSI C compatibility #pragma inline - Allows the outdated syntax for initializing
similar to AT&T C. Issues 5.0 use of #pragma asm, #pragma variables, such as int i 5; and
transition mode supporting endasm, and #pragma inline in C for assignment operators like
function prototypes and the new source files. =+, =-, =*.
Wrong #directives Use ANSI C Semantics for
inside #if 0 - During Assignment - Uses ANSI rules
preprocessing, lines for ++ and *= in K&R C.
inside of false #if, #elif, Allocate Small Enums as
#ifdef, and #ifndef are char or short - Allocates
ignored. enumerated types to the smallest
No output for #ident storage possible.
or #pragma ident - Truncate External Symbols -
Prevents the compiler Truncate all symbol names to
from outputting an ident eight characters for compatibility
directive in the assem- with older compilers and linkers.
bly language output or

C Build Options

n
4 Green Hills Software, Inc.
C++/EC++

OPTIMIZING C++/EC++ COMPILERS


OPTIMIZING C++ COMPILERS
Green Hills C++ Optimizing Com- Use long lifetimes for time to execute. Library functions,
piler conforms to the latest ANSI temps - Creates temporary vari- particularly input-output, may call
Standard for C++. Green Hills ables whose lifetime ends at the and include much more code than
C++ is a Scalable C++ compiler earliest end of scope, end of necessary for basic functionality.
that includes a variety of user-se- switch clause, or next label. EC++ removes these limitations by
lectable language feature combina- omitting a number of C++ features
Keep comments in
tions to meet specific needs. that are not essential for most em-
preprocessor output - If
producing a preprocessor output bedded applications because they
Green Hills C++ compiler offers increase code size and impair
file passes comment lines
many options, including the new runtime efficiency. The features
through from the C++ source to
Embedded C++. not defined in EC++ include:
the preprocessor output file.
standard temple library
Leave translated C - Leaves
C++ VERSIONS templatized string, complex, or
a C version of the C++ code.
Green Hills C++ supports many iostreams classes
versions of the C++ language: Enable exception
handling - Enables support for exception-handling functions or
Standard (ANSI) C++ w/ classes
the C++ exception handling
warnings - Enables ANSI C++
feature. type_info class
mode. Warning messages are is-
sued when non-ANSI C++ fea- Disable array new/delete - support for wide-character input/
tures are used. Enables support for the array output, locals, or long double
new and delete features. arithmetic
ARM - Accepts the C++ lan-
guage as defined by The Anno-
tated C++ Reference Manual EMBEDDED C++ (EC++) The Green Hills EC++ compilers
(ARM), by Ellis and Stroustrop. Green Hills EC++ is a proper sub- can achieve improvements ranging
set of ANSI C++ intended to meet from 30 -90 percent in code size
Embedded C++ - A subset of
the needs of embedded application and run-time efficiency over full
Standard C++.
developers. EC++ offers the same ANSI C++, particularly for appli-
Cfront 3.0 - Enables compatibil- object-oriented benefits of C++, cations containing I/O.
ity with cfront version 3.0. but with smaller code size, deter-
Cfront 2.1 - Enables compatibil- ministic behavior, and a simpler
ity with cfront version 2.1. user interface. EC++ hits the
"sweet spot" between C and C++.
C++ OPTIONS
Green Hills C++ contains many Many ANSI C++ features
specific language options so code can result in added code
can meet specific needs. These op- size and performance
tions include: overheads even if they are
not used in an application.
Enable std namespace - En- Simple expressions such
ables implicit use of the standard as template specialization
namespace when standard header can generate code that is
files are included. large or that takes a long
Disable RTTI - Disables support
for runtime type information
(RTTI) features "dynamic_cast"
and "typeid".

C++/EC++ Build Options

n
"Optimizing C, C++, EC++, Ada 95, and FORTRAN Compilers" 5
ADA 95

OPTIMIZING ADA 95
OPTIMIZING ADA 95 COMPILERS

COMPILERS
Green Hills ANSI Ada 95 are fully listing containing a line-num- In addition, the compiler imple-
validated Ada 95 optimizing com- bered listing, followed by a cross ments three optional Ada 95 an-
pilers for embedded targets run- reference table. nexes:
ning on Wind River Systems Diagnostics - Informs the System Programming
VxWorks 5.3 under Tornado. Builder in the AdaMULTI Annex (C) - The Systems
Green Hills embedded Ada 95 of- Development Environment Programming Annex specifies
fers powerful new Ada language what to display in the progress additional capabilities provided
features and is available exclu- window when building an for low-level programming.
sively for Tornado applications. application. These capabilities are also
required in many real-time,
Library Info - Displays search embedded, distributed, and
ADA 95 OPTIONS path to libraries used by the information systems.
Green Hills Ada 95 contains application.
specific language options so code Real-Time Systems Annex
Registered Units - Displays (D) - This Annex specifies
can meet specific needs. These
Unit Names and Unit descrip- additional characteristics of Ada
options include:
tions of modules registered in the implementations intended for
Ada83 Analysis Mode - Ada library. real-time systems software. To
Gives useful hints on converting conform to this Annex, an
Registered Sources -
Ada83 code to Ada 95 code. implementation shall also
Displays source code path and
Suppress All Runtime names of modules registered in conform to the Systems Pro-
Checks - Suppresses all the Ada library. gramming Annex.
automatic run-time checking Numerics Annex (G) - The
including numeric checking. Numerics Annex addresses the
ADA 95 FEATURES
Suppress Numeric Runtime Green Hills Ada 95 Optimizing particular needs of numerically
Checks - Suppresses two kinds Compilers are the first to success- intensive computing with regards
of Numeric Checks for the entire fully pass the latest suite of valida- to manipulation of complex
compilations: division_check tion tests, ACVC 2.1, and achieve numbers (computation and I/O),
and overflow_check. official certification for 16 host/tar- "strict" and "relax" mode of
Generate Cross Reference - get pairs. Green Hills Ada 95 operation to cover both arith-
Generates a cross reference compiler implements all of the new metic and noncomplex elemen-
enhancements defined in tary functions and random
the ANSI/ISO/IEC- number generation, models of
8652:1995 Ada 95 specifi- floating point and fixed point
cation. These include: arithmetic applicable to "strict"
mode, and various model at-
object-oriented program- tributes defined which are
ming applicable to the "strict" mode
hierarchical library for floating point types.
organization
type extensions of
tagged types and child
The compilers also provides
library units
specialized VxWorks and POSIX
new task and synchroni- support that enables Ada 95 tasks
zation features such as to be implemented as either
protected types VxWorks tasks or POSIX threads
(for self-hosted Unix applications).
Ada 95 Build Options

n
6 Green Hills Software, Inc.
FORTRAN

OPTIMIZING FORTRAN

OPTIMIZING FORTRAN COMPILERS


COMPILERS
FORTRAN is the least standard- FORTRAN OPTIONS 2 Byte Integer - Sets the type
ized of all of the major languages. for INTEGER to INTEGER*2.
Green Hills C contains many
Computer system vendors have
specific language options so code 132 Columns - Extends source
long exercised the right to add
can meet specific needs. These to interpret columns 1 through
extensions to the basic language in
options include: 132 instead of only 1 through 72.
order to provide themselves with a
unique, proprietary product. Green Enable Debug Lines - Locals on Stack - Allocates
Hills Optimizing FORTRAN 77 Compiles lines starting with local variables to registers or
Compilers conform fully to ANSI d, D, x, or X. stacks, equivalent to coding
X3.9-1978 Standard FORTRAN 77 Implicit Undefined - The IMPLICIT AUTOMATIC (A-Z)
(Full Language) and FIPS PUB default data type for undeclared at the start of every subroutine or
069-1, and adds the DOD MIL- variables is "undefined', function.
STD 1753 FORTRAN extensions equivalent to coding IMPLICIT VMS Common - Names
and selected VAX/VMS UNDEFINED(A-Z) at the top of COMMON blocks in the VMS
FORTRAN extensions. the source file. style with a dollar sign appended.
VMS Octal - Controls whether Hollerithblankpad - Pads
FORTRAN VERSIONS a double quotation mark is used hollerith constants on the right
Green Hills FORTRAN contains for octal characters. with blanks.
specific language options so code
Missing Args Ok - Allows
can meet specific needs. These
CALL X(1,,2). Suppresses
options include:
warning resulting from the
Standard - Interprets missing argument.
FORTRAN code in compliance
Namelist - Enables the IBM
with the ANSI FORTRAN
and VMS compatible
standard.
NAMELIST extensions in
F77 - Interprets FORTRAN code FORTRAN.
for compatibility with AT&Ts
Case Sensitive - Does not
f77 compilers.
convert uppercase user-supplied
DoD - Enables DoD FORTRAN variables to lowercase.
extensions.
One Trip Do Loops - Executes
Extended - Allows as many at least one iteration for every
general purpose language DO loop.
extensions as possible.

FORTRAN Build Options

"Optimizing C, C++, EC++, Ada 95, and FORTRAN Compilers" 7n


SUMMARY

GREEN HILLS HIGH PERFORMANCE OPTIMIZING COMPILERS


C C++ EC++ Ada 95 Fortran
PRODUCT SUMMARY

MULTI SOFTWARE DEVELOPMENT ENVIRONMENT


Source Debugger Run-Time Error Checking Program Builder Version Control System
Performance Profiler Source and Class Browser Text Editor

PROCESSOR FAMILIES SUPPORTED


PowerPC MIPS R3000/R4000/R5000 x86/Pentium ARM SH
680x0/683xx MCORE i960 TriCore V810/V830/V850
ColdFire RH32 RAD6000 Alpha SPARC/SPARClite
CPU32

CROSS DEVELOPMENT TOOL CHAIN


Assemblers Linkers Librarians Object Code Converters Run-time Libraries

TARGET SYSTEMS SUPPORTED


Simulators ROM Monitors CPU Boards In-Circuit Emulators Processor Probes OCD/BDM/JTAG

REAL-TIME OPERATING SYSTEMS SUPPORTED


velOSity INTEGRITY ThreadX Tornado/VxWorks Nucleus PLUS Enea OSE

HOST PLATFORMS FOR EMBEDDED DEVELOPMENT


Windows 95/98/NT SPARC/Solaris SPARC/SunOS PA-RISC/HP-UX

Headquarters
30 West Sola Street
Santa Barbara, California 93101
Tel: 805.965.6044 Fax: 805.965.6343
Email: sales@ghs.com http://www.ghs.com

MULTI is a registered trademark and Green Hills Software, velOSity, INTEGRITY, and the Green Hills Software logo are trademarks of Green Hills Software, Inc.
All other names mentioned are trademarks, registered trademarks, or service marks of their respective companies. Copyright 1998 Green Hills Software, Inc. v1.0

n
8 Green Hills Software, Inc.

You might also like