Thumb uses a special register allocation order to increase the use of low registers.

Thumb uses a special register allocation order to increase the use of low
registers.  Oddly enough, LR appears before R12, which means that LR must
be saved and restored even if R12 is available.  Swapping R12 and LR means
this simple example now uses R12 as a temporary (just like ARM):

int f(long long a, long long b)
{
  if (a < b) return 1;
  return a + b;
}

    gcc/
	* config/arm/arm.c (thumb_core_reg_alloc_order): Swap R12 and R14.

From-SVN: r243744
This commit is contained in:
Wilco Dijkstra 2016-12-16 12:59:41 +00:00 committed by Wilco Dijkstra
parent bfb688ae91
commit c67b6f2683
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2016-12-16 Wilco Dijkstra <wdijkstr@arm.com>
* config/arm/arm.c (thumb_core_reg_alloc_order): Swap R12 and R14.
2016-12-16 Claudiu Zissulescu <claziss@synopsys.com> 2016-12-16 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.md (call_prof): Remove. * config/arc/arc.md (call_prof): Remove.

View File

@ -27633,7 +27633,7 @@ arm_mangle_type (const_tree type)
static const int thumb_core_reg_alloc_order[] = static const int thumb_core_reg_alloc_order[] =
{ {
3, 2, 1, 0, 4, 5, 6, 7, 3, 2, 1, 0, 4, 5, 6, 7,
14, 12, 8, 9, 10, 11 12, 14, 8, 9, 10, 11
}; };
/* Adjust register allocation order when compiling for Thumb. */ /* Adjust register allocation order when compiling for Thumb. */