ESC: New Call/Pointer graph compilation yields denser, more portable MCU code -

ESC: New Call/Pointer graph compilation yields denser, more portable MCU code

San Jose, Ca. – At the Embedded Systems Conference here Hi-TechSoftware took the wraps off a new microcontroller compilationtechnology that generates object code based on call and pointerreference graphs derived from all the modules in an embedded program.

According to Clyde Stubbs, CEO and Founder, HI-TECHSoftware, the new methodology, cakked Omniscient Code Generation(OCG), overcomes many of the pitfalls of conventional compilers thatfrequently miss inconsistent calling conventions, variabledeclarations, and redundant code because they compile each moduleindependently and separately.

“OCG optimizes the size of each pointer variable, based on itsusage, eliminates the need for many non-standard C qualifiers andcompiler options,” he said, “and produces more optimal interruptcontext switching code, and customizes the functionality of libraryfunction.”

Stubbs claims that tests and benchmarks run by the company indicatethe new methodology results in more portable code that is nearly 50%more dense than code from competing compilers. “Denser code directlyresults in better processor performance because the same task can beexecuted with fewer instructions and fewer cycles,” he said.

True Global Optimization
Unlike traditional compilation techniques that optimize within one codemodule, OCG, said Stubbs, looks at all code modules and collectscomprehensive data on register, stack, pointer, object and variabledeclarations. It uses this information to: ensure consistent variableand object declarations between modules; optimize stack and registerallocation; and delete unused variables and functions.

This process requires no extra input from the programmer, nonon-standard extensions, and is entirely transparent. Recursively orre-entrantly called functions are identified and dynamic stack space orlocal variable storage can be used to ensure that re-entrant calls donot overwrite existing data.

A unique characteristic of the new compilation technique, he said,makes it possible to more easily port C language code across a broaderrange of microcontrollers, even though they have complex, non-linearmemory architectures with different word widths, and are basicallyincompatible with C code.

“The OCG compiler has intelligence about the complete set of usedvariable and pointers across all program modules,” said Stubbs, “andalso knows exactly how big the stack must be and where it will belocated before the code is generated.”

From this information, the compiler is able to define a set ofaddress spaces for each pointer variable that is optimally efficientfor the particular processor architecture, without any specificdirection from the programmer.

Optimizing pointer memory space
One of the most important features of the new compilation methodology,said Stubbs, is its ability to optimize the memory space for eachpointer. “An algorithm uses each and every instance of a variablehaving its address taken,” he said, “plus each and every instance of anassignment of a pointer value to a pointer (either directly, viafunction return, function parameter passing, or indirectly, via anotherpointer) and builds a data reference graph, known as a PointerReference Graph.”

The graph is completed and then identifies all objects that canpossibly be referenced by each pointer. This information is used todetermine which memory space each pointer will be required to access.Any conflicting declarations of the same object from different modulescan be detected and an informative error message issued to the user.Any variables never referenced can be deleted.

Other features of the new OCG methodology are the ability to buildcustomized library functions, build re-entrant code without a stack,bottom-up code compilation to optimize memory use, and the ability togenerate customized runtime startup code.

Stubbs said the company has implemented Omniscient Code Generationin compilers for Microchip's PIC18 microcontroller family and Cypress'Mixed Signal Controllers..

During 2007 and 2008, he said, the company will launch additionalOCG compilers for all other Microchip MCUs and DSPs, ARM7-based MCUsfrom Atmel, NXP, OKI and Samsung, and 8051 microcontrollers from over50 manufacturers.

To learn more about the OCG methodology, go to “Usingwhole-program compilation to improve MCU code density and performance.”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.