From 1608769abeb1430dc34f31ffac0d9850f99ae36a Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Mon, 5 Dec 2011 06:29:09 +0000 Subject: Add support for vectors of pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145801 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'docs') diff --git a/docs/LangRef.html b/docs/LangRef.html index 2329bdb1c8..12c140f823 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -2189,8 +2189,8 @@ in signal handlers).

The number of elements is a constant integer value larger than 0; elementtype - may be any integer or floating point type. Vectors of size zero are not - allowed, and pointers are not allowed as the element type.

+ may be any integer or floating point type, or a pointer to these types. + Vectors of size zero are not allowed.

Examples:
@@ -2206,6 +2206,10 @@ in signal handlers).

+ + + +
<2 x i64> Vector of 2 64-bit integer values.
<4 x i64*>Vector of 4 pointers to 64-bit integer values.
@@ -5069,6 +5073,7 @@ specified by the operation argument:

   <result> = getelementptr <pty>* <ptrval>{, <ty> <idx>}*
   <result> = getelementptr inbounds <pty>* <ptrval>{, <ty> <idx>}*
+  <result> = getelementptr <ptr vector> ptrval, <vector index type> idx 
 
Overview:
@@ -5077,7 +5082,8 @@ specified by the operation argument:

It performs address calculation only and does not access memory.

Arguments:
-

The first argument is always a pointer, and forms the basis of the +

The first argument is always a pointer or a vector of pointers, + and forms the basis of the calculation. The remaining arguments are indices that indicate which of the elements of the aggregate object are indexed. The interpretation of each index is dependent on the type being indexed into. The first index always @@ -5162,7 +5168,9 @@ entry: precise signed arithmetic are not an in bounds address of that allocated object. The in bounds addresses for an allocated object are all the addresses that point into the object, plus the address one - byte past the end.

+ byte past the end. + In cases where the base is a vector of pointers the inbounds keyword + applies to each of the computations element-wise.

If the inbounds keyword is not present, the offsets are added to the base address with silently-wrapping two's complement arithmetic. If the @@ -5189,6 +5197,13 @@ entry: %iptr = getelementptr [10 x i32]* @arr, i16 0, i16 0 +

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:

+
+ %A = getelementptr <4 x i8*> %ptrs, <4 x i64> %offsets,
+
+ @@ -5561,13 +5576,16 @@ entry:
Overview:
-

The 'ptrtoint' instruction converts the pointer value to - the integer type ty2.

+

The 'ptrtoint' instruction converts the pointer or a vector of + pointers value to + the integer (or vector of integers) type ty2.

Arguments:

The 'ptrtoint' instruction takes a value to cast, which - must be a pointer value, and a type to cast it to - ty2, which must be an integer type.

+ must be a a value of type pointer or a vector of + pointers, and a type to cast it to + ty2, which must be an integer or a vector + of integers type.

Semantics:

The 'ptrtoint' instruction converts value to integer type @@ -5580,8 +5598,9 @@ entry:

Example:
-  %X = ptrtoint i32* %X to i8           ; yields truncation on 32-bit architecture
-  %Y = ptrtoint i32* %x to i64          ; yields zero extension on 32-bit architecture
+  %X = ptrtoint i32* %P to i8                         ; yields truncation on 32-bit architecture
+  %Y = ptrtoint i32* %P to i64                        ; yields zero extension on 32-bit architecture
+  %Z = ptrtoint <4 x i32*> %P to <4 x i64>; yields vector zero extension for a vector of addresses on 32-bit architecture
 
@@ -5620,6 +5639,7 @@ entry: %X = inttoptr i32 255 to i32* ; yields zero extension on 64-bit architecture %Y = inttoptr i32 255 to i32* ; yields no-op on 32-bit architecture %Z = inttoptr i64 0 to i32* ; yields truncation on 32-bit architecture + %Z = inttoptr <4 x i32> %G to <4 x i8*>; yields truncation of vector G to four pointers @@ -5654,8 +5674,9 @@ entry:

The 'bitcast' instruction converts value to type ty2. It is always a no-op cast because no bits change with this conversion. The conversion is done as if the value had been - stored to memory and read back as type ty2. Pointer types may only - be converted to other pointer types with this instruction. To convert + stored to memory and read back as type ty2. + Pointer (or vector of pointers) types may only be converted to other pointer + (or vector of pointers) types with this instruction. To convert pointers to other types, use the inttoptr or ptrtoint instructions first.

@@ -5663,7 +5684,8 @@ entry:
   %X = bitcast i8 255 to i8              ; yields i8 :-1
   %Y = bitcast i32* %x to sint*          ; yields sint*:%x
-  %Z = bitcast <2 x int> %V to i64;      ; yields i64: %V
+  %Z = bitcast <2 x int> %V to i64;        ; yields i64: %V
+  %Z = bitcast <2 x i32*> %V to <2 x i64*> ; yields <2 x i64*>
 
@@ -5694,8 +5716,8 @@ entry:
Overview:

The 'icmp' instruction returns a boolean value or a vector of - boolean values based on comparison of its two integer, integer vector, or - pointer operands.

+ boolean values based on comparison of its two integer, integer vector, + pointer, or pointer vector operands.

Arguments:

The 'icmp' instruction takes three operands. The first operand is -- cgit v1.2.3