Vbcc Compiler System
Total Page:16
File Type:pdf, Size:1020Kb
vbcc compiler system Volker Barthelmann i Table of Contents 1 General::::::::::::::::::::::::::::::::::::::::::: 1 1.1 Introduction :::::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.2 Legal ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.3 Installation ::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 1.3.1 Installing for Unix ::::::::::::::::::::::::::::::::::::::::: 3 1.3.2 Installing for DOS/Windows ::::::::::::::::::::::::::::::: 3 1.3.3 Installing for AmigaOS :::::::::::::::::::::::::::::::::::: 3 1.4 Tutorial :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 6 2 The Frontend :::::::::::::::::::::::::::::::::::: 7 2.1 Usage :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 7 2.2 Configuration::::::::::::::::::::::::::::::::::::::::::::::::::: 8 3 The Compiler::::::::::::::::::::::::::::::::::: 11 3.1 General Compiler Options ::::::::::::::::::::::::::::::::::::: 11 3.2 Errors and Warnings :::::::::::::::::::::::::::::::::::::::::: 15 3.3 Data Types ::::::::::::::::::::::::::::::::::::::::::::::::::: 16 3.4 Optimizations ::::::::::::::::::::::::::::::::::::::::::::::::: 17 3.4.1 Register Allocation ::::::::::::::::::::::::::::::::::::::: 19 3.4.2 Flow Optimizations::::::::::::::::::::::::::::::::::::::: 19 3.4.3 Common Subexpression Elimination :::::::::::::::::::::: 20 3.4.4 Copy Propagation :::::::::::::::::::::::::::::::::::::::: 20 3.4.5 Constant Propagation :::::::::::::::::::::::::::::::::::: 21 3.4.6 Dead Code Elimination ::::::::::::::::::::::::::::::::::: 22 3.4.7 Loop-Invariant Code Motion :::::::::::::::::::::::::::::: 22 3.4.8 Strength Reduction ::::::::::::::::::::::::::::::::::::::: 23 3.4.9 Induction Variable Elimination:::::::::::::::::::::::::::: 23 3.4.10 Loop Unrolling :::::::::::::::::::::::::::::::::::::::::: 24 3.4.11 Function Inlining :::::::::::::::::::::::::::::::::::::::: 26 3.4.12 Intrinsic Functions::::::::::::::::::::::::::::::::::::::: 28 3.4.13 Unused Object Elimination :::::::::::::::::::::::::::::: 28 3.4.14 Alias Analysis ::::::::::::::::::::::::::::::::::::::::::: 28 3.4.15 Inter-Procedural Analysis :::::::::::::::::::::::::::::::: 30 3.4.16 Cross-Module Optimizations ::::::::::::::::::::::::::::: 30 3.4.17 Instruction Scheduling ::::::::::::::::::::::::::::::::::: 31 3.4.18 Target-Specific Optimizations :::::::::::::::::::::::::::: 32 3.4.19 Debugging Optimized Code :::::::::::::::::::::::::::::: 32 3.5 Extensions :::::::::::::::::::::::::::::::::::::::::::::::::::: 33 3.5.1 Pragmas:::::::::::::::::::::::::::::::::::::::::::::::::: 33 3.5.2 Register Parameters :::::::::::::::::::::::::::::::::::::: 34 3.5.3 Inline-Assembly Functions :::::::::::::::::::::::::::::::: 34 3.5.4 Variable Attributes ::::::::::::::::::::::::::::::::::::::: 35 ii vbcc manual 3.5.5 Type Attributes :::::::::::::::::::::::::::::::::::::::::: 35 3.5.6 __typeof::::::::::::::::::::::::::::::::::::::::::::::::: 36 3.5.7 __alignof ::::::::::::::::::::::::::::::::::::::::::::::: 36 3.5.8 __offsetof :::::::::::::::::::::::::::::::::::::::::::::: 36 3.5.9 Specifying side-effects ::::::::::::::::::::::::::::::::::::: 36 3.5.10 Automatic constructor/destructor functions :::::::::::::: 37 3.5.11 __noinline ::::::::::::::::::::::::::::::::::::::::::::: 37 3.5.12 Predefined macros ::::::::::::::::::::::::::::::::::::::: 37 3.6 Known Problems :::::::::::::::::::::::::::::::::::::::::::::: 38 3.7 Credits :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 38 4 M68k/Coldfire Backend ::::::::::::::::::::::: 41 4.1 Additional options::::::::::::::::::::::::::::::::::::::::::::: 41 4.2 ABI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 42 4.3 Small data :::::::::::::::::::::::::::::::::::::::::::::::::::: 43 4.4 Small code :::::::::::::::::::::::::::::::::::::::::::::::::::: 43 4.5 CPUs ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 44 4.6 FPUs ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 44 4.7 Math:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 44 4.8 Target-Specific Variable Attributes::::::::::::::::::::::::::::: 45 4.9 Predefined Macros ::::::::::::::::::::::::::::::::::::::::::::: 45 4.10 Stack :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 45 4.11 Stdarg ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 46 4.12 Known problems ::::::::::::::::::::::::::::::::::::::::::::: 46 5 PowerPC Backend ::::::::::::::::::::::::::::: 47 5.1 Additional options for this version ::::::::::::::::::::::::::::: 47 5.2 ABI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 48 5.3 Target-specific variable-attributes :::::::::::::::::::::::::::::: 49 5.4 Target-specific pragmas:::::::::::::::::::::::::::::::::::::::: 50 5.5 Predefined Macros ::::::::::::::::::::::::::::::::::::::::::::: 50 5.6 Stack:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 50 5.7 Stdarg :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 50 5.8 Known problems :::::::::::::::::::::::::::::::::::::::::::::: 52 6 DEC Alpha Backend ::::::::::::::::::::::::::: 53 6.1 Additional options for this version ::::::::::::::::::::::::::::: 53 6.2 ABI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 53 6.3 Predefined Macros ::::::::::::::::::::::::::::::::::::::::::::: 54 6.4 Stdarg :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 54 6.5 Known problems :::::::::::::::::::::::::::::::::::::::::::::: 54 iii 7 i386 Backend ::::::::::::::::::::::::::::::::::: 57 7.1 Additional options for this version ::::::::::::::::::::::::::::: 57 7.2 ABI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 57 7.3 Predefined Macros ::::::::::::::::::::::::::::::::::::::::::::: 58 7.4 Stdarg :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 58 7.5 Known Problems :::::::::::::::::::::::::::::::::::::::::::::: 58 8 c16x Backend ::::::::::::::::::::::::::::::::::: 59 8.1 Additional options for this version ::::::::::::::::::::::::::::: 59 8.2 ABI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 59 8.3 Target-specific variable-attributes :::::::::::::::::::::::::::::: 60 8.4 Target-specific type-attributes ::::::::::::::::::::::::::::::::: 61 8.5 Target-specific types ::::::::::::::::::::::::::::::::::::::::::: 61 8.6 Predefined Macros ::::::::::::::::::::::::::::::::::::::::::::: 61 8.7 Stack:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 62 8.8 Stdarg :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 62 8.9 Known Problems :::::::::::::::::::::::::::::::::::::::::::::: 62 9 68hc12 Backend :::::::::::::::::::::::::::::::: 63 9.1 Additional options for this version ::::::::::::::::::::::::::::: 63 9.2 ABI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 63 9.3 Target-specific variable-attributes :::::::::::::::::::::::::::::: 64 9.4 Predefined Macros ::::::::::::::::::::::::::::::::::::::::::::: 64 9.5 Stack:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 65 9.6 Stdarg :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 65 9.7 Known Problems :::::::::::::::::::::::::::::::::::::::::::::: 65 10 VideoCore IV Backend ::::::::::::::::::::::: 67 10.1 Additional options for this version :::::::::::::::::::::::::::: 67 10.2 ABI :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 67 10.3 Target-specific variable-attributes ::::::::::::::::::::::::::::: 68 10.4 Target-specific pragmas::::::::::::::::::::::::::::::::::::::: 68 10.5 Predefined Macros:::::::::::::::::::::::::::::::::::::::::::: 68 10.6 Stdarg ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 68 10.7 Known problems ::::::::::::::::::::::::::::::::::::::::::::: 68 11 6502 Backend ::::::::::::::::::::::::::::::::: 71 11.1 Additional options:::::::::::::::::::::::::::::::::::::::::::: 71 11.2 ABI :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 72 11.3 Math::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 73 11.3.1 Floating Point ::::::::::::::::::::::::::::::::::::::::::: 73 11.4 Target-Specific Variable Attributes ::::::::::::::::::::::::::: 74 11.5 Target-Specific #pragmas :::::::::::::::::::::::::::::::::::: 75 11.6 Predefined Macros:::::::::::::::::::::::::::::::::::::::::::: 75 11.7 Stack :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 75 11.8 Banking:::::::::::::::::::::::::::::::::::::::::::::::::::::: 75 iv vbcc manual 11.8.1 Manual Banking ::::::::::::::::::::::::::::::::::::::::: 75 11.8.2 Automated Banking ::::::::::::::::::::::::::::::::::::: 76 11.8.2.1 Memory Model ::::::::::::::::::::::::::::::::::::: 76 11.8.2.2 Mapping ::::::::::::::::::::::::::::::::::::::::::: 76 11.8.2.3 Bank Switching::::::::::::::::::::::::::::::::::::: 76 11.8.2.4 Far Pointers :::::::::::::::::::::::::::::::::::::::: 76 11.8.2.5 Performance Considerations::::::::::::::::::::::::: 77 11.8.2.6 Library ::::::::::::::::::::::::::::::::::::::::::::: 77 11.9 Debugging ::::::::::::::::::::::::::::::::::::::::::::::::::: 78 11.10 Code compressor :::::::::::::::::::::::::::::::::::::::::::: 78 11.11 Known problems :::::::::::::::::::::::::::::::::::::::::::: 78 12 Instruction Scheduler::::::::::::::::::::::::: 79 12.1 Introduction:::::::::::::::::::::::::::::::::::::::::::::::::: 79 12.2 Usage :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 79 12.3 Known problems ::::::::::::::::::::::::::::::::::::::::::::: 79 13 Code Compressor ::::::::::::::::::::::::::::: 81 13.1 Introduction:::::::::::::::::::::::::::::::::::::::::::::::::: 81 13.2 Usage :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 81 13.3 Known problems ::::::::::::::::::::::::::::::::::::::::::::: 81 13.4 Backend Interface ::::::::::::::::::::::::::::::::::::::::::::