Index: src/ia32/virtual-frame-ia32.h |
=================================================================== |
--- src/ia32/virtual-frame-ia32.h (revision 5230) |
+++ src/ia32/virtual-frame-ia32.h (working copy) |
@@ -139,6 +139,22 @@ |
if (is_used(reg)) SpillElementAt(register_location(reg)); |
} |
+ // Make the two registers distinct and spill them. Returns the second |
+ // register. If the registers were not distinct then it returns the new |
+ // second register. |
+ Result MakeDistinctAndSpilled(Result* left, Result* right) { |
+ Spill(left->reg()); |
+ Spill(right->reg()); |
+ if (left->reg().is(right->reg())) { |
+ RegisterAllocator* allocator = cgen()->allocator(); |
+ Result fresh = allocator->Allocate(); |
+ ASSERT(fresh.is_valid()); |
+ masm()->mov(fresh.reg(), right->reg()); |
+ return fresh; |
+ } |
+ return *right; |
+ } |
+ |
// Spill all occurrences of an arbitrary register if possible. Return the |
// register spilled or no_reg if it was not possible to free any register |
// (ie, they all have frame-external references). |