diff --git a/docs/BytecodeFormat.html b/docs/BytecodeFormat.html index a7726c16447..5d5d55fec29 100644 --- a/docs/BytecodeFormat.html +++ b/docs/BytecodeFormat.html @@ -1059,7 +1059,11 @@ href="#uint32_vbr">uint32_vbr that describes the function.
LLVM functions, calls +and invokes can all have an optional calling convention +specified for the call. The calling convention of any pair of dynamic +caller/callee must match, or the behavior of the program is undefined. The +following calling conventions are supported by LLVM, and more may be added in +the future:
+ +More calling conventions can be added/defined on an as-needed basis, to +support pascal conventions or any other well-known target-independent +convention.
+ +LLVM function definitions are composed of a (possibly empty) argument list, -an opening curly brace, a list of basic blocks, and a closing curly brace. LLVM -function declarations are defined with the "declare" keyword, a -function name, and a function signature.
+LLVM function definitions consist of an optional linkage +type, an optional calling convention, a return +type, a function name, a (possibly empty) argument list, an opening curly brace, +a list of basic blocks, and a closing curly brace. LLVM function declarations +are defined with the "declare" keyword, an optional calling convention, a return type, a function name, and +a possibly empty list of arguments.
A function definition contains a list of basic blocks, forming the CFG for the function. Each basic block may optionally start with a label (giving the @@ -1154,51 +1214,82 @@ branches or with a lookup table.
uint 2, label %ontwo ]<result> = invoke <ptr to function ty> %<function ptr val>(<function args>)+ +
to label <normal label> except label <exception label>
+ <result> = invoke [cconv] <ptr to function ty> %<function ptr val>(<function args>) + to label <normal label> except label <exception label> ++
The 'invoke' instruction causes control to transfer to a -specified function, with the possibility of control flow transfer to -either the 'normal' label label or the 'exception'label. -If the callee function returns with the "ret" -instruction, control flow will return to the "normal" label. If the -callee (or any indirect callees) returns with the "unwind" -instruction, control is interrupted, and continued at the dynamically -nearest "except" label.
+ +The 'invoke' instruction causes control to transfer to a specified +function, with the possibility of control flow transfer to either the +'normal' label label or the +'exception'label. If the callee function returns with the +"ret" instruction, control flow will return to the +"normal" label. If the callee (or any indirect callees) returns with the "unwind" instruction, control is interrupted, and +continued at the dynamically nearest "except" label.
+This instruction requires several arguments:
+The optional "cconv" marker indicates which calling + convention the call should use. If none is specified, the call defaults + to using C calling conventions. +
This instruction is designed to operate as a standard 'call' instruction in most regards. The -primary difference is that it establishes an association with a label, -which is used by the runtime library to unwind the stack.
-This instruction is used in languages with destructors to ensure -that proper 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.
+href="#i_call">call' instruction in most regards. The primary +difference is that it establishes an association with a label, which is used by +the runtime library to unwind the stack. + +This instruction is used in languages with destructors to ensure that proper +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.
+%retval = invoke int %Test(int 15)
to label %Continue
except label %TestCleanup ; {int}:retval set ++ %retval = invoke int %Test(int 15) to label %Continue + except label %TestCleanup ; {int}:retval set + %retval = invoke coldcc int %Test(int 15) to label %Continue + except label %TestCleanup ; {int}:retval set
- <result> = [tail] call <ty>* <fnptrval>(<param list>) + <result> = [tail] call [cconv] <ty>* <fnptrval>(<param list>)
The "tail" marker indicates whether the callee function accesses any - allocas or varargs in the caller. If the "tail" marker is present, the +
The optional "tail" marker indicates whether the callee function accesses + any allocas or varargs in the caller. If the "tail" marker is present, the function call is eligible for tail call optimization. Note that calls may be marked "tail" even if they do not occur before a ret instruction.
The optional "cconv" marker indicates which calling + convention the call should use. If none is specified, the call defaults + to using C calling conventions. +
'ty': shall be the signature of the pointer to function value being invoked. The argument types must match the types implied by this @@ -2104,6 +2200,7 @@ the invoke instruction.
%retval = call int %test(int %argc) call int(sbyte*, ...) *%printf(sbyte* %msg, int 12, sbyte 42); %X = tail call int %foo() + %Y = tail call fastcc int %foo()