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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1783893002: Subzero. X8664. No moar ::new for AutoBundle. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | 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/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 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 /// \file 10 /// \file
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 X86OperandMem **findMemoryReference(T **First, Tail... Others) { 454 X86OperandMem **findMemoryReference(T **First, Tail... Others) {
455 if (llvm::isa<X86OperandMem>(*First)) { 455 if (llvm::isa<X86OperandMem>(*First)) {
456 return reinterpret_cast<X86OperandMem **>(First); 456 return reinterpret_cast<X86OperandMem **>(First);
457 } 457 }
458 return findMemoryReference(Others...); 458 return findMemoryReference(Others...);
459 } 459 }
460 460
461 X86OperandMem **findMemoryReference() { return nullptr; } 461 X86OperandMem **findMemoryReference() { return nullptr; }
462 462
463 public: 463 public:
464 std::unique_ptr<AutoBundle> Bundler; 464 AutoBundle *Bundler = nullptr;
465 X86OperandMem **const MemOperand; 465 X86OperandMem **const MemOperand;
466 466
467 template <typename... T> 467 template <typename... T>
468 AutoMemorySandboxer(typename Traits::TargetLowering *Target, T... Args) 468 AutoMemorySandboxer(typename Traits::TargetLowering *Target, T... Args)
469 : Target(Target), MemOperand(Target->SandboxingType == ST_None 469 : Target(Target), MemOperand(Target->SandboxingType == ST_None
470 ? nullptr 470 ? nullptr
471 : findMemoryReference(Args...)) { 471 : findMemoryReference(Args...)) {
472 if (MemOperand != nullptr) { 472 if (MemOperand != nullptr) {
473 if (Traits::Is64Bit) { 473 if (Traits::Is64Bit) {
474 Bundler = makeUnique<AutoBundle>(Target, BundleLockOpt); 474 Bundler = new (Target->Func->template allocate<AutoBundle>())
475 AutoBundle(Target, BundleLockOpt);
475 } 476 }
476 *MemOperand = Target->_sandbox_mem_reference(*MemOperand); 477 *MemOperand = Target->_sandbox_mem_reference(*MemOperand);
477 } 478 }
478 } 479 }
479 480
480 ~AutoMemorySandboxer() {} 481 ~AutoMemorySandboxer() {
482 if (Bundler != nullptr) {
483 Bundler->~AutoBundle();
484 }
485 }
481 }; 486 };
482 487
483 /// The following are helpers that insert lowered x86 instructions with 488 /// The following are helpers that insert lowered x86 instructions with
484 /// minimal syntactic overhead, so that the lowering code can look as close to 489 /// minimal syntactic overhead, so that the lowering code can look as close to
485 /// assembly as practical. 490 /// assembly as practical.
486 void _adc(Variable *Dest, Operand *Src0) { 491 void _adc(Variable *Dest, Operand *Src0) {
487 AutoMemorySandboxer<> _(this, &Dest, &Src0); 492 AutoMemorySandboxer<> _(this, &Dest, &Src0);
488 Context.insert<typename Traits::Insts::Adc>(Dest, Src0); 493 Context.insert<typename Traits::Insts::Adc>(Dest, Src0);
489 } 494 }
490 void _adc_rmw(X86OperandMem *DestSrc0, Operand *Src1) { 495 void _adc_rmw(X86OperandMem *DestSrc0, Operand *Src1) {
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 1125
1121 explicit TargetHeaderX86(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} 1126 explicit TargetHeaderX86(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {}
1122 }; 1127 };
1123 1128
1124 } // end of namespace X86NAMESPACE 1129 } // end of namespace X86NAMESPACE
1125 } // end of namespace Ice 1130 } // end of namespace Ice
1126 1131
1127 #include "IceTargetLoweringX86BaseImpl.h" 1132 #include "IceTargetLoweringX86BaseImpl.h"
1128 1133
1129 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 1134 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698