您的浏览器禁用了JavaScript(一种计算机语言,用以实现您与网页的交互),请解除该禁用,或者联系我们。[风河]:Diab编译器:提高嵌入式性能的长期记录 - 发现报告

Diab编译器:提高嵌入式性能的长期记录

2024-03-01风河张***
AI智能总结
查看更多
Diab编译器:提高嵌入式性能的长期记录

TheON-OFF Start to Modern Computers/Hardware was the driver behind the binary system as it was easier to reliablymeasure and distinguish between the saturated (ON) and cut-off (OFF) statesin electronic devices than to measure several states between those values.Additionally, logic processing is quite straightforward in binary.The binary system, however, does havedrawbacks. Firstly, it requires significantly moredigits to represent the same thing as a numberin the decimal system. For instance, the number256 in the decimal system is just three digitswhereas its binary form, 100000000, requiresnine. The number 255 in binary, however,requires one less digit and therefore less storagespace to hold that value. This space savingboundary became a constraint felt in earlyapplications, such as 8-bit video games andembedded software, where no number couldexceed 255 whether it represented currency in agame or unique colors for graphics.The other issue with binary is that humansfind it is very difficult to read. The simplephrase, “Hello World,” which takes 80 digits inbinary, is unrecognizable by most. This makeswriting instructions — algorithms and programs— both difficult and time consuming in binary. /3The difficulty in reading binary was addressedaround 1947 with the introduction of low-levelhuman-readable assembly languages that hadeach of their instructions mapped to correspondingmachine language instructions.2Higher-levellanguages (HLLs) soon followed, starting in 1952with Autocode, the name given to a set of simplifiedcoding systems that were later called programminglanguages. After that COBOL (1959), C (1970s), andSwift (2014) progressively simplified programming,making it more accessible to humans. They alsomade programming increasingly efficient with theperformance of several complex tasks or functionssimultaneously. For instance, a single line of code inC may take several lines of code in Assembly. Theoverall impact was higher productivity and shorterBut how do computers understand anythingother than the ones and zeroes? The answerto this question lies in the translation software TheON-OFF Start to Modern Computers product times to market.known as the compiler. Compilers:How Not to Get Lost in Translation/A compiler is a program that reads each line of a source program in anHLL and translates or “compiles” it to an object or target language, usually alow-level language or machine-readable code.While compilers generally support onesource programming language, they allhave a common structure that addressescompilation in several stages:1. Lexical analysis:In the first stage,also called scanning, the compiler readsthe source code a character at a time,grouping them into tokens that representbuilding blocks of the program’s syntaxand may include such objects as keywords,identifiers, operators, punctuation, andconstants. The “lexer” or tokenizer thuschecks source-code formatting andensures its output stream of tokens can beprocessed by the compiler.2. Syntax analysis:In this stage, thecompiler builds a “parse” tree, a hierarchicalrepresentation of the program, and uses itto check for syntax errors, such as missingbrackets, and reports them for correction.3. Semantic analysis:The compiler nowuses the syntax tree of previous phaseand symbol table to check that the sourcecode makes sense, looking for semanticerrors like undeclared variables andincorrect function calls or operations usingincompatible data types. /4 Compilers:How Not to Get Lost in Translation4. Optimization:The fourth stage sees codeanalysis and optimizations to improveperformance. These may include suchtechniques as constant folding, loopunrolling, and function inlining.5. Code generation:The parse tree istranslated in final stage into machinecode executable by the processor. Processor-specific optimizations, like peephole, valuefollowing, value numbering, and pipelinescheduling, may be performed at this stage.Beyond this common structure, developersdifferentiate compilers by how reliably andquickly they perform the above stages ofcompilation, what host environments theysupport, the code size or footprint delivered, andvarious additional features they offer to helpreduce design time, effort, and cost. DiabCompiler Evolution/The Diab Compiler has continued to evolve for nearly 40 years. Created inthe 1980s, it was architected to have a common compiler for all architectureswith architecture-specific details captured in a table file. This helped with bothits further development and maintenance and its ability to cross-compile — runon Windows or Linux to generate code for a wide range of CPUs.The 1990s saw many new processorsand embedded microcontrollers, and Diabstarted supporting Motorola’s 68000 (m68k)series, which targeted automotive andsimilar applications. Soon thereafter, Diabadded the reduced instruction set computer(RISC)-based PowerPC, and a long line ofprocessors including Motorola’s ColdFire,MIPS, NEC v850, ARM, MCORE, M32R, SH,Infineo