Skip to content

Commit 8819056

Browse files
author
John Criswell
committed
Added a note about how the type can be omitted in call instructions.
Added a note about how getelementptr can be used to index into structures or arrays. Fixed some typos, spelling, etc. llvm-svn: 22083
1 parent 15c74de commit 8819056

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

llvm/docs/LangRef.html

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,8 @@ <h5>Arguments:</h5>
19181918
elements of the aggregate object to index to. The actual types of the arguments
19191919
provided depend on the type of the first pointer argument. The
19201920
'<tt>getelementptr</tt>' instruction is used to index down through the type
1921-
levels of a structure. When indexing into a structure, only <tt>uint</tt>
1921+
levels of a structure or to a specific index in an array. When indexing into a
1922+
structure, only <tt>uint</tt>
19221923
integer constants are allowed. When indexing into an array or pointer,
19231924
<tt>int</tt> and <tt>long</tt> indexes are allowed of any sign.</p>
19241925

@@ -1972,7 +1973,7 @@ <h5>Semantics:</h5>
19721973
sbyte }</tt>' type, another structure. The third index indexes into the second
19731974
element of the structure, yielding a '<tt>[10 x [20 x int]]</tt>' type, an
19741975
array. The two dimensions of the array are subscripted into, yielding an
1975-
'<tt>int</tt>' type. The '<tt>getelementptr</tt>' instruction return a pointer
1976+
'<tt>int</tt>' type. The '<tt>getelementptr</tt>' instruction returns a pointer
19761977
to this element, thus computing a value of '<tt>int*</tt>' type.</p>
19771978

19781979
<p>Note that it is perfectly legal to index partially through a
@@ -2119,7 +2120,7 @@ <h5>Semantics:</h5>
21192120

21202121
<p>
21212122
If the boolean condition evaluates to true, the instruction returns the first
2122-
value argument, otherwise it returns the second value argument.
2123+
value argument; otherwise, it returns the second value argument.
21232124
</p>
21242125

21252126
<h5>Example:</h5>
@@ -2169,13 +2170,14 @@ <h5>Arguments:</h5>
21692170
<li>
21702171
<p>'<tt>ty</tt>': shall be the signature of the pointer to function value
21712172
being invoked. The argument types must match the types implied by this
2172-
signature.</p>
2173+
signature. This type can be omitted if the function is not varargs and
2174+
if the function type does not return a pointer to a function.</p>
21732175
</li>
21742176
<li>
21752177
<p>'<tt>fnptrval</tt>': An LLVM value containing a pointer to a function to
21762178
be invoked. In most cases, this is a direct function invocation, but
21772179
indirect <tt>call</tt>s are just as possible, calling an arbitrary pointer
2178-
to function values.</p>
2180+
to function value.</p>
21792181
</li>
21802182
<li>
21812183
<p>'<tt>function args</tt>': argument list whose types match the
@@ -2248,9 +2250,9 @@ <h5>Semantics:</h5>
22482250

22492251
<p><tt>vanext</tt> is an LLVM instruction instead of an <a
22502252
href="#intrinsics">intrinsic function</a> because it takes a type as an
2251-
argument. The type refers to the current argument in the <tt>va_list</tt>, it
2253+
argument. The type refers to the current argument in the <tt>va_list</tt>; it
22522254
tells the compiler how far on the stack it needs to advance to find the next
2253-
argument</p>
2255+
argument.</p>
22542256

22552257
<h5>Example:</h5>
22562258

@@ -2297,7 +2299,7 @@ <h5>Semantics:</h5>
22972299
function.</p>
22982300

22992301
<p><tt>vaarg</tt> is an LLVM instruction instead of an <a
2300-
href="#intrinsics">intrinsic function</a> because it takes an type as an
2302+
href="#intrinsics">intrinsic function</a> because it takes a type as an
23012303
argument.</p>
23022304

23032305
<h5>Example:</h5>
@@ -2313,22 +2315,22 @@ <h5>Example:</h5>
23132315
<div class="doc_text">
23142316

23152317
<p>LLVM supports the notion of an "intrinsic function". These functions have
2316-
well known names and semantics, and are required to follow certain
2318+
well known names and semantics and are required to follow certain
23172319
restrictions. Overall, these instructions represent an extension mechanism for
23182320
the LLVM language that does not require changing all of the transformations in
23192321
LLVM to add to the language (or the bytecode reader/writer, the parser,
23202322
etc...).</p>
23212323

2322-
<p>Intrinsic function names must all start with an "<tt>llvm.</tt>" prefix, this
2323-
prefix is reserved in LLVM for intrinsic names, thus functions may not be named
2324+
<p>Intrinsic function names must all start with an "<tt>llvm.</tt>" prefix. This
2325+
prefix is reserved in LLVM for intrinsic names; thus, functions may not be named
23242326
this. Intrinsic functions must always be external functions: you cannot define
23252327
the body of intrinsic functions. Intrinsic functions may only be used in call
23262328
or invoke instructions: it is illegal to take the address of an intrinsic
23272329
function. Additionally, because intrinsic functions are part of the LLVM
23282330
language, it is required that they all be documented here if any are added.</p>
23292331

23302332

2331-
<p>To learn how to add an intrinsics, please see the <a
2333+
<p>To learn how to add an intrinsic function, please see the <a
23322334
href="ExtendingLLVM.html">Extending LLVM Guide</a>.
23332335
</p>
23342336

@@ -2396,7 +2398,7 @@ <h5>Semantics:</h5>
23962398
returns a <tt>va_list</tt> element, so that the next <tt>vaarg</tt>
23972399
will produce the first variable argument passed to the function. Unlike
23982400
the C <tt>va_start</tt> macro, this intrinsic does not need to know the
2399-
last argument of the function, the compiler can figure that out.</p>
2401+
last argument of the function; the compiler can figure that out.</p>
24002402
<p>Note that this intrinsic function is only legal to be called from
24012403
within the body of a variable argument function.</p>
24022404
</div>
@@ -2693,8 +2695,9 @@ <h5>Overview:</h5>
26932695

26942696
<p>
26952697
The '<tt>llvm.prefetch</tt>' intrinsic is a hint to the code generator to insert
2696-
a prefetch instruction if supported, otherwise it is a noop. Prefetches have no
2697-
effect on the behavior of the program, but can change its performance
2698+
a prefetch instruction if supported; otherwise, it is a noop. Prefetches have
2699+
no
2700+
effect on the behavior of the program but can change its performance
26982701
characteristics.
26992702
</p>
27002703

@@ -2735,13 +2738,14 @@ <h5>Overview:</h5>
27352738

27362739

27372740
<p>
2738-
The '<tt>llvm.pcmarker</tt>' intrinsic is a method to export a PC in a region of
2741+
The '<tt>llvm.pcmarker</tt>' intrinsic is a method to export a Program Counter
2742+
(PC) in a region of
27392743
code to simulators and other tools. The method is target specific, but it is
27402744
expected that the marker will use exported symbols to transmit the PC of the marker.
27412745
The marker makes no guaranties that it will remain with any specific instruction
27422746
after optimizations. It is possible that the presense of a marker will inhibit
27432747
optimizations. The intended use is to be inserted after optmizations to allow
2744-
corrolations of simulation runs.
2748+
correlations of simulation runs.
27452749
</p>
27462750

27472751
<h5>Arguments:</h5>

0 commit comments

Comments
 (0)