X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=09903f1016be76acc2decca4a81db68375ee86be;hb=4a6da60787fcc66c521288fbd139cf8afdca5957;hp=bacc3a3fa0608a7a9a6ae1efd463cc0eeffa12f9;hpb=0dbb4a13986521a5e1961837e091973a42be2d6c;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index bacc3a3fa06..09903f1016b 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -763,8 +763,8 @@ a power of 2.

Aliases act as "second name" for the aliasee value (which can be either - function or global variable or bitcast of global value). Aliases may have an - optional linkage type, and an + function, global variable, another alias or bitcast of global value). Aliases + may have an optional linkage type, and an optional visibility style.

Syntax:
@@ -829,6 +829,7 @@ declare i32 @atoi(i8*) nounwind readonly
sret
This indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program. + Loads and stores to the structure are assumed not to trap. May only be applied to the first parameter.
noalias
@@ -842,10 +843,11 @@ declare i32 @atoi(i8*) nounwind readonly an unreachable instruction immediately followed the call.
nounwind
-
This function attribute indicates that the function type does not use - the unwind instruction and does not allow stack unwinding to propagate - through it.
- +
This function attribute indicates that no exceptions unwind out of the + function. Usually this is because the function makes no use of exceptions, + but it may also be that the function catches any exceptions thrown when + executing it.
+
nest
This indicates that the parameter can be excised using the trampoline intrinsics.
@@ -1223,8 +1225,10 @@ type "{ i32, [0 x float]}", for example.

Overview:

The function type can be thought of as a function signature. It -consists of a return type and a list of formal parameter types. -Function types are usually used to build virtual function tables +consists of a return type and a list of formal parameter types. The +return type of a function type is a scalar type or a void type or a struct type. +If the return type is a struct type then all struct elements must be of first +class types. Function types are usually used to build virtual function tables (which are structures of pointers to functions), for indirect function calls, and when defining a function.

@@ -1258,6 +1262,11 @@ Variable argument functions can access their arguments with the printf in LLVM. + + {i32, i32} (i32) + A function taking an i32>, returning two + i32 values as an aggregate of type { i32, i32 } + @@ -1456,8 +1465,10 @@ them all and their syntax.

Floating point constants use standard decimal notation (e.g. 123.421), exponential notation (e.g. 1.23421e+2), or a more precise hexadecimal - notation (see below). Floating point constants must have a floating point type.
+ notation (see below). The assembler requires the exact decimal value of + a floating-point constant. For example, the assembler accepts 1.25 but + rejects 1.3 because 1.3 is a repeating decimal in binary. Floating point + constants must have a floating point type.
Null pointer constants
@@ -1914,7 +1925,7 @@ branches or with a lookup table.

Syntax:
-  <result> = invoke [cconv] <ptr to function ty> %<function ptr val>(<function args>) 
+  <result> = invoke [cconv] <ptr to function ty> <function ptr val>(<function args>) 
                 to label <normal label> unwind label <exception label>
 
@@ -1977,9 +1988,9 @@ exception. Additionally, this is important for implementation of
Example:
-  %retval = invoke i32 %Test(i32 15) to label %Continue
+  %retval = invoke i32 @Test(i32 15) to label %Continue
               unwind label %TestCleanup              ; {i32}:retval set
-  %retval = invoke coldcc i32 %Test(i32 15) to label %Continue
+  %retval = invoke coldcc i32 %Testfnptr(i32 15) to label %Continue
               unwind label %TestCleanup              ; {i32}:retval set
 
@@ -2044,11 +2055,10 @@ no-return function cannot be reached, and other facts.

Binary Operations

Binary operators are used to do most of the computation in a -program. They require two operands, execute an operation on them, and +program. They require two operands of the same type, execute an operation on them, and produce a single value. The operands might represent multiple data, as is the case with the vector data type. -The result value of a binary operator is not -necessarily the same type as its operands.

+The result value has the same type as its operands.

There are several different binary operators:

@@ -2181,7 +2191,7 @@ operands.

types. This instruction can also take vector versions of the values in which case the elements must be integers.

Semantics:
-

