
Contents
x
2.6 Using Inline Function Expansion 2-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.6.1 Inlining Intrinsic Operators 2-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.6.2 Controlling Inline Function Expansion (−x Option) 2-28. . . . . . . . . . . . . . . . . . . . . . .
2.6.3 Using the inline Keyword 2-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.6.4 The _INLINE Preprocessor Symbol 2-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.7 Using the Interlist Utility 2-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.8 Understanding and Handling Compiler Errors 2-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.8.1 Generating an Error Listing (−pr Option) 2-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.8.2 Treating Code-E Errors as Warnings (−pe Option) 2-36. . . . . . . . . . . . . . . . . . . . . .
2.8.3 Altering the Level of Warning Messages (−pw Option) 2-36. . . . . . . . . . . . . . . . . . .
2.8.4 An Example of How You Can Use Error Options 2-37. . . . . . . . . . . . . . . . . . . . . . . .
2.9 Invoking the Tools Individually 2-38. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9.1 Invoking the Parser 2-39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9.2 Parsing in Two Passes 2-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9.3 Invoking the Optimizer 2-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9.4 Invoking the Code Generator 2-43. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9.5 Invoking the Interlist Utility 2-45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3 Optimizing Your Code 3-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Describes how to optimize your C code, including such features as software pipelining and loop
unrolling. Also describes the types of optimizations that are performed when you use the opti-
mizer.
3.1 Using the C Compiler Optimizer 3-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Using the −o3 Option 3-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Controlling File-Level Optimization (−oln Option) 3-4. . . . . . . . . . . . . . . . . . . . . . . . .
3.2.2 Creating an Optimization Information File (−onn Option) 3-5. . . . . . . . . . . . . . . . . .
3.3 Performing Program-Level Optimization (−pm and −o3 Options) 3-6. . . . . . . . . . . . . . . . . .
3.3.1 Controlling Program-Level Optimization (−opn Option) 3-6. . . . . . . . . . . . . . . . . . .
3.3.2 Optimization Considerations When Mixing C and Assembly 3-8. . . . . . . . . . . . . . .
3.3.3 Naming the Program Compilation Output File (−px Option) 3-9. . . . . . . . . . . . . . . .
3.4 Special Considerations When Using the Optimizer 3-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.1 Use Caution With asm Statements in Optimized Code 3-10. . . . . . . . . . . . . . . . . . .
3.4.2 Use Caution With the Volatile Keyword 3-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.3 Use Caution When Accessing Aliased Variables 3-11. . . . . . . . . . . . . . . . . . . . . . . .
3.4.4 Assume Functions Are Not Interrupts 3-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5 Automatic Inline Expansion (−oi Option) 3-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.6 Using the Interlist Utility With the Optimizer 3-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.7 Debugging Optimized Code 3-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.8 What Kind of Optimization Is Being Performed? 3-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.8.1 Cost-based Register Allocation 3-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.8.2 Autoincrement Addressing 3-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.8.3 Repeat Blocks 3-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.8.4 Delays, Banches, Calls, and Returns 3-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.8.5 Algebraic Reordering / Symbolic Simplification / Constant Folding 3-18. . . . . . . .
3.8.6 Alias Disambiguation 3-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .