Download SDK_Reference_Manual..

Transcript
The Cn language
SDK Reference Manual
The switch pragma can be used to do this for an individual switch statement:
#pragma switch jumptable
switch(program[pc])
{
The compiled code can then be checked for changes in code size and speed.
The pragma should appear immediately before the switch statement which is to be translated
as a jump table.
11.10.4
Unrolling loops
There are a number of pragmas available which can be used to influence the behavior of the
loop unroller. Each of these pragmas should be placed immediately before the loop to be
affected.
#pragma loop no unroll
This can be used to prevent the loop from being unrolled.
#pragma loop unroll(nr)
This can be used to request a loop to be unrolled a certain number of times. The parameter
nr should be a positive integral value. See also Section 4.4.34: Loop unrolling on page 51.
#pragma loop maxunroll(nr)
This pragma sets a limit on the number of times the loop will be unrolled. Set immediately
before the loop you want to affect. The parameter nr should be a positive integral value indicating the maximum unroll factor for the following loop.
11.10.5
Moving code to on-chip memory
It is often important to run performance-critical code from the fast on-chip SRAM rather than
external DRAM. While it is possible to have the linker place all code in on-chip memory this
is not always practical due to space limitations. You may want to specify particular, performance-critical functions to be placed in on-chip memory. The hot pragma provides a tool for
achieving this. This pragma takes a bracketed list of function names, all of which must be
defined in the current compilation unit:
#pragma hot (f1, ..., fn)
The scope of the hot pragma is the current compilation unit. Each function in the list will be
placed in on-chip memory by the linker while all other functions will be placed in DRAM.
126
Document No. 06-RM-1600 Revision: 2.B
ClearSpeed Technology Ltd