Lines Matching refs:GEP
2 The Often Misunderstood GEP Instruction
12 `GetElementPtr <LangRef.html#i_getelementptr>`_ (GEP) instruction. Questions
13 about the wily GEP instruction are probably the most frequently occurring
15 sources of confusion and show that the GEP instruction is really quite simple.
20 When people are first confronted with the GEP instruction, they tend to relate
22 indexing and field selection. GEP closely resembles C array indexing and field
26 What is the first index of the GEP instruction?
45 provide the GEP instruction with two index operands. The first operand indexes
61 computation. The first operand to the GEP instruction must be a value of a
62 pointer type. The value of the pointer is provided directly to the GEP
80 In this "C" example, the front end compiler (Clang) will generate three GEP
82 function argument ``P`` will be the first operand of each of these GEP
102 In each case the first operand is the pointer through which the GEP instruction
116 These GEP instructions are simply making address computations from the base
128 directly to the GEP instructions.
134 the pointer that results from these GEP instructions would produce undefined
142 This question arises most often when the GEP instruction is applied to a global
151 The GEP above yields an ``i32*`` by indexing the ``i32`` typed field of the
161 #. Point #1 is evidenced by noticing the type of the first operand of the GEP
165 ``%MyStruct``. Since the first argument to the GEP instruction must always
172 What is dereferenced by GEP?
178 memory in any way. That's what the Load and Store instructions are for. GEP is
188 structure containing a pointer to an array of 40 ints. The GEP instruction seems
190 is actually an illegal GEP instruction. It won't compile. The reason is that the
192 array of 40 ints. Since the GEP instruction never accesses memory, it is
214 pointer and the GEP instruction can index through the global variable, into the
217 Why don't GEP x,0,0,1 and GEP x,1 alias?
222 If you look at the first indices in these GEP instructions you find that they
240 Why do GEP x,1,0,0 and GEP x,1 alias?
245 These two GEP instructions will compute the same address because indexing
259 Can GEP index into vector elements?
272 How is GEP different from ``ptrtoint``, arithmetic, and ``inttoptr``?
282 doesn't do this. With GEP you can avoid this problem.
284 Also, GEP carries additional pointer aliasing rules. It's invalid to take a GEP
290 And, GEP is more concise in common cases.
296 I'm writing a backend for a target which needs custom lowering for GEP. How do I do this?
299 You don't. The integer computation implied by a GEP is target-independent.
301 trees involving ADD, MUL, etc., which are what GEP is lowered into. This has the
304 GEP does use target-dependent parameters for the size and layout of data types,
308 fix a lot of code in the backend, with GEP lowering being only a small piece of
314 GEPs don't natively support VLAs. LLVM's type system is entirely static, and GEP
319 ``X[a*m+b*n+c]``, so that it appears to the GEP as a single-dimensional array
338 operand to the GEP. Indices greater than the number of elements in the
360 With the ``inbounds`` keyword, the result value of the GEP is undefined if the
366 address of allocated and sufficiently aligned memory. But the GEP itself is only
382 Can I do GEP with a different pointer type than the type of the underlying object?
386 pointer type. The types in a GEP serve only to define the parameters for the
398 You can compute an address that way, but if you use GEP to do the add, you can't
411 of GEP's special aliasing rules do not apply to pointers computed from ptrtoint,
417 As with arithmetic on null, you can use GEP to compute an address that way, but
434 What happens if a GEP computation overflows?
437 If the GEP lacks the ``inbounds`` keyword, the value is the result from
442 If the GEP has the ``inbounds`` keyword, the result value is undefined (a "trap
443 value") if the GEP overflows (i.e. wraps around the end of the address space).
471 Why is GEP designed this way?
474 The design of GEP has the following goals, in rough unofficial order of
481 particular, GEP is a cornerstone of LLVM's `pointer aliasing
513 emit a GEP with the base pointer casted to a simple address-unit pointer, using
515 sufficient to preserve the pointer aliasing guarantees that GEP provides.
524 #. The GEP instruction never accesses memory, it only provides pointer
527 #. The first operand to the GEP instruction is always a pointer and it must be
530 #. There are no superfluous indices for the GEP instruction.