| 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) { | 262 void _cvt(Variable *Dest, Operand *Src0) { |
| 260 const bool Trunc = false; | 263 const bool Trunc = false; |
| 261 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Trunc)); | 264 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Trunc)); |
| 262 } | 265 } |
| 263 void _cvtt(Variable *Dest, Operand *Src0) { | 266 void _cvtt(Variable *Dest, Operand *Src0) { |
| 264 const bool Trunc = true; | 267 const bool Trunc = true; |
| 265 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Trunc)); | 268 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Trunc)); |
| 266 } | 269 } |
| 267 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { | 270 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 292 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } | 295 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } |
| 293 // If Dest=NULL is passed in, then a new variable is created, marked | 296 // If Dest=NULL is passed in, then a new variable is created, marked |
| 294 // as infinite register allocation weight, and returned through the | 297 // as infinite register allocation weight, and returned through the |
| 295 // in/out Dest argument. | 298 // in/out Dest argument. |
| 296 void _mov(Variable *&Dest, Operand *Src0, | 299 void _mov(Variable *&Dest, Operand *Src0, |
| 297 int32_t RegNum = Variable::NoRegister) { | 300 int32_t RegNum = Variable::NoRegister) { |
| 298 if (Dest == NULL) | 301 if (Dest == NULL) |
| 299 Dest = makeReg(Src0->getType(), RegNum); | 302 Dest = makeReg(Src0->getType(), RegNum); |
| 300 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); | 303 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); |
| 301 } | 304 } |
| 305 void _mov_nonkillable(Variable *Dest, Operand *Src0) { |
| 306 Inst *NewInst = InstX8632Mov::create(Func, Dest, Src0); |
| 307 NewInst->setDestNonKillable(); |
| 308 Context.insert(NewInst); |
| 309 } |
| 302 void _movd(Variable *Dest, Operand *Src0) { | 310 void _movd(Variable *Dest, Operand *Src0) { |
| 303 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); | 311 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); |
| 304 } | 312 } |
| 305 void _movp(Variable *Dest, Operand *Src0) { | 313 void _movp(Variable *Dest, Operand *Src0) { |
| 306 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); | 314 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); |
| 307 } | 315 } |
| 308 void _movq(Variable *Dest, Operand *Src0) { | 316 void _movq(Variable *Dest, Operand *Src0) { |
| 309 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); | 317 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); |
| 310 } | 318 } |
| 311 void _movss(Variable *Dest, Variable *Src0) { | 319 void _movss(Variable *Dest, Variable *Src0) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 void _ucomiss(Operand *Src0, Operand *Src1) { | 451 void _ucomiss(Operand *Src0, Operand *Src1) { |
| 444 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); | 452 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); |
| 445 } | 453 } |
| 446 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } | 454 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } |
| 447 void _xadd(Operand *Dest, Variable *Src, bool Locked) { | 455 void _xadd(Operand *Dest, Variable *Src, bool Locked) { |
| 448 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); | 456 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); |
| 449 // The xadd exchanges Dest and Src (modifying Src). | 457 // The xadd exchanges Dest and Src (modifying Src). |
| 450 // Model that update with a FakeDef. | 458 // Model that update with a FakeDef. |
| 451 Context.insert( | 459 Context.insert( |
| 452 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); | 460 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 461 _set_dest_nonkillable(); |
| 453 } | 462 } |
| 454 void _xchg(Operand *Dest, Variable *Src) { | 463 void _xchg(Operand *Dest, Variable *Src) { |
| 455 Context.insert(InstX8632Xchg::create(Func, Dest, Src)); | 464 Context.insert(InstX8632Xchg::create(Func, Dest, Src)); |
| 456 // The xchg modifies Dest and Src -- model that update with a FakeDef. | 465 // The xchg modifies Dest and Src -- model that update with a FakeDef. |
| 457 Context.insert( | 466 Context.insert( |
| 458 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); | 467 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 468 _set_dest_nonkillable(); |
| 459 } | 469 } |
| 460 void _xor(Variable *Dest, Operand *Src0) { | 470 void _xor(Variable *Dest, Operand *Src0) { |
| 461 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 471 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
| 462 } | 472 } |
| 473 void _set_dest_nonkillable() { |
| 474 Context.getLastInserted()->setDestNonKillable(); |
| 475 } |
| 463 | 476 |
| 464 const X86InstructionSet InstructionSet; | 477 const X86InstructionSet InstructionSet; |
| 465 bool IsEbpBasedFrame; | 478 bool IsEbpBasedFrame; |
| 466 bool NeedsStackAlignment; | 479 bool NeedsStackAlignment; |
| 467 size_t FrameSizeLocals; | 480 size_t FrameSizeLocals; |
| 468 size_t SpillAreaSizeBytes; | 481 size_t SpillAreaSizeBytes; |
| 469 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 482 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
| 470 llvm::SmallBitVector ScratchRegs; | 483 llvm::SmallBitVector ScratchRegs; |
| 471 llvm::SmallBitVector RegsUsed; | 484 llvm::SmallBitVector RegsUsed; |
| 472 SizeT NextLabelNumber; | 485 SizeT NextLabelNumber; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 500 }; | 513 }; |
| 501 | 514 |
| 502 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; | 515 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; |
| 503 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; | 516 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; |
| 504 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 517 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
| 505 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 518 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
| 506 | 519 |
| 507 } // end of namespace Ice | 520 } // end of namespace Ice |
| 508 | 521 |
| 509 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 522 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
| OLD | NEW |