Chromium Code Reviews| 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 if (!BuildDefs::dump()) | 1078 if (!BuildDefs::dump()) |
| 1079 return; | 1079 return; |
| 1080 Ostream &Str = Func->getContext()->getStrDump(); | 1080 Ostream &Str = Func->getContext()->getStrDump(); |
| 1081 Str << "[TARGET] "; | 1081 Str << "[TARGET] "; |
| 1082 Inst::dump(Func); | 1082 Inst::dump(Func); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 InstBreakpoint::InstBreakpoint(Cfg *Func) | 1085 InstBreakpoint::InstBreakpoint(Cfg *Func) |
| 1086 : InstHighLevel(Func, Inst::Breakpoint, 0, nullptr) {} | 1086 : InstHighLevel(Func, Inst::Breakpoint, 0, nullptr) {} |
| 1087 | 1087 |
| 1088 void InstIcmp::invert() { | |
| 1089 switch (Condition) { | |
| 1090 case Eq: | |
|
Jim Stichnoth
2016/07/08 11:45:46
I think this would be cleaner if you encode the in
manasijm
2016/07/08 18:11:40
Done.
| |
| 1091 break; | |
| 1092 case Ne: | |
| 1093 break; | |
| 1094 case Sge: | |
| 1095 Condition = Sle; | |
| 1096 break; | |
| 1097 case Sgt: | |
| 1098 Condition = Slt; | |
| 1099 break; | |
| 1100 case Sle: | |
| 1101 Condition = Sge; | |
| 1102 break; | |
| 1103 case Slt: | |
| 1104 Condition = Sgt; | |
| 1105 break; | |
| 1106 case Uge: | |
| 1107 Condition = Ule; | |
| 1108 break; | |
| 1109 case Ugt: | |
| 1110 Condition = Ult; | |
| 1111 break; | |
| 1112 case Ule: | |
| 1113 Condition = Uge; | |
| 1114 break; | |
| 1115 case Ult: | |
| 1116 Condition = Ugt; | |
| 1117 break; | |
| 1118 default: | |
| 1119 return; | |
| 1120 } | |
| 1121 auto *TempOp = getSrc(0); | |
| 1122 replaceSource(0, getSrc(1)); | |
| 1123 replaceSource(1, TempOp); | |
| 1124 } | |
| 1088 bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) { | 1125 bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) { |
| 1089 const auto *SrcVar = llvm::dyn_cast<const Variable>(Source); | 1126 const auto *SrcVar = llvm::dyn_cast<const Variable>(Source); |
| 1090 if (!SrcVar) | 1127 if (!SrcVar) |
| 1091 return false; | 1128 return false; |
| 1092 if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) { | 1129 if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) { |
| 1093 // TODO: On x86-64, instructions like "mov eax, eax" are used to clear the | 1130 // TODO: On x86-64, instructions like "mov eax, eax" are used to clear the |
| 1094 // upper 32 bits of rax. We need to recognize and preserve these. | 1131 // upper 32 bits of rax. We need to recognize and preserve these. |
| 1095 return true; | 1132 return true; |
| 1096 } | 1133 } |
| 1097 if (!Dest->hasReg() && !SrcVar->hasReg() && | 1134 if (!Dest->hasReg() && !SrcVar->hasReg() && |
| 1098 Dest->getStackOffset() == SrcVar->getStackOffset()) | 1135 Dest->getStackOffset() == SrcVar->getStackOffset()) |
| 1099 return true; | 1136 return true; |
| 1100 return false; | 1137 return false; |
| 1101 } | 1138 } |
| 1102 | 1139 |
| 1103 } // end of namespace Ice | 1140 } // end of namespace Ice |
| OLD | NEW |