[llvm-commits] [llvm] r143135 - in /llvm/trunk: docs/LangRef.html include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp

Duncan Sands baldrick at free.fr
Thu Oct 27 21:05:19 PDT 2011


Hi Peter, part of the metadata design is that it should always be safe (if
sub-optimal) to remove it.  Will you get correct results if fpaccuracy meta
data is dropped?

Ciao, Duncan.

> Add a pinned metadata name for fpaccuracy, and document it
>
> Modified:
>      llvm/trunk/docs/LangRef.html
>      llvm/trunk/include/llvm/LLVMContext.h
>      llvm/trunk/lib/VMCore/LLVMContext.cpp
>
> Modified: llvm/trunk/docs/LangRef.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=143135&r1=143134&r2=143135&view=diff
> ==============================================================================
> --- llvm/trunk/docs/LangRef.html (original)
> +++ llvm/trunk/docs/LangRef.html Thu Oct 27 14:19:14 2011
> @@ -103,6 +103,7 @@
>         <li><a href="#metadata">Metadata Nodes and Metadata Strings</a>
>           <ol>
>             <li><a href="#tbaa">'<tt>tbaa</tt>' Metadata</a></li>
> +<li><a href="#fpaccuracy">'<tt>fpaccuracy</tt>' Metadata</a></li>
>           </ol>
>         </li>
>       </ol>
> @@ -2966,6 +2967,35 @@
>
>   </div>
>
> +<h4>
> +<a name="fpaccuracy">'<tt>fpaccuracy</tt>' Metadata</a>
> +</h4>
> +
> +<div>
> +
> +<p><tt>fpaccuracy</tt>  metadata may be attached to any instruction of floating
> +   point type.  It expresses the maximum relative error of the result of
> +   that instruction, in ULPs. ULP is defined as follows:</p>
> +
> +<blockquote><p>
> +If x is a real number that lies between two finite consecutive floating-point
> +numbers a and b, without being equal to one of them, then ulp(x) = |b - a|,
> +otherwise ulp(x) is the distance between the two non-equal finite
> +floating-point numbers nearest x. Moreover, ulp(NaN) is NaN.
> +</p></blockquote>
> +
> +<p>The maximum relative error may be any rational number.  The metadata node
> +   shall consist of a pair of unsigned integers respectively representing
> +   the numerator and denominator.  For example, 2.5 ULP:</p>
> +
> +<div class="doc_code">
> +<pre>
> +!0 = metadata !{ i32 5, i32 2 }
> +</pre>
> +</div>
> +
> +</div>
> +
>   </div>
>
>   </div>
>
> Modified: llvm/trunk/include/llvm/LLVMContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=143135&r1=143134&r2=143135&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/LLVMContext.h (original)
> +++ llvm/trunk/include/llvm/LLVMContext.h Thu Oct 27 14:19:14 2011
> @@ -40,7 +40,8 @@
>     enum {
>       MD_dbg = 0,  // "dbg"
>       MD_tbaa = 1, // "tbaa"
> -    MD_prof = 2  // "prof"
> +    MD_prof = 2,  // "prof"
> +    MD_fpaccuracy = 3  // "fpaccuracy"
>     };
>
>     /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
>
> Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=143135&r1=143134&r2=143135&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original)
> +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Thu Oct 27 14:19:14 2011
> @@ -43,6 +43,11 @@
>     // Create the 'prof' metadata kind.
>     unsigned ProfID = getMDKindID("prof");
>     assert(ProfID == MD_prof&&  "prof kind id drifted"); (void)ProfID;
> +
> +  // Create the 'fpaccuracy' metadata kind.
> +  unsigned FPAccuracyID = getMDKindID("fpaccuracy");
> +  assert(FPAccuracyID == MD_fpaccuracy&&  "fpaccuracy kind id drifted");
> +  (void)FPAccuracyID;
>   }
>   LLVMContext::~LLVMContext() { delete pImpl; }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list