| OLD | NEW |
| 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===// | 1 //===- subzero/src/IceInstX8632.cpp - X86-32 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 // This file implements the InstX8632 and OperandX8632 classes, | 10 // This file implements the InstX8632 and OperandX8632 classes, |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 return false; | 264 return false; |
| 265 if (getDest()->hasReg() && getDest()->getRegNum() == Src->getRegNum()) { | 265 if (getDest()->hasReg() && getDest()->getRegNum() == Src->getRegNum()) { |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 if (!getDest()->hasReg() && !Src->hasReg() && | 268 if (!getDest()->hasReg() && !Src->hasReg() && |
| 269 Dest->getStackOffset() == Src->getStackOffset()) | 269 Dest->getStackOffset() == Src->getStackOffset()) |
| 270 return true; | 270 return true; |
| 271 return false; | 271 return false; |
| 272 } | 272 } |
| 273 | 273 |
| 274 InstX8632Sqrtss::InstX8632Sqrtss(Cfg *Func, Variable *Dest, Operand *Source) |
| 275 : InstX8632(Func, InstX8632::Sqrtss, 1, Dest) { |
| 276 addSource(Source); |
| 277 } |
| 278 |
| 274 InstX8632Ret::InstX8632Ret(Cfg *Func, Variable *Source) | 279 InstX8632Ret::InstX8632Ret(Cfg *Func, Variable *Source) |
| 275 : InstX8632(Func, InstX8632::Ret, Source ? 1 : 0, NULL) { | 280 : InstX8632(Func, InstX8632::Ret, Source ? 1 : 0, NULL) { |
| 276 if (Source) | 281 if (Source) |
| 277 addSource(Source); | 282 addSource(Source); |
| 278 } | 283 } |
| 279 | 284 |
| 280 InstX8632Xadd::InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, | 285 InstX8632Xadd::InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, |
| 281 bool Locked) | 286 bool Locked) |
| 282 : InstX8632(Func, InstX8632::Xadd, 2, llvm::dyn_cast<Variable>(Dest)), | 287 : InstX8632(Func, InstX8632::Xadd, 2, llvm::dyn_cast<Variable>(Dest)), |
| 283 Locked(Locked) { | 288 Locked(Locked) { |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 Str << "\tret\n"; | 917 Str << "\tret\n"; |
| 913 } | 918 } |
| 914 | 919 |
| 915 void InstX8632Ret::dump(const Cfg *Func) const { | 920 void InstX8632Ret::dump(const Cfg *Func) const { |
| 916 Ostream &Str = Func->getContext()->getStrDump(); | 921 Ostream &Str = Func->getContext()->getStrDump(); |
| 917 Type Ty = (getSrcSize() == 0 ? IceType_void : getSrc(0)->getType()); | 922 Type Ty = (getSrcSize() == 0 ? IceType_void : getSrc(0)->getType()); |
| 918 Str << "ret." << Ty << " "; | 923 Str << "ret." << Ty << " "; |
| 919 dumpSources(Func); | 924 dumpSources(Func); |
| 920 } | 925 } |
| 921 | 926 |
| 927 void InstX8632Sqrtss::emit(const Cfg *Func) const { |
| 928 Ostream &Str = Func->getContext()->getStrEmit(); |
| 929 assert(getSrcSize() == 1); |
| 930 Type Ty = getSrc(0)->getType(); |
| 931 assert(Ty == IceType_f32 || Ty == IceType_f64); |
| 932 Str << "\tsqrt" << TypeX8632Attributes[Ty].SdSsString << "\t"; |
| 933 getDest()->emit(Func); |
| 934 Str << ", "; |
| 935 getSrc(0)->emit(Func); |
| 936 Str << "\n"; |
| 937 } |
| 938 |
| 939 void InstX8632Sqrtss::dump(const Cfg *Func) const { |
| 940 Ostream &Str = Func->getContext()->getStrDump(); |
| 941 dumpDest(Func); |
| 942 Str << " = sqrt." << getDest()->getType() << " "; |
| 943 dumpSources(Func); |
| 944 } |
| 945 |
| 922 void InstX8632Xadd::emit(const Cfg *Func) const { | 946 void InstX8632Xadd::emit(const Cfg *Func) const { |
| 923 Ostream &Str = Func->getContext()->getStrEmit(); | 947 Ostream &Str = Func->getContext()->getStrEmit(); |
| 924 if (Locked) { | 948 if (Locked) { |
| 925 Str << "\tlock xadd "; | 949 Str << "\tlock xadd "; |
| 926 } else { | 950 } else { |
| 927 Str << "\txadd\t"; | 951 Str << "\txadd\t"; |
| 928 } | 952 } |
| 929 getSrc(0)->emit(Func); | 953 getSrc(0)->emit(Func); |
| 930 Str << ", "; | 954 Str << ", "; |
| 931 getSrc(1)->emit(Func); | 955 getSrc(1)->emit(Func); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 default: | 1092 default: |
| 1069 Str << "???"; | 1093 Str << "???"; |
| 1070 break; | 1094 break; |
| 1071 } | 1095 } |
| 1072 Str << "("; | 1096 Str << "("; |
| 1073 Var->dump(Func); | 1097 Var->dump(Func); |
| 1074 Str << ")"; | 1098 Str << ")"; |
| 1075 } | 1099 } |
| 1076 | 1100 |
| 1077 } // end of namespace Ice | 1101 } // end of namespace Ice |
| OLD | NEW |