Справочник Пользователя для Microchip Technology SW006021-2
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 272
2012 Microchip Technology Inc.
6.6.4
Switch Statement Information
Along with the generated code for each switch statement is information about how
that statement was encoded. There are several strategies the compiler can use for
switch statements. The compiler determines the appropriate strategy, see
Section 5.6.3 “Switch Statements”, or you can indicate a preference for a particular
type of strategy using a pragma, see Section 5.14.4.10 “The #pragma switch
Directive”. The information printed will look similar to that shown in Figure 6-3.
that statement was encoded. There are several strategies the compiler can use for
switch statements. The compiler determines the appropriate strategy, see
Section 5.6.3 “Switch Statements”, or you can indicate a preference for a particular
type of strategy using a pragma, see Section 5.14.4.10 “The #pragma switch
Directive”. The information printed will look similar to that shown in Figure 6-3.
FIGURE 6-3:
SWITCH STATEMENT INFORMATION
6.6.5
Pointer Reference Graph
Other important information contained in the assembly list file is the pointer reference
graph (look for pointer list with targets: in the list file). This is a list of each and every
pointer contained in the program and each target the pointer can reference through the
program. The size and type of each target is indicated as well as the size and type of
the pointer variable itself.
graph (look for pointer list with targets: in the list file). This is a list of each and every
pointer contained in the program and each target the pointer can reference through the
program. The size and type of each target is indicated as well as the size and type of
the pointer variable itself.
For example, the following shows a pointer called task_tmr in the C code, and which
is local to the function timer_intr(). It is a pointer to an unsigned int and it is
one byte wide. There is only one target to this pointer and it is the member
timer_count
is local to the function timer_intr(). It is a pointer to an unsigned int and it is
one byte wide. There is only one target to this pointer and it is the member
timer_count
in the structure called task. This target variable resides in the BANK0
class and is two bytes wide.
timer_intr@task_tmr PTR unsigned int size(1); Largest target is 2
-> task.timer_count(BANK0[2]),
The pointer reference graph shows both pointers to data objects and pointers to
functions.
functions.
206 ; Switch size 1, requested type "space"
207 ; Number of cases is 4, Range of values is 0 to 254
208 ; switch strategies available:
209 ; Name Instructions Cycles
210 ; simple_byte 13 7 (average)
211 ; jumptable 260 6 (fixed)
212 ; rangetable 259 6 (fixed)
213 ; spacedrange 516 9 (fixed)
214 ; locatedrange 255 3 (fixed)
215 ; Chosen strategy is simple_byte
207 ; Number of cases is 4, Range of values is 0 to 254
208 ; switch strategies available:
209 ; Name Instructions Cycles
210 ; simple_byte 13 7 (average)
211 ; jumptable 260 6 (fixed)
212 ; rangetable 259 6 (fixed)
213 ; spacedrange 516 9 (fixed)
214 ; locatedrange 255 3 (fixed)
215 ; Chosen strategy is simple_byte
1
2
3
4
1
2
3
4
2
3
4
egy is simple_byte
1
2
3
4
2
3
4
e
egy is simple_byte
size of the switched value
number and range of the case values
all switch strategies and their attributes
the strategy choosen for this switch
statement
statement