Search:

Overview of TASKING Compiler technology

An embedded compiler is the silent engine under the hood of the entire software development tools-suite. You should only notice it's there — and realize its crucial role in the process — when it does not do what you want it to do. For over 10 years, TASKING's current proprietary embedded compiler technology has been the silent engine running thousands of our tools-suites. TASKING compilers have been used to build thousands of applications for a wide range of microcontrollers, microprocessors and DSPs.

The secret of a good compiler lies in its ability to efficiently map the user's input source program to the instruction-set of a target processor, while preserving the semantics and functionality of the program. This efficiency is extremely important for small, embedded systems, having limited memory or CPU registers available for the compiler to use. TASKING has developed its own proprietary compiler technology for this purpose permitting us to exploit new techniques for achieving the optimal fit between the compiler and the target architecture. The average TASKING compiler utilizes almost 50 optimization techniques to reduce code size and/or execution time. A few common techniques include:

  • Dead assignment elimination
  • Removal of assignments to objects that are not used thereafter.
  • Leaf function handling
  • Leaf functions (function not calling other functions) are handled in a special way with respect to stack frame or CPU register allocation, avoiding register/stack spilling.
  • Register Caching
  • Reducing memory accesses by optimizing variables in registers impacts program performance drastically, especially when this optimization can be applied in loops. The compiler postpones writing a new value to the memory location associated with a variable, but keeps it in a register instead.
  • Loop Unrolling
  • Code executes faster when several loop iterations are performed in one cycle. This optimization increases code size. The code for the body of the loop is copied several times to reduce the number cycles. This optimization is very powerful for small loops. In those situations the flow code (testing and branching) takes up a high percentage of the total code for the loop. In hardware loops this optimization is disabled.
  • Peephole optimizations
  • The generated assembly code is improved by replacing instruction sequences by equivalent but faster and/or shorter sequences, or by deleting unnecessary instructions.

    In addition to these standard techniques, powerful C/C++ programming add-on's have been developed that allow software developers to get the maximum out of a target processor. Every target processor is supported by its own set of carefully designed and tuned language extensions, memory models, pragmas, inline functions and assembly inline techniques.

    Processor specific embedded language extensions follow the rules of programming language specifications - such as ANSI C - and are intended to utilize processor features such as interrupt handling, 8-bit arithmetic, fixed point arithmetic, memory banking, memory addressing etc. in an application program. It combines the advantages of programming in C/C++ with the efficiency of assembly programming.

    Inline functions follow a familiar concept, where in this case a set of pre-defined functions is available in the compiler. Each of these functions translates to a very small assembly sequence (usually one instruction), without the overhead normally involved when using functions. It's a convenient and efficient way to make use of special arithmetic instructions for example.

    The compiler technology offers powerful mechanisms for mixing assembly code with C/C++ code, including parameter passing for referencing HLL objects in assembly and the use of pseudo-registers instead of hard-coded ones that would break the code generator register assignment strategy. The result is an excellent integration of generated versus hand-coded assembly code.

    Finally the use of pragmas in C/C++ programs makes it possible to change compiler settings during the compilation process. For example, one part of the application should be compiled for execution speed, while another part should be compiled for minimal code size.

    If you are interested in having TASKING develop a C/C++ compiler for your proprietary hardware contact Iwantacompiler@tasking.com.