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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void _cmpps(Variable *Dest, Operand *Src0, CondX86::CmppsCond Condition) { | 240 void _cmpps(Variable *Dest, Operand *Src0, CondX86::CmppsCond Condition) { |
241 Context.insert(InstX8632Cmpps::create(Func, Dest, Src0, Condition)); | 241 Context.insert(InstX8632Cmpps::create(Func, Dest, Src0, Condition)); |
242 } | 242 } |
243 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, | 243 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, |
244 bool Locked) { | 244 bool Locked) { |
245 Context.insert( | 245 Context.insert( |
246 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); | 246 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); |
247 // Mark eax as possibly modified by cmpxchg. | 247 // Mark eax as possibly modified by cmpxchg. |
248 Context.insert( | 248 Context.insert( |
249 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr))); | 249 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr))); |
| 250 _set_dest_nonkillable(); |
250 } | 251 } |
251 void _cmpxchg8b(OperandX8632Mem *Addr, Variable *Edx, Variable *Eax, | 252 void _cmpxchg8b(OperandX8632Mem *Addr, Variable *Edx, Variable *Eax, |
252 Variable *Ecx, Variable *Ebx, bool Locked) { | 253 Variable *Ecx, Variable *Ebx, bool Locked) { |
253 Context.insert( | 254 Context.insert( |
254 InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked)); | 255 InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked)); |
255 // Mark edx, and eax as possibly modified by cmpxchg8b. | 256 // Mark edx, and eax as possibly modified by cmpxchg8b. |
256 Context.insert(InstFakeDef::create(Func, Edx)); | 257 Context.insert(InstFakeDef::create(Func, Edx)); |
| 258 _set_dest_nonkillable(); |
257 Context.insert(InstFakeDef::create(Func, Eax)); | 259 Context.insert(InstFakeDef::create(Func, Eax)); |
| 260 _set_dest_nonkillable(); |
258 } | 261 } |
259 void _cvt(Variable *Dest, Operand *Src0, InstX8632Cvt::CvtVariant Variant) { | 262 void _cvt(Variable *Dest, Operand *Src0, InstX8632Cvt::CvtVariant Variant) { |
260 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Variant)); | 263 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Variant)); |
261 } | 264 } |
262 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { | 265 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { |
263 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); | 266 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); |
264 } | 267 } |
265 void _divps(Variable *Dest, Operand *Src0) { | 268 void _divps(Variable *Dest, Operand *Src0) { |
266 Context.insert(InstX8632Divps::create(Func, Dest, Src0)); | 269 Context.insert(InstX8632Divps::create(Func, Dest, Src0)); |
267 } | 270 } |
(...skipping 19 matching lines...) Expand all Loading... |
287 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } | 290 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } |
288 // If Dest=NULL is passed in, then a new variable is created, marked | 291 // If Dest=NULL is passed in, then a new variable is created, marked |
289 // as infinite register allocation weight, and returned through the | 292 // as infinite register allocation weight, and returned through the |
290 // in/out Dest argument. | 293 // in/out Dest argument. |
291 void _mov(Variable *&Dest, Operand *Src0, | 294 void _mov(Variable *&Dest, Operand *Src0, |
292 int32_t RegNum = Variable::NoRegister) { | 295 int32_t RegNum = Variable::NoRegister) { |
293 if (Dest == NULL) | 296 if (Dest == NULL) |
294 Dest = makeReg(Src0->getType(), RegNum); | 297 Dest = makeReg(Src0->getType(), RegNum); |
295 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); | 298 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); |
296 } | 299 } |
| 300 void _mov_nonkillable(Variable *Dest, Operand *Src0) { |
| 301 Inst *NewInst = InstX8632Mov::create(Func, Dest, Src0); |
| 302 NewInst->setDestNonKillable(); |
| 303 Context.insert(NewInst); |
| 304 } |
297 void _movd(Variable *Dest, Operand *Src0) { | 305 void _movd(Variable *Dest, Operand *Src0) { |
298 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); | 306 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); |
299 } | 307 } |
300 void _movp(Variable *Dest, Operand *Src0) { | 308 void _movp(Variable *Dest, Operand *Src0) { |
301 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); | 309 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); |
302 } | 310 } |
303 void _movq(Variable *Dest, Operand *Src0) { | 311 void _movq(Variable *Dest, Operand *Src0) { |
304 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); | 312 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); |
305 } | 313 } |
306 void _movss(Variable *Dest, Variable *Src0) { | 314 void _movss(Variable *Dest, Variable *Src0) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 void _ucomiss(Operand *Src0, Operand *Src1) { | 446 void _ucomiss(Operand *Src0, Operand *Src1) { |
439 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); | 447 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); |
440 } | 448 } |
441 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } | 449 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } |
442 void _xadd(Operand *Dest, Variable *Src, bool Locked) { | 450 void _xadd(Operand *Dest, Variable *Src, bool Locked) { |
443 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); | 451 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); |
444 // The xadd exchanges Dest and Src (modifying Src). | 452 // The xadd exchanges Dest and Src (modifying Src). |
445 // Model that update with a FakeDef. | 453 // Model that update with a FakeDef. |
446 Context.insert( | 454 Context.insert( |
447 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); | 455 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 456 _set_dest_nonkillable(); |
448 } | 457 } |
449 void _xchg(Operand *Dest, Variable *Src) { | 458 void _xchg(Operand *Dest, Variable *Src) { |
450 Context.insert(InstX8632Xchg::create(Func, Dest, Src)); | 459 Context.insert(InstX8632Xchg::create(Func, Dest, Src)); |
451 // The xchg modifies Dest and Src -- model that update with a FakeDef. | 460 // The xchg modifies Dest and Src -- model that update with a FakeDef. |
452 Context.insert( | 461 Context.insert( |
453 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); | 462 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 463 _set_dest_nonkillable(); |
454 } | 464 } |
455 void _xor(Variable *Dest, Operand *Src0) { | 465 void _xor(Variable *Dest, Operand *Src0) { |
456 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 466 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
457 } | 467 } |
| 468 void _set_dest_nonkillable() { |
| 469 Context.getLastInserted()->setDestNonKillable(); |
| 470 } |
458 | 471 |
459 const X86InstructionSet InstructionSet; | 472 const X86InstructionSet InstructionSet; |
460 bool IsEbpBasedFrame; | 473 bool IsEbpBasedFrame; |
461 bool NeedsStackAlignment; | 474 bool NeedsStackAlignment; |
462 size_t FrameSizeLocals; | 475 size_t FrameSizeLocals; |
463 size_t SpillAreaSizeBytes; | 476 size_t SpillAreaSizeBytes; |
464 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 477 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
465 llvm::SmallBitVector ScratchRegs; | 478 llvm::SmallBitVector ScratchRegs; |
466 llvm::SmallBitVector RegsUsed; | 479 llvm::SmallBitVector RegsUsed; |
467 SizeT NextLabelNumber; | 480 SizeT NextLabelNumber; |
(...skipping 26 matching lines...) Expand all Loading... |
494 }; | 507 }; |
495 | 508 |
496 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; | 509 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; |
497 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; | 510 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; |
498 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 511 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
499 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 512 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
500 | 513 |
501 } // end of namespace Ice | 514 } // end of namespace Ice |
502 | 515 |
503 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 516 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |