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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1609753002: Subzero. ARM32. Fixes infinite loop during address mode formation. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 11 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/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 4874 matching lines...) Expand 10 before | Expand all | Expand 10 after
4885 if (*Var == nullptr) 4885 if (*Var == nullptr)
4886 return false; 4886 return false;
4887 const Inst *VarAssign = VMetadata->getSingleDefinition(*Var); 4887 const Inst *VarAssign = VMetadata->getSingleDefinition(*Var);
4888 if (!VarAssign) 4888 if (!VarAssign)
4889 return false; 4889 return false;
4890 assert(!VMetadata->isMultiDef(*Var)); 4890 assert(!VMetadata->isMultiDef(*Var));
4891 if (!llvm::isa<InstAssign>(VarAssign)) 4891 if (!llvm::isa<InstAssign>(VarAssign))
4892 return false; 4892 return false;
4893 4893
4894 Operand *SrcOp = VarAssign->getSrc(0); 4894 Operand *SrcOp = VarAssign->getSrc(0);
4895 bool Optimized = false;
4895 if (auto *SrcVar = llvm::dyn_cast<Variable>(SrcOp)) { 4896 if (auto *SrcVar = llvm::dyn_cast<Variable>(SrcOp)) {
4896 if (!VMetadata->isMultiDef(SrcVar) || 4897 if (!VMetadata->isMultiDef(SrcVar) ||
4897 // TODO: ensure SrcVar stays single-BB 4898 // TODO: ensure SrcVar stays single-BB
4898 false) { 4899 false) {
4900 Optimized = true;
4899 *Var = SrcVar; 4901 *Var = SrcVar;
4900 } else if (auto *Const = llvm::dyn_cast<ConstantInteger32>(SrcOp)) { 4902 } else if (auto *Const = llvm::dyn_cast<ConstantInteger32>(SrcOp)) {
4901 int32_t MoreOffset = Const->getValue(); 4903 int32_t MoreOffset = Const->getValue();
4902 int32_t NewOffset = MoreOffset + *Offset; 4904 int32_t NewOffset = MoreOffset + *Offset;
4903 if (Utils::WouldOverflowAdd(*Offset, MoreOffset)) 4905 if (Utils::WouldOverflowAdd(*Offset, MoreOffset))
4904 return false; 4906 return false;
4905 *Var = nullptr; 4907 *Var = nullptr;
4906 *Offset += NewOffset; 4908 *Offset += NewOffset;
4909 Optimized = true;
4907 } 4910 }
4908
4909 *Reason = VarAssign;
4910 return true;
4911 } 4911 }
4912 4912
4913 return false; 4913 if (Optimized) {
4914 *Reason = VarAssign;
4915 }
4916
4917 return Optimized;
4914 } 4918 }
4915 4919
4916 bool isAddOrSub(const Inst *Inst, InstArithmetic::OpKind *Kind) { 4920 bool isAddOrSub(const Inst *Inst, InstArithmetic::OpKind *Kind) {
4917 if (const auto *Arith = llvm::dyn_cast<InstArithmetic>(Inst)) { 4921 if (const auto *Arith = llvm::dyn_cast<InstArithmetic>(Inst)) {
4918 switch (Arith->getOp()) { 4922 switch (Arith->getOp()) {
4919 default: 4923 default:
4920 return false; 4924 return false;
4921 case InstArithmetic::Add: 4925 case InstArithmetic::Add:
4922 case InstArithmetic::Sub: 4926 case InstArithmetic::Sub:
4923 *Kind = Arith->getOp(); 4927 *Kind = Arith->getOp();
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
6496 // However, for compatibility with current NaCl LLVM, don't claim that. 6500 // However, for compatibility with current NaCl LLVM, don't claim that.
6497 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 6501 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
6498 } 6502 }
6499 6503
6500 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM]; 6504 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM];
6501 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; 6505 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM];
6502 llvm::SmallBitVector TargetARM32::ScratchRegs; 6506 llvm::SmallBitVector TargetARM32::ScratchRegs;
6503 6507
6504 } // end of namespace ARM32 6508 } // end of namespace ARM32
6505 } // end of namespace Ice 6509 } // end of namespace Ice
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