summaryrefslogtreecommitdiff
path: root/vaporize/RegisterAlloc.java
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize/RegisterAlloc.java')
-rw-r--r--vaporize/RegisterAlloc.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/vaporize/RegisterAlloc.java b/vaporize/RegisterAlloc.java
index ae5826b..100d6c4 100644
--- a/vaporize/RegisterAlloc.java
+++ b/vaporize/RegisterAlloc.java
@@ -9,8 +9,10 @@ public class RegisterAlloc {
private String[] all_registers;
private Stack<String> free_registers;
private TreeSet<LIRVar> active;
+ private int spill_start;
public RegisterAlloc(LIRDict intervals, String[] all_registers) {
+ this.spill_start = 14;
this.intervals = intervals;
this.all_registers = all_registers;
this.free_registers = new Stack<String>();
@@ -68,13 +70,11 @@ public class RegisterAlloc {
}
private void spillAtInterval(LIRVar interval) {
- MinimalLogger.severe(String.format("Ran out of free registers, but a spill for %s was not performed!",
+ // You can make this spill optimally (the sarkar linearscan algorithm)
+ MinimalLogger.severe(String.format("Ran out of free registers, had to spill %s!",
interval.toString()));
this.intervals.addSpilledNum();
- // LIRVar spill = this.active.get(this.active.length()-1);
- // if (spill.getLastUse() > interval.getLastUse()) {
- // ;
- // }
+ interval.assignRegister(String.format("local[%d]", this.spill_start++));
}
}