The value produced is the signed integer quotient of the two operands.

+

The value produced is the signed integer quotient of the two operands rounded towards zero.

Note that signed integer division and unsigned integer division are distinct operations; for unsigned integer division, use 'udiv'.

Division by zero leads to undefined behavior. Overflow also leads to @@ -2229,8 +2239,7 @@ types. This instruction can also take vector versions of the values in which case the elements must be integers.

Semantics:

This instruction returns the unsigned integer remainder of a division. -This instruction always performs an unsigned division to get the remainder, -regardless of whether the arguments are unsigned or not.

+This instruction always performs an unsigned division to get the remainder.

Note that unsigned integer remainder and signed integer remainder are distinct operations; for signed integer remainder, use 'srem'.

Taking the remainder of a division by zero leads to undefined behavior.

@@ -2294,7 +2303,8 @@ division of its two operands.

identical types. This instruction can also take vector versions of floating point values.

Semantics:
-

This instruction returns the remainder of a division.

+

This instruction returns the remainder of a division. +The remainder has the same sign as the dividend.

Example:
  <result> = frem float 4.0, %var          ; yields {float}:result = 4.0 % %var
 
@@ -2307,9 +2317,8 @@ Operations

Bitwise binary operators are used to do various forms of bit-twiddling in a program. They are generally very efficient instructions and can commonly be strength reduced from other -instructions. They require two operands, execute an operation on them, -and produce a single value. The resulting value of the bitwise binary -operators is always the same type as its first operand.

+instructions. They require two operands of the same type, execute an operation on them, +and produce a single value. The resulting value is the same type as its operands.

@@ -2332,9 +2341,9 @@ the left a specified number of bits.

Semantics:
-

The value produced is var1 * 2var2. If -var2 is (statically or dynamically) equal to or larger than the number -of bits in var1, the result is undefined.

+

The value produced is var1 * 2var2 mod 2n, +where n is the width of the result. If var2 is (statically or dynamically) negative or +equal to or larger than the number of bits in var1, the result is undefined.

Example:
   <result> = shl i32 4, %var   ; yields {i32}: 4 << %var
@@ -2778,7 +2787,7 @@ address space (address space zero).

bytes of memory from the operating system and returns a pointer of the appropriate type to the program. If "NumElements" is specified, it is the number of elements allocated, otherwise "NumElements" is defaulted to be one. -If an alignment is specified, the value result of the allocation is guaranteed to +If a constant alignment is specified, the value result of the allocation is guaranteed to be aligned to at least that boundary. If not specified, or if zero, the target can choose to align the allocation on any convenient boundary.

@@ -2787,7 +2796,8 @@ choose to align the allocation on any convenient boundary.

Semantics:

Memory is allocated using the system "malloc" function, and -a pointer is returned.

+a pointer is returned. Allocating zero bytes is undefined. The result is null +if there is insufficient memory available.

Example:
@@ -2829,7 +2839,8 @@ instruction.

Semantics:

Access to the memory pointed to by the pointer is no longer defined -after this instruction executes.

+after this instruction executes. If the pointer is null, the result is +undefined.

Example:
@@ -2865,7 +2876,7 @@ space (address space zero).

bytes of memory on the runtime stack, returning a pointer of the appropriate type to the program. If "NumElements" is specified, it is the number of elements allocated, otherwise "NumElements" is defaulted to be one. -If an alignment is specified, the value result of the allocation is guaranteed +If a constant alignment is specified, the value result of the allocation is guaranteed to be aligned to at least that boundary. If not specified, or if zero, the target can choose to align the allocation on any convenient boundary.

@@ -2878,7 +2889,8 @@ memory is automatically released when the function returns. The 'allocaret or unwind -instructions), the memory is reclaimed.

+instructions), the memory is reclaimed. Allocating zero bytes +is legal, but the result is undefined.

Example:
@@ -2907,7 +2919,7 @@ the number or order of execution of this load with other volatile load and store instructions.

-The optional "align" argument specifies the alignment of the operation +The optional constant "align" argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an omitted "align" argument means that the operation has the preferential alignment for the target. It is the responsibility of the code emitter @@ -2938,13 +2950,14 @@ Instruction

Arguments:

There are two arguments to the 'store' instruction: a value to store and an address at which to store it. The type of the '<pointer>' -operand must be a pointer to the type of the '<value>' +operand must be a pointer to the first class type +of the '<value>' operand. If the store is marked as volatile, then the optimizer is not allowed to modify the number or order of execution of this store with other volatile load and store instructions.

-The optional "align" argument specifies the alignment of the operation +The optional constant "align" argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an omitted "align" argument means that the operation has the preferential alignment for the target. It is the responsibility of the code emitter @@ -3034,8 +3047,8 @@ entry: on the pointer type that is being indexed into. Pointer and array types can use a 32-bit or 64-bit integer type but the value will always be sign extended -to 64-bits. Structure types require i32 -constants.

+to 64-bits. Structure and packed +structure types require i32 constants.

In the example above, the first index is indexing into the '%ST*' type, which is a pointer, yielding a '%ST' = '{ i32, double, %RT @@ -3543,7 +3556,7 @@ instructions, which defy better classification.

Overview:

The 'icmp' instruction returns a boolean value based on comparison -of its two integer operands.

+of its two integer or pointer operands.

Arguments:

The 'icmp' instruction takes three operands. The first operand is the condition code indicating the kind of comparison to perform. It is not @@ -3817,25 +3830,23 @@ transfer to a specified function, with its incoming arguments bound to the specified values. Upon a 'ret' instruction in the called function, control flow continues with the instruction after the function call, and the return value of the -function is bound to the result argument. If the 'ret -' instruction returns multiple values then the return values of the -function are only accessible through a 'getresult -' instruction. This is a simpler case of -the invoke instruction.

+function is bound to the result argument. If the callee returns multiple +values then the return values of the function are only accessible through +the 'getresult' instruction.

Example:
   %retval = call i32 @test(i32 %argc)
-  call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42);
-  %X = tail call i32 @foo()
-  %Y = tail call fastcc i32 @foo()
-  %Z = call void %foo(i8 97 signext)
+  call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42)      ; yields i32
+  %X = tail call i32 @foo()                                    ; yields i32
+  %Y = tail call fastcc i32 @foo()  ; yields i32
+  call void %foo(i8 97 signext)
 
   %struct.A = type { i32, i8 }
-  %r = call %struct.A @foo()
-  %gr = getresult %struct.A %r, 0
-  %gr1 = getresult %struct.A %r, 1
+  %r = call %struct.A @foo()                     ; yields { 32, i8 }
+  %gr = getresult %struct.A %r, 0                ; yields i32
+  %gr1 = getresult %struct.A %r, 1               ; yields i8
 
@@ -3897,24 +3908,27 @@ argument.

Syntax:
-  <resultval> = getresult <type> <retval>,  <index>
+  <resultval> = getresult <type> <retval>, <index>
 
+
Overview:

The 'getresult' instruction is used to extract individual values -from multiple values returned by a 'call' -or 'invoke' instruction. +from a 'call' +or 'invoke' instruction that returns multiple +results.

Arguments:
-The 'getresult' instruction takes a return value as first argument. -The value must have structure type. The second argument -is an unsigned index value. +

The 'getresult' instruction takes a call or invoke value as its +first argument. The value must have structure type. +The second argument is a constant unsigned index value which must be in range for +the number of values returned by the call.

Semantics:
-The 'getresult' instruction extracts the element identified by -'index' from the aggregate value. +

The 'getresult' instruction extracts the element identified by +'index' from the aggregate value.

Example:
@@ -3922,8 +3936,8 @@ The 'getresult' instruction extracts the element identified by %struct.A = type { i32, i8 } %r = call %struct.A @foo() - %gr = getresult %struct.A %r, 0 - %gr1 = getresult %struct.A %r, 1 + %gr = getresult %struct.A %r, 0 ; yields i32:%gr + %gr1 = getresult %struct.A %r, 1 ; yields i8:%gr1 add i32 %gr, 42 add i8 %gr1, 41