X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=1392db6e60a39f576c17d80c3f5a443e4473d647;hb=b76761351f36ce0a68762ba800dd88f6ecd4bccb;hp=530be57d75ae5e270a8110aefa828458eba48d15;hpb=21006d40ac9ec7715bca2095451075a83773dc52;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 530be57d75a..1392db6e60a 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -275,9 +275,10 @@
setjmp
is an example of such a function.
+ The compiler disables some optimizations (like tail calls) in the caller of
+ these functions.For a more informal introduction to this model, see the +LLVM Atomic Instructions and Concurrency Guide. +
We define a happens-before partial order as the least partial order that
Given that definition, Rbyte is defined as follows:
sig_atomic_t
in C/C++, and may be used for accesses to
+ addresses which do not behave like normal memory. It does not generally
+ provide cross-thread synchronization.)
+ Atomic instructions (cmpxchg
,
atomicrmw
,
fence
,
atomic load
, and
-atomic store
) take an ordering parameter
+atomic store
) take an ordering parameter
that determines which other atomic instructions on the same address they
synchronize with. These semantics are borrowed from Java and C++0x,
but are somewhat more colloquial. If these descriptions aren't precise enough,
-check those specs. fence
instructions
+check those specs (see spec references in the
+atomics guide).
+fence
instructions
treat these orderings somewhat differently since they don't take an address.
See that instruction's documentation for details.
For a simpler introduction to the ordering constraints, see the +LLVM Atomic Instructions and Concurrency Guide.
+unordered
monotonic
(or stronger) operations on the same address. If an
address is written monotonic
ally by one thread, and other threads
monotonic
ally read that address repeatedly, the other threads must
-eventually see the write. This is intended to model C++'s relaxed atomic
-variables.memory_order_relaxed
.
acquire
monotonic
, if this operation
-reads a value written by a release
atomic operation, it
-synchronizes-with that operation.release
monotonic
,
-a synchronizes-with edge may be formed by an acquire
-operation.release
+operation. This is intended to model C++'s memory_order_acquire
.
+release
monotonic
, if this operation
+writes a value which is subsequently read by an acquire
operation,
+it synchronizes-with that operation. (This isn't a complete
+description; see the C++0x definition of a release sequence.) This corresponds
+to the C++0x/C1x memory_order_release
.acq_rel
(acquire+release)acquire
and release
operation on its address.acquire
and release
operation on its address.
+This corresponds to the C++0x/C1x memory_order_acq_rel
.
seq_cst
(sequentially consistent)acq_rel
(acquire
for an operation which only reads, release
@@ -1637,9 +1651,8 @@ for an operation which only writes), there is a global total order on all
sequentially-consistent operations on all addresses, which is consistent with
the happens-before partial order and with the modification orders of
all the affected addresses. Each sequentially-consistent read sees the last
-preceding write to the same address in this global order. This is intended
-to model C++'s sequentially-consistent atomic variables and Java's volatile
-shared variables.memory_order_seq_cst
and Java volatile.If an atomic operation is marked singlethread
,
@@ -2031,20 +2044,22 @@ in signal handlers).
Structures may optionally be "packed" structures, which indicate that the alignment of the struct is one byte, and that there is no padding between - the elements. In non-packed structs, padding between field types is defined - by the target data string to match the underlying processor.
- -Structures can either be "anonymous" or "named". An anonymous structure is - defined inline with other types (e.g. {i32, i32}*) and a named types - are always defined at the top level with a name. Anonmyous types are uniqued - by their contents and can never be recursive since there is no way to write - one. Named types can be recursive. + the elements. In non-packed structs, padding between field types is inserted + as defined by the TargetData string in the module, which is required to match + what the underlying processor expects.
+ +Structures can either be "literal" or "identified". A literal structure is + defined inline with other types (e.g. {i32, i32}*) whereas identified + types are always defined at the top level with a name. Literal types are + uniqued by their contents and can never be recursive or opaque since there is + no way to write one. Identified types can be recursive, can be opaqued, and are + never uniqued.
- %T1 = type { <type list> } ; Named normal struct type - %T2 = type <{ <type list> }> ; Named packed struct type + %T1 = type { <type list> } ; Identified normal struct type + %T2 = type <{ <type list> }> ; Identified packed struct type
- <result> = [volatile] load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] - <result> = atomic [volatile] load <ty>* <pointer> [singlethread] <ordering>, align <alignment> + <result> = load [volatile] <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] + <result> = load atomic [volatile] <ty>* <pointer> [singlethread] <ordering>, align <alignment> !<index> = !{ i32 1 }@@ -4642,8 +4657,8 @@ that the invoke/unwind semantics are likely to change in future versions.
- [volatile] store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] ; yields {void} - atomic [volatile] store <ty> <value>, <ty>* <pointer> [singlethread] <ordering>, align <alignment> ; yields {void} + store [volatile] <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] ; yields {void} + store atomic [volatile] <ty> <value>, <ty>* <pointer> [singlethread] <ordering>, align <alignment> ; yields {void}
@@ -4763,14 +4779,15 @@ thread. (This is useful for interacting with signal handlers.)
- [volatile] cmpxchg <ty>* <pointer>, <ty> <cmp>, <ty> <new> [singlethread] <ordering> ; yields {ty} + cmpxchg [volatile] <ty>* <pointer>, <ty> <cmp>, <ty> <new> [singlethread] <ordering> ; yields {ty}
- [volatile] atomicrmw <operation> <ty>* <pointer>, <ty> <value> [singlethread] <ordering> ; yields {ty} + atomicrmw [volatile] <operation> <ty>* <pointer>, <ty> <value> [singlethread] <ordering> ; yields {ty}
For example, let's consider a C code fragment and how it gets compiled to LLVM:
@@ -5015,18 +5033,20 @@ entry: base pointer is not an in bounds address of an allocated object, or if any of the addresses that would be formed by successive addition of the offsets implied by the indices to the base address with infinitely - precise 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. + 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.If the inbounds keyword is not present, the offsets are added to - the base address with silently-wrapping two's complement arithmetic, and - the result value of the getelementptr may be outside the object - pointed to by the base pointer. The result value may not necessarily be - used to access memory though, even if it happens to point into allocated - storage. See the Pointer Aliasing Rules - section for more information.
+ the base address with silently-wrapping two's complement arithmetic. If the + offsets have a different width from the pointer, they are sign-extended or + truncated to the width of the pointer. The result value of the + getelementptr may be outside the object pointed to by the base + pointer. The result value may not necessarily be used to access memory + though, even if it happens to point into allocated storage. See the + Pointer Aliasing Rules section for more + information.The getelementptr instruction is often confusing. For some more insight into how it works, see the getelementptr FAQ.
@@ -6017,7 +6037,7 @@ freestanding environments and non-C-based languages. <resultval> = landingpad <somety> personality <type> <pers_fn> cleanup <clause>* <clause> := catch <type> <value> - <clause> := filter <type> <value> {, <type> <value>}* + <clause> := filter <array constant type> <array constant>A clause begins with the clause type — catch - or filter — and contains a list of global variables - representing the "types" that may be caught or filtered respectively. The - 'landingpad' instruction must contain at least + or filter — and contains the global variable representing the + "type" that may be caught or filtered respectively. Unlike the + catch clause, the filter clause takes an array constant as + its argument. Use "[0 x i8**] undef" for a filter which cannot + throw. The 'landingpad' instruction must contain at least one clause or the cleanup flag.
This intrinsic makes it possible to excise one parameter, marked with +
These intrinsics make it possible to excise one parameter, marked with the nest attribute, from a function. The result is a callable function pointer lacking the nest parameter - the caller does not need to @@ -7678,7 +7700,8 @@ LLVM.
%tramp = alloca [10 x i8], align 4 ; size and alignment only correct for X86 %tramp1 = getelementptr [10 x i8]* %tramp, i32 0, i32 0 - %p = call i8* @llvm.init.trampoline(i8* %tramp1, i8* bitcast (i32 (i8* nest , i32, i32)* @f to i8*), i8* %nval) + call i8* @llvm.init.trampoline(i8* %tramp1, i8* bitcast (i32 (i8*, i32, i32)* @f to i8*), i8* %nval) + %p = call i8* @llvm.adjust.trampoline(i8* %tramp1) %fp = bitcast i8* %p to i32 (i32, i32)*@@ -7696,12 +7719,12 @@ LLVM.
- declare i8* @llvm.init.trampoline(i8* <tramp>, i8* <func>, i8* <nval>) + declare void @llvm.init.trampoline(i8* <tramp>, i8* <func>, i8* <nval>)
This fills the memory pointed to by tramp with code and returns a - function pointer suitable for executing it.
+This fills the memory pointed to by tramp with executable code, + turning it into a trampoline.
The llvm.init.trampoline intrinsic takes three arguments, all @@ -7715,17 +7738,50 @@ LLVM.
The block of memory pointed to by tramp is filled with target - dependent code, turning it into a function. A pointer to this function is - returned, but needs to be bitcast to an appropriate - function pointer type before being called. The new function's signature - is the same as that of func with any arguments marked with - the nest attribute removed. At most one such nest argument - is allowed, and it must be of pointer type. Calling the new function is - equivalent to calling func with the same argument list, but - with nval used for the missing nest argument. If, after - calling llvm.init.trampoline, the memory pointed to - by tramp is modified, then the effect of any later call to the - returned function pointer is undefined.
+ dependent code, turning it into a function. Then tramp needs to be + passed to llvm.adjust.trampoline to get a pointer + which can be bitcast (to a new function) and + called. The new function's signature is the same as that of + func with any arguments marked with the nest attribute + removed. At most one such nest argument is allowed, and it must be of + pointer type. Calling the new function is equivalent to calling func + with the same argument list, but with nval used for the missing + nest argument. If, after calling llvm.init.trampoline, the + memory pointed to by tramp is modified, then the effect of any later call + to the returned function pointer is undefined. ++ declare i8* @llvm.adjust.trampoline(i8* <tramp>) ++ +
This performs any required machine-specific adjustment to the address of a + trampoline (passed as tramp).
+ +tramp must point to a block of memory which already has trampoline code + filled in by a previous call to llvm.init.trampoline + .
+ +On some architectures the address of the code to be executed needs to be + different to the address where the trampoline is actually stored. This + intrinsic returns the executable address corresponding to tramp + after performing the required machine specific adjustments. + The pointer returned can then be bitcast and + executed. +
This intrinsic allows annotation of local variables with arbitrary strings. This can be useful for special purpose optimizations that want to look for - these annotations. These have no other defined use, they are ignored by code + these annotations. These have no other defined use; they are ignored by code generation and optimization.
This intrinsic allows annotations to be put on arbitrary expressions with arbitrary strings. This can be useful for special purpose optimizations that - want to look for these annotations. These have no other defined use, they + want to look for these annotations. These have no other defined use; they are ignored by code generation and optimization.