Lines Matching refs:Offset
461 /// the *offset* implied by a GEP to zero. For example, if we have &A[i], we
477 // implies an offset of "12 + i*4", then we can codegen this as "3 + i",
480 int64_t Offset = 0;
483 // Compute the aggregate offset of constant indices.
486 // Handle a struct index, which adds its field offset to the pointer.
488 Offset += TD.getStructLayout(STy)->getElementOffset(CI->getZExtValue());
491 Offset += Size*CI->getSExtValue();
499 // If there are no variable indices, we must have a constant offset, just
513 // Compute the aggregate offset of constant indices.
516 // Handle a struct index, which adds its field offset to the pointer.
518 Offset += TD.getStructLayout(STy)->getElementOffset(CI->getZExtValue());
521 Offset += Size*CI->getSExtValue();
526 // pointer/array/vector index. If there is no offset, life is simple, return
529 if (Offset == 0) {
544 Offset &= PtrSizeMask;
549 // but we can't evaluate "10 + 3*i" in terms of i. Check that the offset is a
551 int64_t NewOffs = Offset / (int64_t)VariableScale;
552 if (Offset != NewOffs*(int64_t)VariableScale)
561 return IC.Builder->CreateAdd(VariableIdx, OffsetVal, "offset");
575 // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0).
579 Value *Offset = EvaluateGEPOffsetExpression(GEPLHS, *this);
581 // If not, synthesize the offset the hard way.
582 if (Offset == 0)
583 Offset = EmitGEPOffset(GEPLHS);
584 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset,
585 Constant::getNullValue(Offset->getType()));