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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1477873002: Subzero. ARM32. Folding rematerializable offsets in address operands. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: make format Created 5 years 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 | src/IceTargetLoweringARM32.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/IceInstARM32.cpp - ARM32 instruction implementation ----===// 1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===//
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 assert(!isNegAddrMode()); 234 assert(!isNegAddrMode());
235 NumVars = 1; 235 NumVars = 1;
236 Vars = &this->Base; 236 Vars = &this->Base;
237 } 237 }
238 238
239 OperandARM32Mem::OperandARM32Mem(Cfg *Func, Type Ty, Variable *Base, 239 OperandARM32Mem::OperandARM32Mem(Cfg *Func, Type Ty, Variable *Base,
240 Variable *Index, ShiftKind ShiftOp, 240 Variable *Index, ShiftKind ShiftOp,
241 uint16_t ShiftAmt, AddrMode Mode) 241 uint16_t ShiftAmt, AddrMode Mode)
242 : OperandARM32(kMem, Ty), Base(Base), ImmOffset(0), Index(Index), 242 : OperandARM32(kMem, Ty), Base(Base), ImmOffset(0), Index(Index),
243 ShiftOp(ShiftOp), ShiftAmt(ShiftAmt), Mode(Mode) { 243 ShiftOp(ShiftOp), ShiftAmt(ShiftAmt), Mode(Mode) {
244 if (Index->isRematerializable()) {
245 llvm::report_fatal_error("Rematerializable Index Register is not allowed.");
246 }
244 NumVars = 2; 247 NumVars = 2;
245 Vars = Func->allocateArrayOf<Variable *>(2); 248 Vars = Func->allocateArrayOf<Variable *>(2);
246 Vars[0] = Base; 249 Vars[0] = Base;
247 Vars[1] = Index; 250 Vars[1] = Index;
248 } 251 }
249 252
250 OperandARM32ShAmtImm::OperandARM32ShAmtImm(ConstantInteger32 *SA) 253 OperandARM32ShAmtImm::OperandARM32ShAmtImm(ConstantInteger32 *SA)
251 : OperandARM32(kShAmtImm, IceType_i8), ShAmt(SA) {} 254 : OperandARM32(kShAmtImm, IceType_i8), ShAmt(SA) {}
252 255
253 bool OperandARM32Mem::canHoldOffset(Type Ty, bool SignExt, int32_t Offset) { 256 bool OperandARM32Mem::canHoldOffset(Type Ty, bool SignExt, int32_t Offset) {
254 int32_t Bits = SignExt ? TypeARM32Attributes[Ty].SExtAddrOffsetBits 257 int32_t Bits = SignExt ? TypeARM32Attributes[Ty].SExtAddrOffsetBits
255 : TypeARM32Attributes[Ty].ZExtAddrOffsetBits; 258 : TypeARM32Attributes[Ty].ZExtAddrOffsetBits;
256 if (Bits == 0) 259 if (Bits == 0)
257 return Offset == 0; 260 return Offset == 0;
258 // Note that encodings for offsets are sign-magnitude for ARM, so we check 261 // Note that encodings for offsets are sign-magnitude for ARM, so we check
259 // with IsAbsoluteUint(). 262 // with IsAbsoluteUint().
263 // Scalar fp, and vector types require an offset that is aligned to a multiple
264 // of 4.
265 if (isScalarFloatingType(Ty) || isVectorType(Ty))
266 return Utils::IsAligned(Offset, 4) && Utils::IsAbsoluteUint(Bits, Offset);
260 return Utils::IsAbsoluteUint(Bits, Offset); 267 return Utils::IsAbsoluteUint(Bits, Offset);
261 } 268 }
262 269
263 OperandARM32FlexImm::OperandARM32FlexImm(Cfg * /* Func */, Type Ty, 270 OperandARM32FlexImm::OperandARM32FlexImm(Cfg * /* Func */, Type Ty,
264 uint32_t Imm, uint32_t RotateAmt) 271 uint32_t Imm, uint32_t RotateAmt)
265 : OperandARM32Flex(kFlexImm, Ty), Imm(Imm), RotateAmt(RotateAmt) { 272 : OperandARM32Flex(kFlexImm, Ty), Imm(Imm), RotateAmt(RotateAmt) {
266 NumVars = 0; 273 NumVars = 0;
267 Vars = nullptr; 274 Vars = nullptr;
268 } 275 }
269 276
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; 1904 template class InstARM32UnaryopFP<InstARM32::Vsqrt>;
1898 1905
1899 template class InstARM32FourAddrGPR<InstARM32::Mla>; 1906 template class InstARM32FourAddrGPR<InstARM32::Mla>;
1900 template class InstARM32FourAddrGPR<InstARM32::Mls>; 1907 template class InstARM32FourAddrGPR<InstARM32::Mls>;
1901 1908
1902 template class InstARM32CmpLike<InstARM32::Cmn>; 1909 template class InstARM32CmpLike<InstARM32::Cmn>;
1903 template class InstARM32CmpLike<InstARM32::Cmp>; 1910 template class InstARM32CmpLike<InstARM32::Cmp>;
1904 template class InstARM32CmpLike<InstARM32::Tst>; 1911 template class InstARM32CmpLike<InstARM32::Tst>;
1905 1912
1906 } // end of namespace Ice 1913 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698