Research Article

Optimizing Instruction Scheduling and Register Allocation for Register-File-Connected Clustered VLIW Architectures

Algorithm 2

Localization-enhanced register allocation mechanism.
Input:
The variable needs to be allocated, ;
Living range of that variable;
Output:
Register allocation of variables ;
(1) if   is active at the exit of BB, and global register is available at that time  then
(2) Allocate to
(3) Update preferred register for related variables
(4) end if
(5) if   has preferred register   then
(6) if   is a global register  then
(7)  if   is available, and one of the uses has different cluster from the def of   then
(8) Allocate to
(9) Update preferred register for related variables
(10)end if
(11) else
(12) if   is available, and all the uses has same cluster as the def of   then
(13) Allocate to
(14) Update preferred register for related variables
(15) end if
(16) end if
(17) else
(18) if  One of the uses has different cluster from the def of   then
(19) if  Global register is available  then
(20) Allocate to
(21) Update preferred register for related variables
(22) else
(23) Insert spill and restore instructions
(24) end if
(25) else
(26) if  Local register is available  then
(27) Allocate to
(28) Update preferred register for related variables
(29) else
(30) Insert spill and restore instructions
(31)  end if
(32) end if
(33) end if