Optimization Tool: Compiler. Freescale Semiconductor SC3850
Anuncio
Anuncio
Optimization Tool: Compiler
3 Optimization Tool: Compiler
C code programming is easier for developers compared with assembly code and thus accelerates your time to market. The CodeWarrior StarCore compiler works as an interface between the hardware SC3850 and the programers. To fully use the resources of the hardware, the programers need knowledge on how the compiler works.
3.1
Compilation Stages
The job of the compiler is to maintain functionality of the application, support special functionality provided by the target and the application. Figure 3 illustrates the StarCore compilation stages.
Library Files
(.elb)
SHELL
C Source files
(.c, .h)
C Front End
High level
Optimizer
Low Level
Optimizer
Assembler
Linker
Executable
(.eld)
.sl
.eln
Application/
Machine configuration files
External assembly files
(.asm, .sl, .inc)
Linker Command
File
(.cmd, .lcf)
Stage Descriptions:
• C Front End (CFE). Identifies C source files by their file extension, preprocesses the source files, converts the files to Intermediate Representation (IR) files, and then passes these converted files to the high-level optimizer.
• High level optimizer. Performs target-independent optimizations: strength reduction (loop transformations), function in-lining, common sub-expression elimination, loop invariant code, constant folding and propagation, jump to jump elimination, and dead storage/assignment elimination (remove redundant variables and value assignments). For detailed information and examples,
please see reference [1]. This stage does not consider
the DSP architecture structure (registers, functional units, and so on).
• Low level optimizer. Carries out target-specific optimizations: instruction scheduling, register allocation, software pipelining, condition execution and predication, speculative execution, post-increment detection, and so on.
• Assembler. Takes the optimized assembly files, together with any specified external assembly files, outputting these files to the linker.
• Linker. Combines the assembly object files, extracts any required object modules from the library, and produces the executable application. Linker also performs optimizations: dead code stripping (removing unused functions and duplicate code).
Figure 3. StarCore Compilation Stages
Freescale Semiconductor
C Code Optimization Examples for the StarCore
®
SC3850 Core, Rev 0
5
Descargar
Anuncio