LLVM: include/llvm/IR/GetElementPtrTypeIterator.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_IR_GETELEMENTPTRTYPEITERATOR_H
15#define LLVM_IR_GETELEMENTPTRTYPEITERATOR_H
16
24#include
25#include
26#include
27
28namespace llvm {
29
30template
32
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
67
69
70public:
76
79 I.CurTy = Ty;
80 I.OpIt = It;
81 return I;
82 }
83
86 I.OpIt = It;
87 return I;
88 }
89
91 return OpIt == x.OpIt;
92 }
93
96 }
97
98
99
100
101
103 if (auto *T = dyn_cast_if_present<Type *>(CurTy))
104 return T;
105 if (auto *VT = dyn_cast_if_present<VectorType *>(CurTy))
106 return VT->getElementType();
107 return cast<StructType *>(CurTy)->getTypeAtIndex(getOperand());
108 }
109
111
114 if (auto *ATy = dyn_cast(Ty))
115 CurTy = ATy->getElementType();
116 else if (auto *VTy = dyn_cast(Ty))
117 CurTy = VTy;
118 else
119 CurTy = dyn_cast(Ty);
120 ++OpIt;
121 return *this;
122 }
123
126 ++*this;
127 return tmp;
128 }
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145 bool isStruct() const { return isa<StructType *>(CurTy); }
146 bool isVector() const { return isa<VectorType *>(CurTy); }
148
149
150
151
152
153
158 assert(DL.typeSizeEqualsStoreSize(ElemTy) && "Not byte-addressable");
159 return DL.getTypeStoreSize(ElemTy);
160 }
161 return DL.getTypeAllocSize(ElemTy);
162 }
163
165
167 return dyn_cast_if_present<StructType *>(CurTy);
168 }
169};
170
172
174 auto *GEPOp = cast(GEP);
176 GEPOp->getSourceElementType(),
177 GEP->op_begin() + 1);
178 }
179
182 }
183
185 auto &GEPOp = cast(GEP);
187 GEPOp.getSourceElementType(),
188 GEP.op_begin() + 1);
189 }
190
193 }
194
195 template
196 inline generic_gep_type_iterator<const T *>
199 }
200
201 template
202 inline generic_gep_type_iterator<const T *>
205 }
206
207}
208
209#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines the PointerUnion class, which is a discriminated union of pointer types.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A parsed version of the target data layout string in and methods for querying it.
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Class to represent struct types.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
static generic_gep_type_iterator begin(Type *Ty, ItTy It)
bool operator==(const generic_gep_type_iterator &x) const
bool isSequential() const
generic_gep_type_iterator & operator++()
StructType * getStructType() const
StructType * getStructTypeOrNull() const
std::ptrdiff_t difference_type
static generic_gep_type_iterator end(ItTy It)
std::forward_iterator_tag iterator_category
TypeSize getSequentialElementStride(const DataLayout &DL) const
Value * getOperand() const
Type * getIndexedType() const
generic_gep_type_iterator operator++(int)
bool operator!=(const generic_gep_type_iterator &x) const
This is an optimization pass for GlobalISel generic memory operations.
gep_type_iterator gep_type_end(const User *GEP)
gep_type_iterator gep_type_begin(const User *GEP)