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

Side by Side Diff: src/IceTargetLoweringX8664.cpp

Issue 2052683003: Subzero: Improve effectiveness of local register availability peephole. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix comments. Implement for x86-32. Created 4 years, 6 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 | « src/IceTargetLoweringX8632.cpp ('k') | src/IceTargetLoweringX86BaseImpl.h » ('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/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===//
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 478
479 static constexpr bool IsRebased = true; 479 static constexpr bool IsRebased = true;
480 return Traits::X86OperandMem::create( 480 return Traits::X86OperandMem::create(
481 Func, Mem->getType(), ZeroReg, Offset, T, Shift, 481 Func, Mem->getType(), ZeroReg, Offset, T, Shift,
482 Traits::X86OperandMem::DefaultSegment, IsRebased); 482 Traits::X86OperandMem::DefaultSegment, IsRebased);
483 } 483 }
484 484
485 void TargetX8664::_sub_sp(Operand *Adjustment) { 485 void TargetX8664::_sub_sp(Operand *Adjustment) {
486 Variable *rsp = 486 Variable *rsp =
487 getPhysicalRegister(Traits::RegisterSet::Reg_rsp, Traits::WordType); 487 getPhysicalRegister(Traits::RegisterSet::Reg_rsp, Traits::WordType);
488 if (!NeedSandboxing) { 488
489 if (NeedSandboxing) {
490 Variable *esp =
491 getPhysicalRegister(Traits::RegisterSet::Reg_esp, IceType_i32);
492 Variable *r15 =
493 getPhysicalRegister(Traits::RegisterSet::Reg_r15, IceType_i64);
494
495 // .bundle_start
496 // sub Adjustment, %esp
497 // add %r15, %rsp
498 // .bundle_end
499 AutoBundle _(this);
500 _redefined(Context.insert<InstFakeDef>(esp, rsp));
501 _sub(esp, Adjustment);
502 _redefined(Context.insert<InstFakeDef>(rsp, esp));
503 _add(rsp, r15);
504 } else {
489 _sub(rsp, Adjustment); 505 _sub(rsp, Adjustment);
490 return;
491 } 506 }
492 507
493 Variable *esp = 508 // Add a fake use of the stack pointer, to prevent the stack pointer adustment
494 getPhysicalRegister(Traits::RegisterSet::Reg_esp, IceType_i32); 509 // from being dead-code eliminated in a function that doesn't return.
495 Variable *r15 = 510 Context.insert<InstFakeUse>(rsp);
496 getPhysicalRegister(Traits::RegisterSet::Reg_r15, IceType_i64);
497
498 // .bundle_start
499 // sub Adjustment, %esp
500 // add %r15, %rsp
501 // .bundle_end
502 AutoBundle _(this);
503 _redefined(Context.insert<InstFakeDef>(esp, rsp));
504 _sub(esp, Adjustment);
505 _redefined(Context.insert<InstFakeDef>(rsp, esp));
506 _add(rsp, r15);
507 } 511 }
508 512
509 void TargetX8664::initRebasePtr() { 513 void TargetX8664::initRebasePtr() {
510 switch (SandboxingType) { 514 switch (SandboxingType) {
511 case ST_Nonsfi: 515 case ST_Nonsfi:
512 // Probably no implementation is needed, but error to be safe for now. 516 // Probably no implementation is needed, but error to be safe for now.
513 llvm::report_fatal_error( 517 llvm::report_fatal_error(
514 "initRebasePtr() is not yet implemented on x32-nonsfi."); 518 "initRebasePtr() is not yet implemented on x32-nonsfi.");
515 case ST_NaCl: 519 case ST_NaCl:
516 RebasePtr = getPhysicalRegister(Traits::RegisterSet::Reg_r15, IceType_i64); 520 RebasePtr = getPhysicalRegister(Traits::RegisterSet::Reg_r15, IceType_i64);
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \ 815 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \
812 static_assert(_table1_##tag == _table2_##tag, \ 816 static_assert(_table1_##tag == _table2_##tag, \
813 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); 817 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE");
814 ICETYPE_TABLE 818 ICETYPE_TABLE
815 #undef X 819 #undef X
816 } // end of namespace dummy3 820 } // end of namespace dummy3
817 } // end of anonymous namespace 821 } // end of anonymous namespace
818 822
819 } // end of namespace X8664 823 } // end of namespace X8664
820 } // end of namespace Ice 824 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698