| OLD | NEW | 
|---|
| 1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// | 1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// | 
| 2 // | 2 // | 
| 3 //                        The Subzero Code Generator | 3 //                        The Subzero Code Generator | 
| 4 // | 4 // | 
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source | 
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. | 
| 7 // | 7 // | 
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// | 
| 9 /// | 9 /// | 
| 10 /// \file | 10 /// \file | 
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1083   Inst::dump(Func); | 1083   Inst::dump(Func); | 
| 1084 } | 1084 } | 
| 1085 | 1085 | 
| 1086 InstBreakpoint::InstBreakpoint(Cfg *Func) | 1086 InstBreakpoint::InstBreakpoint(Cfg *Func) | 
| 1087     : InstHighLevel(Func, Inst::Breakpoint, 0, nullptr) {} | 1087     : InstHighLevel(Func, Inst::Breakpoint, 0, nullptr) {} | 
| 1088 | 1088 | 
| 1089 void InstIcmp::reverseConditionAndOperands() { | 1089 void InstIcmp::reverseConditionAndOperands() { | 
| 1090   Condition = InstIcmpAttributes[Condition].Reverse; | 1090   Condition = InstIcmpAttributes[Condition].Reverse; | 
| 1091   std::swap(Srcs[0], Srcs[1]); | 1091   std::swap(Srcs[0], Srcs[1]); | 
| 1092 } | 1092 } | 
|  | 1093 | 
| 1093 bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) { | 1094 bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) { | 
| 1094   const auto *SrcVar = llvm::dyn_cast<const Variable>(Source); | 1095   const auto *SrcVar = llvm::dyn_cast<const Variable>(Source); | 
| 1095   if (!SrcVar) | 1096   if (SrcVar == nullptr) | 
| 1096     return false; | 1097     return false; | 
| 1097   if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) { | 1098   if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) { | 
| 1098     // TODO: On x86-64, instructions like "mov eax, eax" are used to clear the | 1099     // TODO: On x86-64, instructions like "mov eax, eax" are used to clear the | 
| 1099     // upper 32 bits of rax. We need to recognize and preserve these. | 1100     // upper 32 bits of rax. We need to recognize and preserve these. | 
| 1100     return true; | 1101     return true; | 
| 1101   } | 1102   } | 
| 1102   if (!Dest->hasReg() && !SrcVar->hasReg()) { | 1103   if (!Dest->hasReg() && !SrcVar->hasReg()) { | 
| 1103     if (!Dest->hasStackOffset() || !SrcVar->hasStackOffset()) { | 1104     if (!Dest->hasStackOffset() || !SrcVar->hasStackOffset()) { | 
|  | 1105       // If called before stack slots have been assigned (i.e. as part of the | 
|  | 1106       // dump() routine), conservatively return false. | 
| 1104       return false; | 1107       return false; | 
| 1105     } | 1108     } | 
| 1106     if (Dest->getStackOffset() != SrcVar->getStackOffset()) { | 1109     if (Dest->getStackOffset() != SrcVar->getStackOffset()) { | 
| 1107       return false; | 1110       return false; | 
| 1108     } | 1111     } | 
| 1109     return true; | 1112     return true; | 
| 1110   } | 1113   } | 
|  | 1114   // For a "v=t" assignment where t has a register, v has a stack slot, and v | 
|  | 1115   // has a LinkedTo stack root, and v and t share the same LinkedTo root, return | 
|  | 1116   // true.  This is because this assignment is effectively reassigning the same | 
|  | 1117   // value to the original LinkedTo stack root. | 
|  | 1118   if (SrcVar->hasReg() && Dest->hasStackOffset() && | 
|  | 1119       Dest->getLinkedToStackRoot() != nullptr && | 
|  | 1120       Dest->getLinkedToRoot() == SrcVar->getLinkedToRoot()) { | 
|  | 1121     return true; | 
|  | 1122   } | 
| 1111   return false; | 1123   return false; | 
| 1112 } | 1124 } | 
| 1113 | 1125 | 
| 1114 } // end of namespace Ice | 1126 } // end of namespace Ice | 
| OLD | NEW | 
|---|