13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>Peephole optimizations (option -Oy/-OY)The generated assembly code is improved by replacing instruction sequences by equivalent but fasterand/or shorter sequences, or by deleting unnecessary instructions.Instruction Scheduler (option -Ok/-OK)The instruction scheduler is a backend optimization that acts upon the generated instructions. When twoinstructions need the same machine resource - like a bus, register or functional unit - at the same time,they suffer a structural hazard, which stalls the pipeline. This optimization tries to rearrange instructionsto avoid structural hazards, <strong>for</strong> example by inserting another non-related instruction.First the instruction stream is partitioned into basic blocks. A new basic block starts at a label, or rightafter a jump instruction. Unschedulable instructions and, when -Av is enabled, instructions that accessvolatile objects, each get their own basic block. Next, the scheduler searches the instructions within abasic block, looking <strong>for</strong> places where the pipeline stalls. After identifying these places it tries to rebuildthe basic block using the existing instructions, while avoiding the pipeline stalls. In this process datadependencies between instructions are honoured.Note that the function inlining optimization happens in the frontend of the compiler. The instructionscheduler has no knowledge about the origin of the instructions.Unroll small loops (option -Ou/-OU)To reduce the number of branches, short loops are eliminated by replacing them with a number of copies.Software pipelining (option -Ow/-OW)A number of techniques to optimize loops. For example, within a loop the most efficient order of instructionsis chosen by the pipeline scheduler and it is examined what instructions can be executed parallel.Code compaction (reverse inlining) (option -Or/-OR)Compaction is the opposite of inlining functions: chunks of code that occur more than once, are trans<strong>for</strong>medinto a function. This reduces code size at the cost of execution speed. The size of the chunks of code tobe inlined depends on the setting of the C compiler option --tradeoff (-t). See the subsection CodeCompaction in Section 4.5.3, Optimize <strong>for</strong> Size or Speed.Generic assembly optimizations (option -Og/-OG)A set of target independent optimizations that increase speed and decrease code size.Cluster global variables (option -O+cluster/-O-cluster)Global variables are accessed by first loading their address into a register and then accessing them viathis register. Each address will result in an entry in the constant pool. By clustering global variables it ispossible to access multiple variables using the same base register, which means we can lower the amountof entries in the constant pool. It also means that potentially we need less base registers. Clusteringensures that the linker locates the global variables together.156

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!