Subzero: Implement "second-chance bin-packing" for register allocation.
If a variable gets a register but is later evicted because of a higher-weight variable, there's a chance that the first variable could have been allocated a register if only its initial choice had been different.
To improve this, we keep track of which variables are evicted, and then allow register allocation to run again, focusing only on those once-evicted variables, and not changing any previous register assignments.
This can iterate until there are no more evictions.
This is more or less what the linear-scan literature describes as "second-chance bin-packing".
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4095
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1395693005 .
diff --git a/src/IceDefs.h b/src/IceDefs.h
index f58ebe9..d73f9e7 100644
--- a/src/IceDefs.h
+++ b/src/IceDefs.h
@@ -217,9 +217,10 @@
enum RegAllocKind {
RAK_Unknown,
- RAK_Global, /// full, global register allocation
- RAK_Phi, /// infinite-weight Variables with active spilling/filling
- RAK_InfOnly /// allocation only for infinite-weight Variables
+ RAK_Global, /// full, global register allocation
+ RAK_SecondChance, /// second-chance bin-packing after full regalloc attempt
+ RAK_Phi, /// infinite-weight Variables with active spilling/filling
+ RAK_InfOnly /// allocation only for infinite-weight Variables
};
enum VerboseItem {