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

Side by Side Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1421603003: Match index adds as well as base (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove parens per code review Created 5 years, 1 month 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/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.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 4473 matching lines...) Expand 10 before | Expand all | Expand 10 after
4484 if (Reason) { 4484 if (Reason) {
4485 dumpAddressOpt(Func, Relocatable, Offset, Base, Index, Shift, Reason); 4485 dumpAddressOpt(Func, Relocatable, Offset, Base, Index, Shift, Reason);
4486 AddressWasOptimized = true; 4486 AddressWasOptimized = true;
4487 Reason = nullptr; 4487 Reason = nullptr;
4488 } 4488 }
4489 // Update Base and Index to follow through assignments to definitions. 4489 // Update Base and Index to follow through assignments to definitions.
4490 if (matchAssign(VMetadata, Base, Relocatable, Offset, Reason)) { 4490 if (matchAssign(VMetadata, Base, Relocatable, Offset, Reason)) {
4491 // Assignments of Base from a Relocatable or ConstantInt32 can result 4491 // Assignments of Base from a Relocatable or ConstantInt32 can result
4492 // in Base becoming nullptr. To avoid code duplication in this loop we 4492 // in Base becoming nullptr. To avoid code duplication in this loop we
4493 // prefer that Base be non-nullptr if possible. 4493 // prefer that Base be non-nullptr if possible.
4494 if ((Base == nullptr) && (Index != nullptr) && (Shift == 0)) 4494 if ((Base == nullptr) && (Index != nullptr) && Shift == 0)
4495 std::swap(Base, Index); 4495 std::swap(Base, Index);
4496 continue; 4496 continue;
4497 } 4497 }
4498 if (matchAssign(VMetadata, Index, Relocatable, Offset, Reason)) 4498 if (matchAssign(VMetadata, Index, Relocatable, Offset, Reason))
4499 continue; 4499 continue;
4500 4500
4501 if (!MockBounds) { 4501 if (!MockBounds) {
4502 // Transition from: 4502 // Transition from:
4503 // <Relocatable + Offset>(Base) to 4503 // <Relocatable + Offset>(Base) to
4504 // <Relocatable + Offset>(Base, Index) 4504 // <Relocatable + Offset>(Base, Index)
4505 if (matchCombinedBaseIndex(VMetadata, Base, Index, Shift, Reason)) 4505 if (matchCombinedBaseIndex(VMetadata, Base, Index, Shift, Reason))
4506 continue; 4506 continue;
4507 // Recognize multiply/shift and update Shift amount. 4507 // Recognize multiply/shift and update Shift amount.
4508 // Index becomes Index=Var<<Const && Const+Shift<=3 ==> 4508 // Index becomes Index=Var<<Const && Const+Shift<=3 ==>
4509 // Index=Var, Shift+=Const 4509 // Index=Var, Shift+=Const
4510 // Index becomes Index=Const*Var && log2(Const)+Shift<=3 ==> 4510 // Index becomes Index=Const*Var && log2(Const)+Shift<=3 ==>
4511 // Index=Var, Shift+=log2(Const) 4511 // Index=Var, Shift+=log2(Const)
4512 if (matchShiftedIndex(VMetadata, Index, Shift, Reason)) 4512 if (matchShiftedIndex(VMetadata, Index, Shift, Reason))
4513 continue; 4513 continue;
4514 // If Shift is zero, the choice of Base and Index was purely arbitrary. 4514 // If Shift is zero, the choice of Base and Index was purely arbitrary.
4515 // Recognize multiply/shift and set Shift amount. 4515 // Recognize multiply/shift and set Shift amount.
4516 // Shift==0 && Base is Base=Var*Const && log2(Const)+Shift<=3 ==> 4516 // Shift==0 && Base is Base=Var*Const && log2(Const)+Shift<=3 ==>
4517 // swap(Index,Base) 4517 // swap(Index,Base)
4518 // Similar for Base=Const*Var and Base=Var<<Const 4518 // Similar for Base=Const*Var and Base=Var<<Const
4519 if ((Shift == 0) && matchShiftedIndex(VMetadata, Base, Shift, Reason)) { 4519 if (Shift == 0 && matchShiftedIndex(VMetadata, Base, Shift, Reason)) {
4520 std::swap(Base, Index); 4520 std::swap(Base, Index);
4521 continue; 4521 continue;
4522 } 4522 }
4523 } 4523 }
4524 // Update Offset to reflect additions/subtractions with constants and 4524 // Update Offset to reflect additions/subtractions with constants and
4525 // relocatables. 4525 // relocatables.
4526 // TODO: consider overflow issues with respect to Offset. 4526 // TODO: consider overflow issues with respect to Offset.
4527 // TODO: handle symbolic constants.
4528 if (matchOffsetBase(VMetadata, Base, Relocatable, Offset, Reason)) 4527 if (matchOffsetBase(VMetadata, Base, Relocatable, Offset, Reason))
4529 continue; 4528 continue;
4529 if (Shift == 0 &&
4530 matchOffsetBase(VMetadata, Index, Relocatable, Offset, Reason))
4531 continue;
4530 // TODO(sehr, stichnot): Handle updates of Index with Shift != 0. 4532 // TODO(sehr, stichnot): Handle updates of Index with Shift != 0.
4531 // Index is Index=Var+Const ==> 4533 // Index is Index=Var+Const ==>
4532 // set Index=Var, Offset+=(Const<<Shift) 4534 // set Index=Var, Offset+=(Const<<Shift)
4533 // Index is Index=Const+Var ==> 4535 // Index is Index=Const+Var ==>
4534 // set Index=Var, Offset+=(Const<<Shift) 4536 // set Index=Var, Offset+=(Const<<Shift)
4535 // Index is Index=Var-Const ==> 4537 // Index is Index=Var-Const ==>
4536 // set Index=Var, Offset-=(Const<<Shift) 4538 // set Index=Var, Offset-=(Const<<Shift)
4537 break; 4539 break;
4538 } while (Reason); 4540 } while (Reason);
4539 return AddressWasOptimized; 4541 return AddressWasOptimized;
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
5858 } 5860 }
5859 // the offset is not eligible for blinding or pooling, return the original 5861 // the offset is not eligible for blinding or pooling, return the original
5860 // mem operand 5862 // mem operand
5861 return MemOperand; 5863 return MemOperand;
5862 } 5864 }
5863 5865
5864 } // end of namespace X86Internal 5866 } // end of namespace X86Internal
5865 } // end of namespace Ice 5867 } // end of namespace Ice
5866 5868
5867 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 5869 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_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