| Description | | The REORDER directive enables the compiler to reorder instructions to minimize wait states and pipeline stalls. REORDER is only useful for XC16x and Super-10 devices where the following instructions may cause stalls (wait states) when the register used in the instruction are set in the prior instruction. - MOV Rn,[Rm]
- MOV Rn,[Rm+data16]
- MOV xxx,MDL
- MOV xxx,MDH
The following example:
stmt lvl source
1 unsigned int *p;
2 unsigned int v;
3
4 unsigned int func (void) {
5 1 unsigned int i1, i2;
6 1
7 1 i1 = v * 4;
8 1 i2 = *p << i1;
9 1 return (i2);
10 1 }
demonstrates code generated using the REORDER directive: Code Generated Normally |
|---|
; FUNCTION func (BEGIN)
; SOURCE LINE # 4
; SOURCE LINE # 7
0000 F2F50000 R MOV R5,v
0004 5C25 SHL R5,#02H
;---- 'i1' assigned to 'R5' ----
; SOURCE LINE # 8
0006 F2F10200 R MOV R1,p
000A A841 MOV R4,[R1]
000C 4C45 SHL R4,R5
;---- 'i2' assigned to 'R4' ----
; SOURCE LINE # 9
; SOURCE LINE # 10
000E CB00 RET
; FUNCTION func (END)
|
| Code Generated with REORDER |
|---|
; FUNCTION func (BEGIN)
; SOURCE LINE # 4
; SOURCE LINE # 7
0000 F2F10200 R MOV R1,p
0004 F2F50000 R MOV R5,v
0008 5C25 SHL R5,#02H
;---- 'i1' assigned to 'R5' ----
; SOURCE LINE # 8
000A A841 MOV R4,[R1]
000C 4C45 SHL R4,R5
;---- 'i2' assigned to 'R4' ----
; SOURCE LINE # 9
; SOURCE LINE # 10
000E CB00 RET
; FUNCTION func (END)
|
|
|