| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// |
| 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 declares the TargetLoweringX8632 class, which | 10 // This file declares the TargetLoweringX8632 class, which |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 virtual void lowerLoad(const InstLoad *Inst); | 88 virtual void lowerLoad(const InstLoad *Inst); |
| 89 virtual void lowerPhi(const InstPhi *Inst); | 89 virtual void lowerPhi(const InstPhi *Inst); |
| 90 virtual void lowerRet(const InstRet *Inst); | 90 virtual void lowerRet(const InstRet *Inst); |
| 91 virtual void lowerSelect(const InstSelect *Inst); | 91 virtual void lowerSelect(const InstSelect *Inst); |
| 92 virtual void lowerStore(const InstStore *Inst); | 92 virtual void lowerStore(const InstStore *Inst); |
| 93 virtual void lowerSwitch(const InstSwitch *Inst); | 93 virtual void lowerSwitch(const InstSwitch *Inst); |
| 94 virtual void lowerUnreachable(const InstUnreachable *Inst); | 94 virtual void lowerUnreachable(const InstUnreachable *Inst); |
| 95 virtual void doAddressOptLoad(); | 95 virtual void doAddressOptLoad(); |
| 96 virtual void doAddressOptStore(); | 96 virtual void doAddressOptStore(); |
| 97 | 97 |
| 98 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, |
| 99 Operand *Desired); |
| 98 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, | 100 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, |
| 99 Operand *Val); | 101 Operand *Val); |
| 100 | 102 |
| 103 typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *); |
| 104 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, |
| 105 Variable *Dest, Operand *Ptr, Operand *Val); |
| 106 |
| 101 // Operand legalization helpers. To deal with address mode | 107 // Operand legalization helpers. To deal with address mode |
| 102 // constraints, the helpers will create a new Operand and emit | 108 // constraints, the helpers will create a new Operand and emit |
| 103 // instructions that guarantee that the Operand kind is one of those | 109 // instructions that guarantee that the Operand kind is one of those |
| 104 // indicated by the LegalMask (a bitmask of allowed kinds). If the | 110 // indicated by the LegalMask (a bitmask of allowed kinds). If the |
| 105 // input Operand is known to already meet the constraints, it may be | 111 // input Operand is known to already meet the constraints, it may be |
| 106 // simply returned as the result, without creating any new | 112 // simply returned as the result, without creating any new |
| 107 // instructions or operands. | 113 // instructions or operands. |
| 108 enum OperandLegalization { | 114 enum OperandLegalization { |
| 109 Legal_None = 0, | 115 Legal_None = 0, |
| 110 Legal_Reg = 1 << 0, // physical register, not stack location | 116 Legal_Reg = 1 << 0, // physical register, not stack location |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 173 } |
| 168 void _br(InstX8632Br::BrCond Condition, InstX8632Label *Label) { | 174 void _br(InstX8632Br::BrCond Condition, InstX8632Label *Label) { |
| 169 Context.insert(InstX8632Br::create(Func, Label, Condition)); | 175 Context.insert(InstX8632Br::create(Func, Label, Condition)); |
| 170 } | 176 } |
| 171 void _cdq(Variable *Dest, Operand *Src0) { | 177 void _cdq(Variable *Dest, Operand *Src0) { |
| 172 Context.insert(InstX8632Cdq::create(Func, Dest, Src0)); | 178 Context.insert(InstX8632Cdq::create(Func, Dest, Src0)); |
| 173 } | 179 } |
| 174 void _cmp(Operand *Src0, Operand *Src1) { | 180 void _cmp(Operand *Src0, Operand *Src1) { |
| 175 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); | 181 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); |
| 176 } | 182 } |
| 183 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, |
| 184 bool Locked) { |
| 185 Context.insert( |
| 186 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); |
| 187 // Mark eax as possibly modified by cmpxchg. |
| 188 Context.insert( |
| 189 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr))); |
| 190 } |
| 191 void _cmpxchg8b(OperandX8632 *Addr, Variable *Edx, Variable *Eax, |
| 192 Variable *Ecx, Variable *Ebx, bool Locked) { |
| 193 Context.insert( |
| 194 InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked)); |
| 195 // Mark edx, and eax as possibly modified by cmpxchg8b. |
| 196 Context.insert(InstFakeDef::create(Func, Edx)); |
| 197 Context.insert(InstFakeDef::create(Func, Eax)); |
| 198 } |
| 177 void _cvt(Variable *Dest, Operand *Src0) { | 199 void _cvt(Variable *Dest, Operand *Src0) { |
| 178 Context.insert(InstX8632Cvt::create(Func, Dest, Src0)); | 200 Context.insert(InstX8632Cvt::create(Func, Dest, Src0)); |
| 179 } | 201 } |
| 180 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { | 202 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { |
| 181 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); | 203 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); |
| 182 } | 204 } |
| 183 void _divss(Variable *Dest, Operand *Src0) { | 205 void _divss(Variable *Dest, Operand *Src0) { |
| 184 Context.insert(InstX8632Divss::create(Func, Dest, Src0)); | 206 Context.insert(InstX8632Divss::create(Func, Dest, Src0)); |
| 185 } | 207 } |
| 186 void _fld(Operand *Src0) { Context.insert(InstX8632Fld::create(Func, Src0)); } | 208 void _fld(Operand *Src0) { Context.insert(InstX8632Fld::create(Func, Src0)); } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 216 } | 238 } |
| 217 void _movzx(Variable *Dest, Operand *Src0) { | 239 void _movzx(Variable *Dest, Operand *Src0) { |
| 218 Context.insert(InstX8632Movzx::create(Func, Dest, Src0)); | 240 Context.insert(InstX8632Movzx::create(Func, Dest, Src0)); |
| 219 } | 241 } |
| 220 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { | 242 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { |
| 221 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); | 243 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); |
| 222 } | 244 } |
| 223 void _mulss(Variable *Dest, Operand *Src0) { | 245 void _mulss(Variable *Dest, Operand *Src0) { |
| 224 Context.insert(InstX8632Mulss::create(Func, Dest, Src0)); | 246 Context.insert(InstX8632Mulss::create(Func, Dest, Src0)); |
| 225 } | 247 } |
| 248 void _neg(Variable *SrcDest) { |
| 249 Context.insert(InstX8632Neg::create(Func, SrcDest)); |
| 250 } |
| 226 void _or(Variable *Dest, Operand *Src0) { | 251 void _or(Variable *Dest, Operand *Src0) { |
| 227 Context.insert(InstX8632Or::create(Func, Dest, Src0)); | 252 Context.insert(InstX8632Or::create(Func, Dest, Src0)); |
| 228 } | 253 } |
| 229 void _pop(Variable *Dest) { | 254 void _pop(Variable *Dest) { |
| 230 Context.insert(InstX8632Pop::create(Func, Dest)); | 255 Context.insert(InstX8632Pop::create(Func, Dest)); |
| 231 } | 256 } |
| 232 void _push(Operand *Src0, bool SuppressStackAdjustment = false) { | 257 void _push(Operand *Src0, bool SuppressStackAdjustment = false) { |
| 233 Context.insert(InstX8632Push::create(Func, Src0, SuppressStackAdjustment)); | 258 Context.insert(InstX8632Push::create(Func, Src0, SuppressStackAdjustment)); |
| 234 } | 259 } |
| 235 void _ret(Variable *Src0 = NULL) { | 260 void _ret(Variable *Src0 = NULL) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 Context.insert(InstX8632Test::create(Func, Src0, Src1)); | 297 Context.insert(InstX8632Test::create(Func, Src0, Src1)); |
| 273 } | 298 } |
| 274 void _ucomiss(Operand *Src0, Operand *Src1) { | 299 void _ucomiss(Operand *Src0, Operand *Src1) { |
| 275 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); | 300 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); |
| 276 } | 301 } |
| 277 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } | 302 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } |
| 278 void _xadd(Operand *Dest, Variable *Src, bool Locked) { | 303 void _xadd(Operand *Dest, Variable *Src, bool Locked) { |
| 279 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); | 304 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); |
| 280 // The xadd exchanges Dest and Src (modifying Src). | 305 // The xadd exchanges Dest and Src (modifying Src). |
| 281 // Model that update with a FakeDef. | 306 // Model that update with a FakeDef. |
| 282 Context.insert(InstFakeDef::create(Func, Src)); | 307 Context.insert( |
| 308 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 309 } |
| 310 void _xchg(Operand *Dest, Variable *Src) { |
| 311 Context.insert(InstX8632Xchg::create(Func, Dest, Src)); |
| 312 // The xchg modifies Dest and Src -- model that update with a FakeDef. |
| 313 Context.insert( |
| 314 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 283 } | 315 } |
| 284 void _xor(Variable *Dest, Operand *Src0) { | 316 void _xor(Variable *Dest, Operand *Src0) { |
| 285 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 317 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
| 286 } | 318 } |
| 287 void _pxor(Variable *Dest, Operand *Src0) { | 319 void _pxor(Variable *Dest, Operand *Src0) { |
| 288 Context.insert(InstX8632Pxor::create(Func, Dest, Src0)); | 320 Context.insert(InstX8632Pxor::create(Func, Dest, Src0)); |
| 289 } | 321 } |
| 290 | 322 |
| 291 bool IsEbpBasedFrame; | 323 bool IsEbpBasedFrame; |
| 292 size_t FrameSizeLocals; | 324 size_t FrameSizeLocals; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 virtual ~TargetGlobalInitX8632() {} | 357 virtual ~TargetGlobalInitX8632() {} |
| 326 }; | 358 }; |
| 327 | 359 |
| 328 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; | 360 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; |
| 329 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 361 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
| 330 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 362 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
| 331 | 363 |
| 332 } // end of namespace Ice | 364 } // end of namespace Ice |
| 333 | 365 |
| 334 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 366 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
| OLD | NEW |