Everything
A.6.1 Data Structure

In a case where related data is referenced many times in the same function, usage of a structure will facilitate generation of a code using relative access, and an improvement in efficiency can be expected. The efficiency will also be improved when data is passed as arguments. Because the access range of relative access is limited, it is effective to place the frequently accessed data at the top of the structure.

When data takes the form of a structure, it is easy to perform tuning that changes the data expressions.

[Example]

Numeric values are assigned to variables a, b, and c.

Source code before improvement

int a, b, c;
void func()
{
     a = 1;
     b = 2;
     c = 3;
}

 

Assembly-language expansion code before improvement

_func:
     MOV.L #_a,R4
     MOV.L #00000001H,[R4]
     MOV.L #_b,R4
     MOV.L #00000002H,[R4]
     MOV.L #_c,R4
     MOV.L #00000003H,[R4]
     RTS

 

Source code after improvement

struct s{
     int a;
     int b;
     int c;
} s1;
void func()
{
     register struct s *p=&s1;
     p->a = 1;
     p->b = 2;
     p->c = 3;
}

 

Assembly-language expansion code after improvement

_func:
     MOV.L #_s1,R5
     MOV.L #00000001H,[R5]
     MOV.L #00000002H,04H[R5]
     MOV.L #00000003H,08H[R5]
     RTS