X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=15f95e2a11c477052022048040e426d6bb0ed6f2;hb=445c89a83c97176179c54bf5fbc344a597f0ed38;hp=c07d0e0d5920245243e64a9eb76faa39defd1c3a;hpb=9f805c206ee85d6730c809b6fec1fd5989bd9b04;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index c07d0e0d592..15f95e2a11c 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -41,6 +41,7 @@
If a function that has an ssp attribute is inlined into a function
+
If a function that has an ssp attribute is inlined into a function
that doesn't have an ssp attribute, then the resulting function will
-have an ssp attribute.
If a function that has an sspreq attribute is inlined into a +If a function that has an sspreq attribute is inlined into a function that doesn't have an sspreq attribute or which has an ssp attribute, then the resulting function will have -an sspreq attribute.
When constructing the data layout for a given target, LLVM starts with a default set of specifications which are then (possibly) overriden by the @@ -1189,6 +1204,7 @@ are given in this list:
When LLVM is determining the alignment for a given type, it uses the following rules:
@@ -1251,14 +1267,16 @@ classifications: vector, structure, array, - label. + label, + metadata.The metadata type represents embedded metadata. The only derived type that +may contain metadata is metadata* or a function type that returns or +takes metadata typed parameters, but not pointer to metadata types.
+ ++ metadata ++
i1 | -a single-bit integer. | -
i32 | -a 32-bit integer. | -
i1942652 | -a really big integer of over 1 million bits. | +
i1 | +a single-bit integer. | +
i32 | +a 32-bit integer. | +
i1942652 | +a really big integer of over 1 million bits. |
Note that the code generator does not yet support large integer types @@ -1862,10 +1896,11 @@ constants and smaller complex constants.
Embedded metadata provides a way to attach arbitrary data to the instruction stream without affecting the behaviour of the program. There are -two metadata primitives, strings and nodes. All metadata has the type of an -empty struct and is identified in syntax by a preceding exclamation point -('!'). +two metadata primitives, strings and nodes. All metadata has the +metadata type and is identified in syntax by a preceding exclamation +point ('!').
A metadata string is a string surrounded by double quotes. It can contain @@ -2055,9 +2084,13 @@ the two digit hex code. For example: "!"test\00"".
Metadata nodes are represented with notation similar to structure constants (a comma separated list of elements, surrounded by braces and preceeded by an -exclamation point). For example: "!{ { } !"test\00", i32 10}". +exclamation point). For example: "!{ metadata !"test\00", i32 10}".
+A metadata node will attempt to track changes to the values it holds. In +the event that a value is deleted, it will be replaced with a typeless +"null", such as "metadata !{null, i32 10}".
+Optimizations may rely on metadata to provide additional information about the program that isn't available in the instructions, or that isn't easily computable. Similarly, the code generator may expect a certain metadata format @@ -2237,7 +2270,7 @@ argument is evaluated. If the value is true, control flows to the 'iftrue' label argument. If "cond" is false, control flows to the 'iffalse' label argument.
Test:@@ -2376,6 +2409,11 @@ cleanup is performed in the case of either a longjmp or a thrown exception. Additionally, this is important for implementation of 'catch' clauses in high-level languages that support them. +
%cond = icmp eq, i32 %a, %b
br i1 %cond, label %IfEqual, label %IfUnequal
IfEqual:
Test:
%cond = icmp eq i32 %a, %b
br i1 %cond, label %IfEqual, label %IfUnequal
IfEqual:
ret i32 1
IfUnequal:
ret i32 0
For the purposes of the SSA form, the definition of the value +returned by the 'invoke' instruction is deemed to occur on +the edge from the current block to the "normal" label. If the callee +unwinds then no return value is available.
+%retval = invoke i32 @Test(i32 15) to label %Continue @@ -2471,16 +2509,15 @@ The result value has the same type as its operands.or + vector of integer values. Both arguments must + have identical types.Arguments:
The two arguments to the 'add' instruction must be integer, floating point, or - vector values. Both arguments must have identical - types.
+ href="#t_integer">integer
The value produced is the integer or floating point sum of the two -operands.
+The value produced is the integer sum of the two operands.
-If an integer sum has unsigned overflow, the result returned is the +
If the sum has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.
@@ -2494,6 +2531,39 @@ instruction is appropriate for both signed and unsigned integers. + + ++ <result> = fadd <ty> <op1>, <op2> ; yields {ty}:result ++ +
The 'fadd' instruction returns the sum of its two operands.
+ +The two arguments to the 'fadd' instruction must be +floating point or vector of +floating point values. Both arguments must have identical types.
+ +The value produced is the floating point sum of the two operands.
+ ++ <result> = fadd float 4.0, %var ; yields {float}:result = 4.0 + %var ++
The two arguments to the 'sub' instruction must be integer, floating point, - or vector values. Both arguments must have identical - types.
+ href="#t_integer">integer or vector of + integer values. Both arguments must have identical types.The value produced is the integer or floating point difference of -the two operands.
+The value produced is the integer difference of the two operands.
-If an integer difference has unsigned overflow, the result returned is the +
If the difference has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.
@@ -2541,6 +2609,45 @@ instruction is appropriate for both signed and unsigned integers. + + + ++ <result> = fsub <ty> <op1>, <op2> ; yields {ty}:result ++ +
The 'fsub' instruction returns the difference of its two +operands.
+ +Note that the 'fsub' instruction is used to represent the +'fneg' instruction present in most other intermediate +representations.
+ +The two arguments to the 'fsub' instruction must be floating point or vector + of floating point values. Both arguments must have identical types.
+ +The value produced is the floating point difference of the two operands.
+ ++ <result> = fsub float 4.0, %var ; yields {float}:result = 4.0 - %var + <result> = fsub float -0.0, %val ; yields {float}:result = -%var ++
The two arguments to the 'mul' instruction must be integer, floating point, -or vector values. Both arguments must have identical -types.
+href="#t_integer">integer or vector of integer +values. Both arguments must have identical types.The value produced is the integer or floating point product of the -two operands.
+The value produced is the integer product of the two operands.
-If the result of an integer multiplication has unsigned overflow, +
If the result of the multiplication has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.
Because LLVM integers use a two's complement representation, and the @@ -2581,6 +2686,35 @@ width of the full product.
<result> = fmul <ty> <op1>, <op2> ; yields {ty}:result ++
The 'fmul' instruction returns the product of its two +operands.
+ +The two arguments to the 'fmul' instruction must be +floating point or vector +of floating point values. Both arguments must have identical types.
+ +The value produced is the floating point product of the two operands.
+ +<result> = fmul float 4.0, %var ; yields {float}:result = 4.0 * %var ++
'type' must be a sized type.
@@ -3481,15 +3616,16 @@ 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 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. +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 +compatible with the type.'type' may be any sized type.
Memory is allocated; a pointer is returned. The operation is undefiend if +
Memory is allocated; a pointer is returned. The operation is undefined if there is insufficient stack space for the allocation. 'alloca'd memory is automatically released when the function returns. The 'alloca' instruction is commonly used to represent automatic variables that must @@ -3629,9 +3765,7 @@ the pointer before continuing calculation.
The type of each index argument depends on the type it is indexing into. When indexing into a (packed) structure, only i32 integer constants are allowed. When indexing into an array, pointer or vector, -only integers of 16, 32 or 64 bits are allowed (also non-constants). 16-bit -values will be sign extended to 32-bits if required, and 32-bit values -will be sign extended to 64-bits if required.
+integers of any width are allowed (also non-constants).For example, let's consider a C code fragment and how it gets compiled to LLVM:
@@ -4360,109 +4494,6 @@ always yields an i1 result, as follows: - - -<result> = vicmp <cond> <ty> <op1>, <op2> ; yields {ty}:result --
The 'vicmp' instruction returns an integer vector value based on -element-wise comparison of its two integer vector operands.
-The 'vicmp' instruction takes three operands. The first operand is -the condition code indicating the kind of comparison to perform. It is not -a value, just a keyword. The possible condition code are:
-The remaining two arguments must be vector or -integer typed. They must also be identical types.
-The 'vicmp' instruction compares op1 and op2 -according to the condition code given as cond. The comparison yields a -vector of integer result, of -identical type as the values being compared. The most significant bit in each -element is 1 if the element-wise comparison evaluates to true, and is 0 -otherwise. All other bits of the result are undefined. The condition codes -are evaluated identically to the 'icmp' -instruction.
- -- <result> = vicmp eq <2 x i32> < i32 4, i32 0>, < i32 5, i32 0> ; yields: result=<2 x i32> < i32 0, i32 -1 > - <result> = vicmp ult <2 x i8 > < i8 1, i8 2>, < i8 2, i8 2 > ; yields: result=<2 x i8> < i8 -1, i8 0 > --
<result> = vfcmp <cond> <ty> <op1>, <op2>-
The 'vfcmp' instruction returns an integer vector value based on -element-wise comparison of its two floating point vector operands. The output -elements have the same width as the input elements.
-The 'vfcmp' instruction takes three operands. The first operand is -the condition code indicating the kind of comparison to perform. It is not -a value, just a keyword. The possible condition code are:
-The remaining two arguments must be vector of -floating point typed. They must also be identical -types.
-The 'vfcmp' instruction compares op1 and op2 -according to the condition code given as cond. The comparison yields a -vector of integer result, with -an identical number of elements as the values being compared, and each element -having identical with to the width of the floating point elements. The most -significant bit in each element is 1 if the element-wise comparison evaluates to -true, and is 0 otherwise. All other bits of the result are undefined. The -condition codes are evaluated identically to the -'fcmp' instruction.
- -- ; yields: result=<2 x i32> < i32 0, i32 -1 > - <result> = vfcmp oeq <2 x float> < float 4, float 0 >, < float 5, float 0 > - - ; yields: result=<2 x i64> < i64 -1, i64 0 > - <result> = vfcmp ult <2 x double> < double 1, double 2 >, < double 2, double 2> --
For the purposes of the SSA form, the use of each incoming value is +deemed to occur on the edge from the corresponding predecessor block +to the current block (but after any definition of an 'invoke' +instruction's return value on the same edge).
+At runtime, the 'phi' instruction logically takes on the value @@ -5904,110 +5940,6 @@ of src. For example, llvm.cttz(2) = 1.
This is an overloaded intrinsic. You can use llvm.part.select -on any integer bit width.
-- declare i17 @llvm.part.select.i17 (i17 %val, i32 %loBit, i32 %hiBit) - declare i29 @llvm.part.select.i29 (i29 %val, i32 %loBit, i32 %hiBit) -- -
The 'llvm.part.select' family of intrinsic functions selects a -range of bits from an integer value and returns them in the same bit width as -the original value.
- -The first argument, %val and the result may be integer types of -any bit width but they must have the same bit width. The second and third -arguments must be i32 type since they specify only a bit index.
- -The operation of the 'llvm.part.select' intrinsic has two modes -of operation: forwards and reverse. If %loBit is greater than -%hiBits then the intrinsic operates in reverse mode. Otherwise it -operates in forward mode.
-In forward mode, this intrinsic is the equivalent of shifting %val -right by %loBit bits and then ANDing it with a mask with -only the %hiBit - %loBit bits set, as follows:
-In reverse mode, a similar computation is made except that the bits are -returned in the reverse order. So, for example, if X has the value -i16 0x0ACF (101011001111) and we apply -part.select(i16 X, 8, 3) to it, we get back the value -i16 0x0026 (000000100110).
-This is an overloaded intrinsic. You can use llvm.part.set -on any integer bit width.
-- declare i17 @llvm.part.set.i17.i9 (i17 %val, i9 %repl, i32 %lo, i32 %hi) - declare i29 @llvm.part.set.i29.i9 (i29 %val, i9 %repl, i32 %lo, i32 %hi) -- -
The 'llvm.part.set' family of intrinsic functions replaces a range -of bits in an integer value with another integer value. It returns the integer -with the replaced bits.
- -The first argument, %val, and the result may be integer types of -any bit width, but they must have the same bit width. %val is the value -whose bits will be replaced. The second argument, %repl may be an -integer of any bit width. The third and fourth arguments must be i32 -type since they specify only a bit index.
- -The operation of the 'llvm.part.set' intrinsic has two modes -of operation: forwards and reverse. If %lo is greater than -%hi then the intrinsic operates in reverse mode. Otherwise it -operates in forward mode.
- -For both modes, the %repl value is prepared for use by either -truncating it down to the size of the replacement area or zero extending it -up to that size.
- -In forward mode, the bits between %lo and %hi (inclusive) -are replaced with corresponding bits from %repl. That is the 0th bit -in %repl replaces the %loth bit in %val and etc. up -to the %hith bit.
- -In reverse mode, a similar computation is made except that the bits are -reversed. That is, the 0th bit in %repl replaces the -%hi bit in %val and etc. down to the %loth bit.
- -- llvm.part.set(0xFFFF, 0, 4, 7) -> 0xFF0F - llvm.part.set(0xFFFF, 0, 7, 4) -> 0xFF0F - llvm.part.set(0xFFFF, 1, 7, 4) -> 0xFF8F - llvm.part.set(0xFFFF, F, 8, 3) -> 0xFFE7 - llvm.part.set(0xFFFF, 0, 3, 8) -> 0xFE07 -- -
Warning: 'llvm.umul.with.overflow' is badly broken. It is -actively being fixed, but it should not currently be used!
-The 'llvm.umul.with.overflow' family of intrinsic functions perform a unsigned multiplication of the two arguments, and indicate whether an overflow occurred during the unsigned multiplication.