KAP for C for Digital UNIX
User Guide

Order Number: AA-PXEFG-TE

December 1996

This document provides information about how to run and use KAP for C on Digital UNIX systems.

Revision /Update Information This is a revised document.
Operating System and Version: Digital UNIX, Versions 3.2 and 4.0b
Software Version: KAP for C, Version 3.1

Digital Equipment Corporation
Maynard, Massachusetts


First Printing, March 1993
Revised, December 1996

Possession, use, or copying of the software described in this publication is authorized only pursuant to a valid written license from Digital or an authorized sublicensor.

Digital Equipment Corporation makes no representations that the use of its products in the manner described in this publication will not infringe on existing or future patent rights, nor do the descriptions contained in this publication imply the granting of licenses to make, use, or sell equipment or software in accordance with the description. © Digital Equipment Corporation 1993, 1995, 1996. All rights reserved. © Kuck & Associates, Inc. 1993, 1995, 1996. All rights reserved.

The following are trademarks of Digital Equipment Corporation: AlphaGeneration, DEC C, DEC Fortran, DECnet, Digital, DECthreads, VAX DOCUMENT, and the DIGITAL logo.

KAP is a trademark of Kuck & Associates, Inc.

UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Ltd.

All other trademarks and registered trademarks are the property of their respective holders.

This document is available on CD-ROM.

This document was produced using SDMLWEB.

Contents

Preface

1 Overview

2 How to Run KAP

2.1 Using KAP

2.2 Installing KAP

2.3 Compiling a Program Using the kcc Driver

2.4 Saving Optimized Source Programs

2.5 KAP Command Switches Determined by Compiler Switches

2.6 Invoking the C Preprocessor

2.7 Preprocessing a Program Using kapc

2.8 Using KAP Syntax

2.9 Using File Naming Conventions

2.10 Introducing the Five Minute KAP Guide

2.10.1 Optimizing Small Programs with KAP

2.10.2 Optimizing Large Programs with KAP

2.11 General Optimization Tips

2.12 Improving and Customizing KAP Performance

2.13 Using Additional Performance Improvement Techniques

2.14 Correcting KAP Problems

3 KAP Parallel Processing

3.1 Compiling a Program for Parallel Execution Using the kcc Driver

3.2 Preprocessing a Program for Parallel Execution Using kapc

3.3 Building Applications with the DECthreads Archive Library on Digital UNIX Versions 4.0 and Higher

3.4 Running a Parallel Program

3.5 Parallel Processing Options

3.6 Correcting KAP Parallel Processing Problems

3.7 Parallel Programming Tips

4 KAP Command Switches

4.1 General Optimization Switches

4.1.1 -interchange, -nointerchange, (-interchange)

4.1.2 -namepartitioning, -namepart, -nnamepart, (-nonamepartitioning)

4.1.3 -optimize, -o, (-optimize=5)

4.1.4 -recursion, -rc, (-norecursion), -nrc

4.1.5 -roundoff, -r, (-roundoff=3)

4.1.6 -scalaropt, -so, (-scalaropt=3)

4.1.7 -skip, -sk, -nsk, (-noskip)

4.1.8 -tune, -tune, (-tune=host)

4.2 Parallel Processing Switches

4.2.1 -concurrentize, -conc, -noconc, (-noconcurrentize)

4.2.2 -minconcurrent, -mc, (-minconcurrent=1000)

4.3 Inlining and Interprocedural Analysis Switches

4.3.1 -inline, -inl (off), -noinline, -ninl, -ipa, -ipa, (off), -noipa, -nipa

4.3.2 -inline_and_copy, -inlc, (off)

4.3.3 -inline_create, -incr, (off), -ipa_create, -ipacr, (off)

4.3.4 -inline_depth, -ind, (-inline_depth=2), -ipa_depth, -ipad, (-ipa_depth=2)

4.3.5 -inline_from_files, -inff, (Current Source File)

4.3.6 -inline_from_libraries, -infl, (off)

4.3.7 -ipa_from_files, -ipaff, (Current Source File)

4.3.8 -ipa_from_libraries, -ipafl, (off)

4.3.9 -inline_looplevel, -inll, (-inline_looplevel=2), -ipa_looplevel, -ipall, (-ipa_looplevel=2)

4.3.10 -inline_manual, -inm, (off), -ipa_manual, -ipam, (off)

4.3.11 -inline_optimize, (-inline_optimize=0), -ipa_optimize, (-ipa_optimize=0)

4.4 Language Switches

4.4.1 -natural, -nat, (-natural), -nonatural, -nnat

4.4.2 -signed, -signed, (-signed)

4.5 Advanced Optimization Switches

