diff options
author | Duncan Sands <baldrick@free.fr> | 2012-11-13 12:59:33 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-11-13 12:59:33 +0000 |
commit | 2333e29be441d9d55920651e0b2add23ab0c1613 (patch) | |
tree | a81026fd460acee57a8305816fea3c2a75879aee /docs/LangRef.html | |
parent | 563e8fce2ee22b21beb40ac65a6eaf2199d30414 (diff) |
Relax the restrictions on vector of pointer types, and vector getelementptr.
Previously in a vector of pointers, the pointer couldn't be any pointer type,
it had to be a pointer to an integer or floating point type. This is a hassle
for dragonegg because the GCC vectorizer happily produces vectors of pointers
where the pointer is a pointer to a struct or whatever. Vector getelementptr
was restricted to just one index, but now that vectors of pointers can have
any pointer type it is more natural to allow arbitrary vector getelementptrs.
There is however the issue of struct GEPs, where if each lane chose different
struct fields then from that point on each lane will be working down into
unrelated types. This seems like too much pain for too little gain, so when
you have a vector struct index all the elements are required to be the same.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LangRef.html')
-rw-r--r-- | docs/LangRef.html | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html index ed47f1f00ed..cdb76848e2d 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -5419,9 +5419,11 @@ specified by the <var>operation</var> argument:</p> <p>The type of each index argument depends on the type it is indexing into. When indexing into a (optionally packed) structure, only <tt>i32</tt> - integer <b>constants</b> are allowed. When indexing into an array, pointer - or vector, integers of any width are allowed, and they are not required to be - constant. These integers are treated as signed values where relevant.</p> + integer <b>constants</b> are allowed (when using a vector of indices they + must all be the <b>same</b> <tt>i32</tt> integer constant). When indexing + into an array, pointer or vector, integers of any width are allowed, and + they are not required to be constant. These integers are treated as signed + values where relevant.</p> <p>For example, let's consider a C code fragment and how it gets compiled to LLVM:</p> @@ -5520,9 +5522,8 @@ define i32* @foo(%struct.ST* %s) { %iptr = getelementptr [10 x i32]* @arr, i16 0, i16 0 </pre> -<p>In cases where the pointer argument is a vector of pointers, only a - single index may be used, and the number of vector elements has to be - the same. For example: </p> +<p>In cases where the pointer argument is a vector of pointers, each index must + be a vector with the same number of elements. For example: </p> <pre class="doc_code"> %A = getelementptr <4 x i8*> %ptrs, <4 x i64> %offsets, </pre> |