LLVM: lib/Analysis/Local.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

19

20using namespace llvm;

21

23 User *GEP, bool NoAssumptions) {

25 Type *IntIdxTy = DL.getIndexType(GEP->getType());

26 Value *Result = nullptr;

27

28

32 if (Result)

33 Result = Builder->CreateAdd(Result, Offset, GEP->getName() + ".offs",

34 NUW, NSW);

35 else

37 };

38

41 ++i, ++GTI) {

44 if (OpC->isZeroValue())

45 continue;

46

47

49 uint64_t OpValue = OpC->getUniqueInteger().getZExtValue();

50 uint64_t Size = DL.getStructLayout(STy)->getElementOffset(OpValue);

52 continue;

53

54 AddOffset(ConstantInt::get(IntIdxTy, Size));

55 continue;

56 }

57 }

58

59

60 if (IntIdxTy->isVectorTy() && Op->getType()->isVectorTy())

61 Op = Builder->CreateVectorSplat(

63

64

65 if (Op->getType() != IntIdxTy)

66 Op = Builder->CreateIntCast(Op, IntIdxTy, true, Op->getName() + ".c");

69 Value *Scale = Builder->CreateTypeSize(IntIdxTy->getScalarType(), TSize);

71 Scale = Builder->CreateVectorSplat(

73

74 Op = Builder->CreateMul(Op, Scale, GEP->getName() + ".idx", NUW, NSW);

75 }

76 AddOffset(Op);

77 }

79}

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 - 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...

Definition Local.cpp:22

generic_gep_type_iterator<> gep_type_iterator

DWARFExpression::Operation Op

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

gep_type_iterator gep_type_begin(const User *GEP)