4.5.1 -addressresolution, -arl, (-arl=1)

4.5.2 -arclimit, -arclm, -noarclimit, (-arclimit=5000)

4.5.3 -cacheline, -chl, (-cacheline=32)

4.5.4 -cache_prefetch_line_count, -cplc, (-cplc=0)

4.5.5 -cachesize, -chs, (-cachesize=8,0)

4.5.6 -dpregisters, -dpr, (-dpregisters=32)

4.5.7 -each_invariant_if_growth, -eiifg, (-eiifg=20)

4.5.8 -fpregisters, -fpr, (-fpregisters=32)

4.5.9 -fuse, -nfuse, (-nofuse)

4.5.10 -fuselevel, (-fuselevel=0)

4.5.11 -heaplimit, -heap, (-heaplimit=100)

4.5.12 -limit, -lm, (-limit=50)

4.5.13 -machine, -ma, -noma, (-machine=s)

4.5.14 -max_invariant_if_growth, -miifg, (-miifg=500)

4.5.15 -routine, -rt, -nrt, (-noroutine)

4.5.16 -setassociativity, -sasc, (-setassociativity=1)

4.5.17 -stdio, -stdio, (off)

4.5.18 -syntax, -sy, (-syntax=d)

4.5.19 -unroll, -ur, (-unroll=4), -unroll2, -ur2, (-unroll2=160), -unroll3, -ur3, (-unroll3=1)

4.6 Input-Output Files Switches

4.6.1 -cmp, (<file>.cmp.c), (<file>.cmp), -nocmp, -ncmp

4.6.2 -list, -l, (-nolist), -nolist, -nl

4.7 Listing Switches

4.7.1 -cmpoptions, -cp, (-nocmpoptions), -nocmpoptions, -ncp

4.7.2 -lines, -ln, (-lines=55)

4.7.3 -listingwidth, -lw, (-listingwidth=132)

4.7.4 -listoptions, -lo, (-no listing)

5 Assertions and Directives

5.1 Assertions

5.1.1 #pragma _KAP arl=<integer>

5.1.2 #pragma _KAP distinct

5.1.3 #pragma _KAP no side effects ( name [,name...] )

5.2 Parallel Processing Assertions

5.2.1 #pragma _KAP concurrent

5.2.2 #pragma _KAP concurrent call

5.2.3 #pragma _KAP concurrent ignore call

5.2.4 #pragma _KAP serial

5.3 Inlining and IPA Directives

5.4 Parallel Processing Directive

6 Inlining and IPA

6.1 Inlining

6.2 Inlining and IPA Command Switches

6.2.1 -Inline_from and -ipa_from Switches

6.2.2 Library Creation

6.2.3 Naming Specific Functions

6.2.4 Call Nesting (Recursive Inlining)

6.2.5 For-Loop Level

6.2.6 Manual Control

6.3 Inlining Pragmas

6.4 Listing File Support

6.5 Inlining/IPA Examples

6.5.1 Inlining Example

6.5.2 IPA Example

6.5.3 Recursive Inlining Examples

6.6 Notes on Inlining and IPA

6.7 Inhibiting Inlining

7 Transformations

7.1 Memory Management

7.1.1 Command Switches

7.1.2 Memory Management Techniques

7.2 Loop Reordering

7.3 Scalar Optimizations

7.3.1 Induction Variable Recognition

7.3.2 Global Forward Substitution

7.3.3 Loop Peeling

7.3.4 Lifetime Analysis

7.3.5 Invariant If Floating

7.3.6 Derived Assertions

7.3.7 Dead-Code Elimination

7.3.8 Loop Fusion

7.4 Loop Unrolling

7.5 Loop Rerolling

8 KAP Listing

8.1 Listoptions

8.1.1 Calling Tree (C)

8.1.2 KAP Switches (K)

8.1.3 Loop Table (L)

8.1.4 Name (N)

8.1.5 Compilation Performance Statistics (P)

8.1.6 Summary Table (S)

8.2 Syntax Error/Warning Messages

8.3 Loop Table Messages

A Data Dependence Analysis

A.1 Data Dependence Definitions

A.2 Varieties of Data Dependence

A.3 Input and Output Sets

A.4 Data Dependence Relations

A.5 Data Dependence Direction Vectors

A.6 Loop-Carried Dependence

A.7 Data Dependence Example

Index

Tables

2-1 User Actions for Specific Goals

4-1 Command-Line Switches

4-2 Optimization Levels

4-3 Roundoff Levels

4-4 Scalar Levels

5-1 KAP Assertions and Directives


(no previous page) | Next Page | Contents | Index |
Command-Line Switches