X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=45f6f38f598fc9c34bc7b9ce70feb8905d7b2f40;hb=9e6d1d1f5034347d237941f1bf08fba5c1583cd3;hp=1b1655e42fddb2e7423c041bfe41ab04557518af;hpb=8040cd3cfd7b87661c08ca916daf355593dd8ffa;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 1b1655e42fd..45f6f38f598 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -5,7 +5,7 @@
...because the definition of %x does not dominate all of its - uses. The LLVM infrastructure provides a verification pass that may be used - to verify that an LLVM module is well formed. This pass is automatically run - by the parser after parsing input assembly and by the optimizer before it - outputs bitcode. The violations pointed out by the verifier pass indicate - bugs in transformation passes or input to the parser.
+because the definition of %x does not dominate all of its uses. The + LLVM infrastructure provides a verification pass that may be used to verify + that an LLVM module is well formed. This pass is automatically run by the + parser after parsing input assembly and by the optimizer before it outputs + bitcode. The violations pointed out by the verifier pass indicate bugs in + transformation passes or input to the parser.
@@ -430,8 +440,8 @@-add i32 %X, %X ; yields {i32}:%0 -add i32 %0, %0 ; yields {i32}:%1 +%0 = add i32 %X, %X ; yields {i32}:%0 +%1 = add i32 %0, %0 ; yields {i32}:%1 %result = add i32 %1, %1
...and it also shows a convention that we follow in this document. When +
It also shows a convention that we follow in this document. When demonstrating instructions, we will follow an instruction with a comment that defines the type and name of value produced. Comments are shown in italic text.
@@ -474,24 +484,21 @@ the "hello world" module:; Declare the string constant as a global constant... -@.LC0 = internal constant [13 x i8] c"hello world\0A\00" ; [13 x i8]* ++; Declare the string constant as a global constant. +@.LC0 = internal constant [13 x i8] c"hello world\0A\00" ; [13 x i8]* ; External declaration of the puts function -declare i32 @puts(i8 *) ; i32(i8 *)* +declare i32 @puts(i8 *) ; i32(i8 *)* ; Definition of main function -define i32 @main() { ; i32()* - ; Convert [13 x i8]* to i8 *... - %cast210 = getelementptr [13 x i8]* @.LC0, i64 0, i64 0 ; i8 * +define i32 @main() { ; i32()* + ; Convert [13 x i8]* to i8 *... + %cast210 = getelementptr [13 x i8]* @.LC0, i64 0, i64 0 ; i8 * - ; Call puts function to write out the string to stdout... - call i32 @puts(i8 * %cast210) ; i32 - ret i32 0
}
+ ; Call puts function to write out the string to stdout. + call i32 @puts(i8 * %cast210) ; i32 + ret i32 0
}
__imp_
and the function or variable
name.LLVM function declarations consist of the "declare" keyword, an optional linkage type, an optional - visibility style, an optional + visibility style, an optional calling convention, a return type, an optional parameter attribute for the return type, a function name, a possibly empty list of arguments, an optional alignment, and an @@ -927,24 +934,24 @@ declare signext i8 @returns_signed_char()
Currently, only the following parameter attributes are defined:
-define void @f() gc "name" { ... +define void @f() gc "name" { ... }
When constructing the data layout for a given target, LLVM starts with a @@ -1428,11 +1442,6 @@ Classifications -
Note that the code generator does not yet support large integer types to be - used as function return types. The specific limit on how large a return type - the code generator can currently handle is target-dependent; currently it's - often 64 bits for 32-bit targets and 128 bits for 64-bit targets.
- @@ -1564,17 +1573,12 @@ Classifications -Note that 'variable sized arrays' can be implemented in LLVM with a zero - length array. Normally, accesses past the end of an array are undefined in - LLVM (e.g. it is illegal to access the 5th element of a 3 element array). As - a special case, however, zero length arrays are recognized to be variable - length. This allows implementation of 'pascal style arrays' with the LLVM - type "{ i32, [0 x float]}", for example.
- -Note that the code generator does not yet support large aggregate types to be - used as function return types. The specific limit on how large an aggregate - return type the code generator can currently handle is target-dependent, and - also dependent on the aggregate element types.
+There is no restriction on indexing beyond the end of the array implied by + a static type (though there are restrictions on indexing beyond the bounds + of an allocated object in some cases). This means that single-dimension + 'variable sized array' addressing can be implemented in LLVM with a zero + length array type. An implementation of 'pascal style arrays' in LLVM could + use the type "{ i32, [0 x float]}", for example.
@@ -1612,16 +1616,16 @@ ClassificationsNote that the code generator does not yet support large aggregate types to be - used as function return types. The specific limit on how large an aggregate - return type the code generator can currently handle is target-dependent, and - also dependent on the aggregate element types.
- @@ -1763,8 +1762,7 @@ ClassificationsA vector type is a simple derived type that represents a vector of elements. Vector types are used when multiple primitive data are operated in parallel using a single instruction (SIMD). A vector type requires a size (number of - elements) and an underlying primitive data type. Vectors must have a power - of two length (1, 2, 4, 8, 16 ...). Vector types are considered + elements) and an underlying primitive data type. Vector types are considered first class.
Note that the code generator does not yet support large vector types to be - used as function return types. The specific limit on how large a vector - return type codegen can currently handle is target-dependent; currently it's - often a few times longer than a hardware vector register.
- @@ -2061,9 +2054,9 @@ Unsafe: For example, if "%X" has a zero bit, then the output of the 'and' operation will always be a zero, no matter what the corresponding bit from the undef is. As such, it is unsafe to optimize or assume that the result of the and is undef. -However, it is safe to assume that all bits of the undef could be 0, and -optimize the and to 0. Likewise, it is safe to assume that all the bits of -the undef operand to the or could be set, allowing the or to be folded to +However, it is safe to assume that all bits of the undef could be 0, and +optimize the and to 0. Likewise, it is safe to assume that all the bits of +the undef operand to the or could be set, allowing the or to be folded to -1.%A = xor undef, undef - + %B = undef %C = xor %B, %B @@ -2144,7 +2137,7 @@ does not execute at all. This allows us to delete the divide and all code after it: since the undefined operation "can't happen", the optimizer can assume that it occurs in dead code. - +a: store undef -> %X @@ -2156,13 +2149,41 @@ b: unreachableThese examples reiterate the fdiv example: a store "of" an undefined value -can be assumed to not have any effect: we can assume that the value is +can be assumed to not have any effect: we can assume that the value is overwritten with bits that happen to match what was already there. However, a store "to" an undefined location could clobber arbitrary memory, therefore, it has undefined behavior.
blockaddress(@function, %block)
+ +The 'blockaddress' constant computes the address of the specified + basic block in the specified function, and always has an i8* type. Taking + the address of the entry block is illegal.
+ +This value only has defined behavior when used as an operand to the + 'indirectbr' instruction or for comparisons + against null. Pointer equality tests between labels addresses is undefined + behavior - though, again, comparison against null is ok, and no label is + equal to the null pointer. This may also be passed around as an opaque + pointer sized value as long as the bits are not inspected. This allows + ptrtoint and arithmetic to be performed on these values so long as + the original value is reconstituted before the indirectbr.
+ +Finally, some targets may provide defined semantics when + using the value as the operand to an inline assembly, but that is target + specific. +
+ +@@ -2359,6 +2382,22 @@ call void asm sideeffect "eieio", ""()
In some cases inline asms will contain code that will not work unless the + stack is aligned in some way, such as calls or SSE instructions on x86, + yet will not contain code that does that alignment within the asm. + The compiler should make conservative assumptions about what the asm might + contain and should generate its usual stack alignment code in the prologue + if the 'alignstack' keyword is present:
+ ++call void asm alignstack "eieio", ""() ++
If both keywords appear the 'sideeffect' keyword must come + first.
+TODO: The format of the asm and constraints string still need to be documented here. Constraints on what can be done (e.g. duplication, moving, etc need to be documented). This is probably best done by reference to @@ -2487,6 +2526,7 @@ Instructions
Note that the code generator does not yet fully support large - return values. The specific sizes that are currently supported are - dependent on the target. For integers, on 32-bit targets the limit - is often 64 bits, and on 64-bit targets the limit is often 128 bits. - For aggregate types, the current limits are dependent on the element - types; for example targets are often limited to 2 total integer - elements and 2 total floating-point elements.
- @@ -2645,6 +2677,55 @@ IfUnequal: + + + + ++ indirectbr <somety>* <address>, [ label <dest1>, label <dest2>, ... ] ++ +
The 'indirectbr' instruction implements an indirect branch to a label + within the current function, whose address is specified by + "address". Address must be derived from a blockaddress constant.
+ +The 'address' argument is the address of the label to jump to. The + rest of the arguments indicate the full set of possible destinations that the + address may point to. Blocks are allowed to occur multiple times in the + destination list, though this isn't particularly useful.
+ +This destination list is required so that dataflow analysis has an accurate + understanding of the CFG.
+ +Control transfers to the block specified in the address argument. All + possible destination blocks must be listed in the label list, otherwise this + instruction has undefined behavior. This implies that jumps to labels + defined in other functions have undefined behavior as well.
+ +This is typically implemented with a jump through a register.
+ ++ indirectbr i8* %Addr, [ label %bb1, label %bb2, label %bb3 ] ++ +
The two arguments to the 'mul' instruction must be integer or vector of integer values. Both arguments must have identical types.
- +The value produced is the integer product of the two operands.
@@ -3051,7 +3132,7 @@ InstructionThe 'udiv' instruction returns the quotient of its two operands.
The two arguments to the 'udiv' instruction must be +
The two arguments to the 'udiv' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3086,7 +3167,7 @@ InstructionThe 'sdiv' instruction returns the quotient of its two operands.
The two arguments to the 'sdiv' instruction must be +
The two arguments to the 'sdiv' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3157,7 +3238,7 @@ Instruction division of its two arguments.The two arguments to the 'urem' instruction must be +
The two arguments to the 'urem' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3197,7 +3278,7 @@ Instruction elements must be integers.The two arguments to the 'srem' instruction must be +
The two arguments to the 'srem' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3292,7 +3373,7 @@ InstructionBoth arguments to the 'shl' instruction must be the same integer or vector of integer type. 'op2' is treated as an unsigned value.
- +The value produced is op1 * 2op2 mod 2n, where n is the width of the result. If op2 @@ -3328,7 +3409,7 @@ Instruction operand shifted to the right a specified number of bits with zero fill.
Both arguments to the 'lshr' instruction must be the same +
Both arguments to the 'lshr' instruction must be the same integer or vector of integer type. 'op2' is treated as an unsigned value.
@@ -3368,7 +3449,7 @@ Instruction extension.Both arguments to the 'ashr' instruction must be the same +
Both arguments to the 'ashr' instruction must be the same integer or vector of integer type. 'op2' is treated as an unsigned value.
@@ -3408,7 +3489,7 @@ Instruction operands.The two arguments to the 'and' instruction must be +
The two arguments to the 'and' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3467,7 +3548,7 @@ Instruction two operands.The two arguments to the 'or' instruction must be +
The two arguments to the 'or' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3530,7 +3611,7 @@ Instruction complement" operation, which is the "~" operator in C.The two arguments to the 'xor' instruction must be +
The two arguments to the 'xor' instruction must be integer or vector of integer values. Both arguments must have identical types.
@@ -3578,7 +3659,7 @@ Instruction -- %result = extractelement <4 x i32> %vec, i32 0 ; yields i32 + <result> = extractelement <4 x i32> %vec, i32 0 ; yields i32@@ -3660,7 +3741,7 @@ Instruction
- %result = insertelement <4 x i32> %vec, i32 1, i32 0 ; yields <4 x i32> + <result> = insertelement <4 x i32> %vec, i32 1, i32 0 ; yields <4 x i32>@@ -3701,20 +3782,20 @@ Instruction
- %result = shufflevector <4 x i32> %v1, <4 x i32> %v2, + <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2, <4 x i32> <i32 0, i32 4, i32 1, i32 5> ; yields <4 x i32> - %result = shufflevector <4 x i32> %v1, <4 x i32> undef, + <result> = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> ; yields <4 x i32> - Identity shuffle. - %result = shufflevector <8 x i32> %v1, <8 x i32> undef, + <result> = shufflevector <8 x i32> %v1, <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> ; yields <4 x i32> - %result = shufflevector <4 x i32> %v1, <4 x i32> %v2, + <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 > ; yields <8 x i32>-
- %result = extractvalue {i32, float} %agg, 0 ; yields i32 + <result> = extractvalue {i32, float} %agg, 0 ; yields i32@@ -3792,14 +3873,14 @@ Instruction
- %result = insertvalue {i32, float} %agg, i32 1, 0 ; yields {i32, float} + <result> = insertvalue {i32, float} %agg, i32 1, 0 ; yields {i32, float}-
A key design point of an SSA-based representation is how it represents memory. In LLVM, no memory locations are in SSA form, which makes things - very simple. This section describes how to read, write, allocate, and free + very simple. This section describes how to read, write, and allocate memory in LLVM.
- - - -- <result> = malloc <type>[, i32 <NumElements>][, align <alignment>] ; yields {type*}:result -- -
The 'malloc' instruction allocates memory from the system heap and - returns a pointer to it. The object is always allocated in the generic - address space (address space zero).
- -The 'malloc' instruction allocates - sizeof(<type>)*NumElements 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 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' must be a sized type.
- -Memory is allocated using the system "malloc" function, and a - pointer is returned. The result of a zero byte allocation is undefined. The - result is null if there is insufficient memory available.
- -- %array = malloc [4 x i8] ; yields {[%4 x i8]*}:array - - %size = add i32 2, 2 ; yields {i32}:size = i32 4 - %array1 = malloc i8, i32 4 ; yields {i8*}:array1 - %array2 = malloc [12 x i8], i32 %size ; yields {[12 x i8]*}:array2 - %array3 = malloc i32, i32 4, align 1024 ; yields {i32*}:array3 - %array4 = malloc i32, align 1024 ; yields {i32*}:array4 -- -
Note that the code generator does not yet respect the alignment value.
- -- free <type> <value> ; yields {void} -- -
The 'free' instruction returns memory back to the unused memory heap - to be reallocated in the future.
- -'value' shall be a pointer value that points to a value that was - allocated with the 'malloc' instruction.
- -Access to the memory pointed to by the pointer is no longer defined after - this instruction executes. If the pointer is null, the operation is a - noop.
- -- %array = malloc [4 x i8] ; yields {[4 x i8]*}:array - free [4 x i8]* %array -- -
%X = trunc i32 257 to i8 ; yields i8:1 %Y = trunc i32 123 to i1 ; yields i1:true - %Y = trunc i32 122 to i1 ; yields i1:false + %Z = trunc i32 122 to i1 ; yields i1:false
The 'zext' instruction zero extends its operand to type +
The 'zext' instruction zero extends its operand to type ty2.
The 'zext' instruction takes a value to cast, which must be of +
The 'zext' instruction takes a value to cast, which must be of integer type, and a type to cast it to, which must also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, + value must be smaller than the bit size of the destination type, ty2.
The 'sext' sign extends value to the type ty2.
The 'sext' instruction takes a value to cast, which must be of +
The 'sext' instruction takes a value to cast, which must be of integer type, and a type to cast it to, which must also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, + value must be smaller than the bit size of the destination type, ty2.
The 'fptrunc' instruction takes a floating point value to cast and a floating point type to cast it to. The size of value must be larger than the size of - ty2. This implies that fptrunc cannot be used to make a + ty2. This implies that fptrunc cannot be used to make a no-op cast.
The 'fptrunc' instruction truncates a value from a larger - floating point type to a smaller + floating point type to a smaller floating point type. If the value cannot fit within the destination type, ty2, then the results are undefined.
@@ -4359,7 +4358,7 @@ entry: floating point value.The 'fpext' instruction takes a +
The 'fpext' instruction takes a floating point value to cast, and a floating point type to cast it to. The source type must be smaller than the destination type.
@@ -4402,7 +4401,7 @@ entry: vector integer type with the same number of elements as tyThe 'fptoui' instruction converts its +
The 'fptoui' instruction converts its floating point operand into the nearest (rounding towards zero) unsigned integer value. If the value cannot fit in ty2, the results are undefined.
@@ -4411,7 +4410,7 @@ entry:%X = fptoui double 123.0 to i32 ; yields i32:123 %Y = fptoui float 1.0E+300 to i1 ; yields undefined:1 - %X = fptoui float 1.04E+17 to i8 ; yields undefined:1 + %Z = fptoui float 1.04E+17 to i8 ; yields undefined:1@@ -4428,7 +4427,7 @@ entry:
The 'fptosi' instruction converts +
The 'fptosi' instruction converts floating point value to type ty2.
@@ -4440,7 +4439,7 @@ entry: vector integer type with the same number of elements as tyThe 'fptosi' instruction converts its +
The 'fptosi' instruction converts its floating point operand into the nearest (rounding towards zero) signed integer value. If the value cannot fit in ty2, the results are undefined.
@@ -4449,7 +4448,7 @@ entry:%X = fptosi double -123.0 to i32 ; yields i32:-123 %Y = fptosi float 1.0E-247 to i1 ; yields undefined:1 - %X = fptosi float 1.04E+17 to i8 ; yields undefined:1 + %Z = fptosi float 1.04E+17 to i8 ; yields undefined:1@@ -4593,8 +4592,8 @@ entry:
%X = inttoptr i32 255 to i32* ; yields zero extension on 64-bit architecture - %X = inttoptr i32 255 to i32* ; yields no-op on 32-bit architecture - %Y = inttoptr i64 0 to i32* ; yields truncation on 32-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@@ -4637,7 +4636,7 @@ 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@@ -4697,11 +4696,11 @@ entry: result, as follows:
To learn how to add an intrinsic function, please see the +
To learn how to add an intrinsic function, please see the Extending LLVM Guide.
@@ -6580,11 +6579,11 @@ LLVM.-%ptr = malloc i32 +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* store i32 4, %ptr %result1 = load i32* %ptr ; yields {i32}:result1 = 4 @@ -6649,7 +6649,8 @@ LLVM.Examples:
-%ptr = malloc i32 +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* store i32 4, %ptr %val1 = add i32 4, 4 @@ -6704,7 +6705,8 @@ LLVM.Examples:
-%ptr = malloc i32 +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* store i32 4, %ptr %val1 = add i32 4, 4 @@ -6759,8 +6761,9 @@ LLVM.Examples:
-%ptr = malloc i32 - store i32 4, %ptr +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* + store i32 4, %ptr %result1 = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 4 ) ; yields {i32}:result1 = 4 %result2 = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 2 ) @@ -6793,7 +6796,7 @@ LLVM.Overview:
-This intrinsic subtracts delta to the value stored in memory at +
This intrinsic subtracts delta to the value stored in memory at ptr. It yields the original value at ptr.
Arguments:
@@ -6810,8 +6813,9 @@ LLVM.Examples:
-%ptr = malloc i32 - store i32 8, %ptr +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* + store i32 8, %ptr %result1 = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 4 ) ; yields {i32}:result1 = 8 %result2 = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 2 ) @@ -6887,8 +6891,9 @@ LLVM.Examples:
-%ptr = malloc i32 - store i32 0x0F0F, %ptr +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* + store i32 0x0F0F, %ptr %result0 = call i32 @llvm.atomic.load.nand.i32.p0i32( i32* %ptr, i32 0xFF ) ; yields {i32}:result0 = 0x0F0F %result1 = call i32 @llvm.atomic.load.and.i32.p0i32( i32* %ptr, i32 0xFF ) @@ -6947,7 +6952,7 @@ LLVM.Overview:
-These intrinsics takes the signed or unsigned minimum or maximum of +
These intrinsics takes the signed or unsigned minimum or maximum of delta and the value stored in memory at ptr. It yields the original value at ptr.
@@ -6965,8 +6970,9 @@ LLVM.Examples:
-%ptr = malloc i32 - store i32 7, %ptr +%mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) +%ptr = bitcast i8* %mallocP to i32* + store i32 7, %ptr %result0 = call i32 @llvm.atomic.load.min.i32.p0i32( i32* %ptr, i32 -2 ) ; yields {i32}:result0 = 7 %result1 = call i32 @llvm.atomic.load.max.i32.p0i32( i32* %ptr, i32 8 ) @@ -6980,6 +6986,133 @@ LLVM. + + + + ++ ++ + + + +This class of intrinsics exists to information about the lifetime of memory + objects and ranges where variables are immutable.
+ ++ ++ + + + +Syntax:
++ declare void @llvm.lifetime.start(i64 <size>, i8* nocapture <ptr>) ++ +Overview:
+The 'llvm.lifetime.start' intrinsic specifies the start of a memory + object's lifetime.
+ +Arguments:
+The first argument is a constant integer representing the size of the + object, or -1 if it is variable sized. The second argument is a pointer to + the object.
+ +Semantics:
+This intrinsic indicates that before this point in the code, the value of the + memory pointed to by ptr is dead. This means that it is known to + never be used and has an undefined value. A load from the pointer that + precedes this intrinsic can be replaced with + 'undef'.
+ ++ ++ + + + +Syntax:
++ declare void @llvm.lifetime.end(i64 <size>, i8* nocapture <ptr>) ++ +Overview:
+The 'llvm.lifetime.end' intrinsic specifies the end of a memory + object's lifetime.
+ +Arguments:
+The first argument is a constant integer representing the size of the + object, or -1 if it is variable sized. The second argument is a pointer to + the object.
+ +Semantics:
+This intrinsic indicates that after this point in the code, the value of the + memory pointed to by ptr is dead. This means that it is known to + never be used and has an undefined value. Any stores into the memory object + following this intrinsic may be removed as dead. + +
+ ++ + + + +Syntax:
++ declare {}* @llvm.invariant.start(i64 <size>, i8* nocapture <ptr>) readonly ++ +Overview:
+The 'llvm.invariant.start' intrinsic specifies that the contents of + a memory object will not change.
+ +Arguments:
+The first argument is a constant integer representing the size of the + object, or -1 if it is variable sized. The second argument is a pointer to + the object.
+ +Semantics:
+This intrinsic indicates that until an llvm.invariant.end that uses + the return value, the referenced memory location is constant and + unchanging.
+ ++ ++Syntax:
++ declare void @llvm.invariant.end({}* <start>, i64 <size>, i8* nocapture <ptr>) ++ +Overview:
+The 'llvm.invariant.end' intrinsic specifies that the contents of + a memory object are mutable.
+ +Arguments:
+The first argument is the matching llvm.invariant.start intrinsic. + The second argument is a constant integer representing the size of the + object, or -1 if it is variable sized and the third argument is a pointer + to the object.
+ +Semantics:
+This intrinsic indicates that the memory is mutable again.
+ +General Intrinsics @@ -7115,6 +7248,61 @@ LLVM.+ + + ++ ++Syntax:
++ declare i32 @llvm.objectsize.i32( i8* <ptr>, i32 <type> ) + declare i64 @llvm.objectsize.i64( i8* <ptr>, i32 <type> ) ++ +Overview:
+The llvm.objectsize intrinsic is designed to provide information + to the optimizers to either discover at compile time either a) when an + operation like memcpy will either overflow a buffer that corresponds to + an object, or b) to determine that a runtime check for overflow isn't + necessary. An object in this context means an allocation of a + specific type.
+ +Arguments:
+The llvm.objectsize intrinsic takes two arguments. The first + argument is a pointer to the object ptr. The second argument + is an integer type which ranges from 0 to 3. The first bit in + the type corresponds to a return value based on whole objects, + and the second bit whether or not we return the maximum or minimum + remaining bytes computed.
++
+ ++ +00 +whole object, maximum number of bytes ++ +01 +partial object, maximum number of bytes ++ +10 +whole object, minimum number of bytes ++ +11 +partial object, minimum number of bytes +Semantics:
+The llvm.objectsize intrinsic is lowered to either a constant + representing the size of the object concerned or i32/i64 -1 or 0 + (depending on the type argument if the size cannot be determined + at compile time.
+ +