23 User *
GEP,
bool NoAssumptions) {
25 Type *IntIdxTy =
DL.getIndexType(
GEP->getType());
26 Value *Result =
nullptr;
33 Result = Builder->CreateAdd(Result,
Offset,
GEP->getName() +
".offs",
44 if (OpC->isZeroValue())
49 uint64_t OpValue = OpC->getUniqueInteger().getZExtValue();
50 uint64_t Size =
DL.getStructLayout(STy)->getElementOffset(OpValue);
54 AddOffset(ConstantInt::get(IntIdxTy,
Size));
60 if (IntIdxTy->
isVectorTy() && !
Op->getType()->isVectorTy())
61 Op = Builder->CreateVectorSplat(
65 if (
Op->getType() != IntIdxTy)
66 Op = Builder->CreateIntCast(
Op, IntIdxTy,
true,
Op->getName() +
".c");
71 Scale = Builder->CreateVectorSplat(
74 Op = Builder->CreateMul(
Op, Scale,
GEP->getName() +
".idx", NUW, NSW);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This is an important base class in LLVM.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
bool hasNoUnsignedSignedWrap() const
bool hasNoUnsignedWrap() const
Common base class shared among various IRBuilders.
Class to represent struct types.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM Value Representation.
StructType * getStructTypeOrNull() const
TypeSize getSequentialElementStride(const DataLayout &DL) const
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI Value * emitGEPOffset(IRBuilderBase *Builder, const DataLayout &DL, User *GEP, bool NoAssumptions=false)
Given a getelementptr instruction/constantexpr, emit the code necessary to compute the offset from th...
generic_gep_type_iterator<> gep_type_iterator
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
gep_type_iterator gep_type_begin(const User *GEP)