1//===-- FastISel.cpp - Implementation of the FastISel class ---------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 483 unchanged lines hidden (view full) --- 492 uint64_t MaxOffs = 2048; 493 Type *Ty = I->getOperand(0)->getType(); 494 MVT VT = TLI.getPointerTy(); 495 for (GetElementPtrInst::const_op_iterator OI = I->op_begin() + 1, 496 E = I->op_end(); 497 OI != E; ++OI) { 498 const Value *Idx = *OI; 499 if (auto *StTy = dyn_cast<StructType>(Ty)) { |
500 uint64_t Field = cast<ConstantInt>(Idx)->getZExtValue(); |
501 if (Field) { 502 // N = N + Offset 503 TotalOffs += DL.getStructLayout(StTy)->getElementOffset(Field); 504 if (TotalOffs >= MaxOffs) { 505 N = fastEmit_ri_(VT, ISD::ADD, N, NIsKill, TotalOffs, VT); 506 if (!N) // Unhandled operand. Halt "fast" selection and bail. 507 return false; 508 NIsKill = true; --- 4 unchanged lines hidden (view full) --- 513 } else { 514 Ty = cast<SequentialType>(Ty)->getElementType(); 515 516 // If this is a constant subscript, handle it quickly. 517 if (const auto *CI = dyn_cast<ConstantInt>(Idx)) { 518 if (CI->isZero()) 519 continue; 520 // N = N + Offset |
521 uint64_t IdxN = CI->getValue().sextOrTrunc(64).getSExtValue(); 522 TotalOffs += DL.getTypeAllocSize(Ty) * IdxN; |
523 if (TotalOffs >= MaxOffs) { 524 N = fastEmit_ri_(VT, ISD::ADD, N, NIsKill, TotalOffs, VT); 525 if (!N) // Unhandled operand. Halt "fast" selection and bail. 526 return false; 527 NIsKill = true; 528 TotalOffs = 0; 529 } 530 continue; --- 1657 unchanged lines hidden --- |