Subzero: Minor refactoring/additions in preparation for phi edge splitting.
The only functional change (though not actually visible at this point) is that redundant assignment elimination is moved into a separate pass.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/672393003
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 8ea5882..8082c52 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -384,6 +384,8 @@
return;
Func->dump("After stack frame mapping");
+ Func->deleteRedundantAssignments();
+
// Branch optimization. This needs to be done just before code
// emission. In particular, no transformations that insert or
// reorder CfgNodes should be done after branch optimization. We go
@@ -423,6 +425,8 @@
return;
Func->dump("After stack frame mapping");
+ Func->deleteRedundantAssignments();
+
// Nop insertion
if (shouldDoNopInsertion()) {
Func->doNopInsertion();
@@ -444,11 +448,13 @@
#undef X
};
-Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) {
+Variable *TargetX8632::getPhysicalRegister(SizeT RegNum, Type Ty) {
+ if (Ty == IceType_void)
+ Ty = IceType_i32;
assert(RegNum < PhysicalRegisters.size());
Variable *Reg = PhysicalRegisters[RegNum];
if (Reg == NULL) {
- Reg = Func->makeVariable(IceType_i32);
+ Reg = Func->makeVariable(Ty);
Reg->setRegNum(RegNum);
PhysicalRegisters[RegNum] = Reg;
// Specially mark esp as an "argument" so that it is considered