Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: src/IceTargetLoweringX8632.h

Issue 1020853011: Subzero: Fix a lowering bug involving xchg and xadd instructions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Similar for cmpxchg and cmpxchg8b. Add documentation. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LOWERING.rst ('k') | tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Context.insert(InstX8632Cmpps::create(Func, Dest, Src0, Condition)); 253 Context.insert(InstX8632Cmpps::create(Func, Dest, Src0, Condition));
254 } 254 }
255 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, 255 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired,
256 bool Locked) { 256 bool Locked) {
257 Context.insert( 257 Context.insert(
258 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); 258 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked));
259 // Mark eax as possibly modified by cmpxchg. 259 // Mark eax as possibly modified by cmpxchg.
260 Context.insert( 260 Context.insert(
261 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr))); 261 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr)));
262 _set_dest_nonkillable(); 262 _set_dest_nonkillable();
263 Context.insert(InstFakeUse::create(Func, Eax));
263 } 264 }
264 void _cmpxchg8b(OperandX8632Mem *Addr, Variable *Edx, Variable *Eax, 265 void _cmpxchg8b(OperandX8632Mem *Addr, Variable *Edx, Variable *Eax,
265 Variable *Ecx, Variable *Ebx, bool Locked) { 266 Variable *Ecx, Variable *Ebx, bool Locked) {
266 Context.insert( 267 Context.insert(
267 InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked)); 268 InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked));
268 // Mark edx, and eax as possibly modified by cmpxchg8b. 269 // Mark edx, and eax as possibly modified by cmpxchg8b.
269 Context.insert(InstFakeDef::create(Func, Edx)); 270 Context.insert(InstFakeDef::create(Func, Edx));
270 _set_dest_nonkillable(); 271 _set_dest_nonkillable();
272 Context.insert(InstFakeUse::create(Func, Edx));
271 Context.insert(InstFakeDef::create(Func, Eax)); 273 Context.insert(InstFakeDef::create(Func, Eax));
272 _set_dest_nonkillable(); 274 _set_dest_nonkillable();
275 Context.insert(InstFakeUse::create(Func, Eax));
273 } 276 }
274 void _cvt(Variable *Dest, Operand *Src0, InstX8632Cvt::CvtVariant Variant) { 277 void _cvt(Variable *Dest, Operand *Src0, InstX8632Cvt::CvtVariant Variant) {
275 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Variant)); 278 Context.insert(InstX8632Cvt::create(Func, Dest, Src0, Variant));
276 } 279 }
277 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { 280 void _div(Variable *Dest, Operand *Src0, Operand *Src1) {
278 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); 281 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1));
279 } 282 }
280 void _divps(Variable *Dest, Operand *Src0) { 283 void _divps(Variable *Dest, Operand *Src0) {
281 Context.insert(InstX8632Divps::create(Func, Dest, Src0)); 284 Context.insert(InstX8632Divps::create(Func, Dest, Src0));
282 } 285 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 void _test(Operand *Src0, Operand *Src1) { 464 void _test(Operand *Src0, Operand *Src1) {
462 Context.insert(InstX8632Test::create(Func, Src0, Src1)); 465 Context.insert(InstX8632Test::create(Func, Src0, Src1));
463 } 466 }
464 void _ucomiss(Operand *Src0, Operand *Src1) { 467 void _ucomiss(Operand *Src0, Operand *Src1) {
465 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); 468 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1));
466 } 469 }
467 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } 470 void _ud2() { Context.insert(InstX8632UD2::create(Func)); }
468 void _xadd(Operand *Dest, Variable *Src, bool Locked) { 471 void _xadd(Operand *Dest, Variable *Src, bool Locked) {
469 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); 472 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked));
470 // The xadd exchanges Dest and Src (modifying Src). 473 // The xadd exchanges Dest and Src (modifying Src).
471 // Model that update with a FakeDef. 474 // Model that update with a FakeDef followed by a FakeUse.
472 Context.insert( 475 Context.insert(
473 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); 476 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest)));
474 _set_dest_nonkillable(); 477 _set_dest_nonkillable();
478 Context.insert(InstFakeUse::create(Func, Src));
475 } 479 }
476 void _xchg(Operand *Dest, Variable *Src) { 480 void _xchg(Operand *Dest, Variable *Src) {
477 Context.insert(InstX8632Xchg::create(Func, Dest, Src)); 481 Context.insert(InstX8632Xchg::create(Func, Dest, Src));
478 // The xchg modifies Dest and Src -- model that update with a FakeDef. 482 // The xchg modifies Dest and Src -- model that update with a
483 // FakeDef/FakeUse.
479 Context.insert( 484 Context.insert(
480 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); 485 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest)));
481 _set_dest_nonkillable(); 486 _set_dest_nonkillable();
487 Context.insert(InstFakeUse::create(Func, Src));
482 } 488 }
483 void _xor(Variable *Dest, Operand *Src0) { 489 void _xor(Variable *Dest, Operand *Src0) {
484 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); 490 Context.insert(InstX8632Xor::create(Func, Dest, Src0));
485 } 491 }
486 void _set_dest_nonkillable() { 492 void _set_dest_nonkillable() {
487 Context.getLastInserted()->setDestNonKillable(); 493 Context.getLastInserted()->setDestNonKillable();
488 } 494 }
489 495
490 const X86InstructionSet InstructionSet; 496 const X86InstructionSet InstructionSet;
491 bool IsEbpBasedFrame; 497 bool IsEbpBasedFrame;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 }; 532 };
527 533
528 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; 534 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const;
529 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; 535 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const;
530 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; 536 template <> void ConstantFloat::emit(GlobalContext *Ctx) const;
531 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; 537 template <> void ConstantDouble::emit(GlobalContext *Ctx) const;
532 538
533 } // end of namespace Ice 539 } // end of namespace Ice
534 540
535 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H 541 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H
OLDNEW
« no previous file with comments | « LOWERING.rst ('k') | tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698