[llvm-commits] [llvm] r90116 - /llvm/trunk/docs/LangRef.html

Bill Wendling wendling at apple.com
Mon Nov 30 02:09:52 PST 2009


<puts on grammar fascist hat> :-)

> +<h5>Syntax:</h5>
> +<pre>
> +  declare i32 @llvm.objectsize.i32( i8* <ptr>, i32 <type> )
> +  declare i64 @llvm.objectsize.i64( i8* <ptr>, i32 <type> )
> +</pre>
> +
> +<h5>Overview:</h5>
> +<p>The <tt>llvm.objectsize</tt> intrinsic returns the constant number of bytes
> +   from <tt>ptr</tt> to the end of the object <tt>ptr</tt> points to if it

"points to if" -> "points to, if"

> +   can deduce this at compile time.  If there are any side-effects in evaluating
> +   the argument or it cannot deduce which objects <tt>ptr</tt> points to at compile
> +   time the intrinsic returns <tt>(size_t) -1</tt> for <tt>type</tt> 0

"time the" -> "time, the"

It may be a good idea to put the "for" clauses within commas too, but that's probably not as necessary.

> +   or 1 and <tt>(size_t) 0</tt> for <tt>type</tt> 2 or 3.</p>
> +
> +<h5>Arguments:</h5>
> +<p>The <tt>llvm.objectsize</tt> intrinsic takes two arguments.  The first
> +   argument is a pointer to the object <tt>ptr</tt> and an integer <tt>type</tt>.

"<tt>ptr</tt>" and an integer" -> "<tt>ptr</tt>. The second argument is an integer"

> +   <tt>type</tt> is an integer ranging from 0 to 3. The lsb corresponds to

You can elide "is an integer ranging" and just put "ranges" instead. Also, what does "lsb" mean here? I assume "least significant bit", but it might be good to spell it out. (IMHO, I'd much rather have the documentation present me with redundant information instead of hoping that I know what it's talking about.)

> +   a return value based on whole objects, the second bit whether or not we

"objects, the second" -> "objects, and the second"

> +   return the maximum or minimum remaining bytes computed.</p>
> +
> +<h5>Semantics:</h5>
> +<p>The <tt>llvm.objectsize</tt> intrinsic is lowered to either a constant
> +   representing the size of the object concerned or <tt>(size_t) -1</tt> if
> +   it cannot be determined at compile time.</p>
> +
Does "size_t" have any meaning in LLVM IR? It's a C construct, and at this point we're not dealing with C. Maybe using the equivalent LLVM type would be more appropriate.

Also, it would be good to present a few examples. :-)

-bw





More information about the llvm-commits mailing list