21.01.2013 Views

Lecture Notes in Computer Science 4917

Lecture Notes in Computer Science 4917

Lecture Notes in Computer Science 4917

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.

Compilation Strategies for Reduc<strong>in</strong>g Code Size on a VLIW Processor 153<br />

Fig. 5. Back-end compiler and assembler flow depict<strong>in</strong>g the compression of <strong>in</strong>structions<br />

requirements <strong>in</strong>volve pair<strong>in</strong>g 16-bit <strong>in</strong>structions, add<strong>in</strong>g occasional padd<strong>in</strong>g to<br />

prevent a stall situation, and encod<strong>in</strong>g the fetch packet header when 16-bit <strong>in</strong>structions<br />

are present.<br />

Compression is an iterative process consist<strong>in</strong>g of one or more compression<br />

iterations. In each compression iteration the compressor starts at the beg<strong>in</strong>n<strong>in</strong>g of<br />

the section’s <strong>in</strong>struction list and generates new fetch packets until all <strong>in</strong>structions<br />

are consumed. Each new fetch packet may conta<strong>in</strong> eight 32-bit <strong>in</strong>structions (a<br />

regular fetch packet), or conta<strong>in</strong> a mixture of 16- and 32-bit <strong>in</strong>structions (a<br />

header-based fetch packet).<br />

The compressor must select an overlay which is an expansion bit comb<strong>in</strong>ation<br />

used for a fetch packet that conta<strong>in</strong>s 16-bit <strong>in</strong>structions. There are several<br />

expansion bits <strong>in</strong> the fetch packet header that <strong>in</strong>dicate how the 16-bit <strong>in</strong>structions<br />

<strong>in</strong> the fetch packet are to be <strong>in</strong>terpreted. For each new fetch packet, the<br />

compressor selects a w<strong>in</strong>dow of <strong>in</strong>structions and records for each overlay which<br />

<strong>in</strong>structions may be converted to 16-bit. It then selects the overlay that packs<br />

the most <strong>in</strong>structions <strong>in</strong> the new fetch packet. Figure 6 outl<strong>in</strong>es the high-level<br />

compressor algorithm.<br />

The compressor looks for several conditions at the end of a compression iteration<br />

that might force another iteration. When the compressor f<strong>in</strong>ds none of these<br />

conditions, no further compression iterations are required for that section. Next,<br />

we describe one of the conditions that forces another compression iteration.<br />

Initially, the compressor optimistically uses 16-bit branches for all forward<br />

branches whose target is <strong>in</strong> the same file and <strong>in</strong> the same code section. These<br />

16-bit branches have smaller displacement fields than their 32-bit counterparts<br />

and so may not be capable of reach<strong>in</strong>g their <strong>in</strong>tended dest<strong>in</strong>ation. At the end of<br />

a compression iteration, the compressor determ<strong>in</strong>es if any of these branches will<br />

not reach their target. If so, another compression iterationisrequiredandthe<br />

branch is marked <strong>in</strong>dicat<strong>in</strong>g that a 32-bit branch must be used.<br />

Dur<strong>in</strong>g a compression iteration, there is often a potential 16-bit <strong>in</strong>struction<br />

with no other potential 16-bit <strong>in</strong>struction immediately before or after to complete<br />

the 16-bit pair. In this case, the compressor can swap <strong>in</strong>structions with<strong>in</strong><br />

an execute packet to try to make a pair. S<strong>in</strong>ce the C6x C/C++ compiler often<br />

produces execute packets with multiple <strong>in</strong>structions, the swapp<strong>in</strong>g of <strong>in</strong>structions<br />

with<strong>in</strong> an execute packet <strong>in</strong>creases the conversion rate of potential 16bit<br />

<strong>in</strong>structions. The compressor does not swap or move <strong>in</strong>structions outside of

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

Saved successfully!

Ooh no, something went wrong!