[llvm-commits] [llvm] r148065 - in /llvm/trunk: docs/LangRef.html lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Matt Beaumont-Gay
matthewbg at google.com
Thu Jan 12 15:19:55 PST 2012
ITYM "Revert commit which was WRONG" ;)
On Thu, Jan 12, 2012 at 15:06, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Thu Jan 12 17:06:28 2012
> New Revision: 148065
>
> URL: http://llvm.org/viewvc/llvm-project?rev=148065&view=rev
> Log:
> Revert accidental commit.
>
> Modified:
> llvm/trunk/docs/LangRef.html
> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>
> Modified: llvm/trunk/docs/LangRef.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=148065&r1=148064&r2=148065&view=diff
> ==============================================================================
> --- llvm/trunk/docs/LangRef.html (original)
> +++ llvm/trunk/docs/LangRef.html Thu Jan 12 17:06:28 2012
> @@ -106,11 +106,6 @@
> <li><a href="#fpaccuracy">'<tt>fpaccuracy</tt>' Metadata</a></li>
> </ol>
> </li>
> - <li><a href="#module_flags">Module Flags Metadata</a>
> - <ol>
> - <li><a href="#objc_metadata">Objective-C Metadata</a></li>
> - </ol>
> - </li>
> </ol>
> </li>
> <li><a href="#intrinsic_globals">Intrinsic Global Variables</a>
> @@ -3031,138 +3026,6 @@
>
> </div>
>
> -<!-- ======================================================================= -->
> -<h3>
> - <a name="module_flags">Module Flags Metadata</a>
> -</h3>
> -
> -<div>
> -
> -<p>Occasionally, the front-end needs to transmit data to the linker which
> - affects its behavior. The LLVM IR isn't sufficient to transmit this
> - information, so one should use the <tt>llvm.module.flags</tt> named
> - metadata.</p>
> -
> -<p>The <tt>llvm.module.flags</tt> metadata is a named metadata, whose elements
> - consist of metadata triplets. For example:</p>
> -
> -<pre class="doc_code">
> -!0 = metadata !{ i32 0, metadata !"foo", i32 1 }
> -!1 = metadata !{ i32 1, metadata !"bar", i32 37 }
> -
> -!llvm.module.flags = !{ !0, !1 }
> -</pre>
> -
> -<p>The first field specifies the behavior of the linker upon encountering two of
> - the same values. Behavior could range from: emitting an error if some of the
> - modules' flags disagree, emitting a warning, etc. The second field is the
> - name of the metadata. The third field is the value of the metadata.</p>
> -
> -<p>When two modules are linked together, the <tt>llvm.module.flags</tt> metadata
> - are unioned together.</p>
> -
> -</div>
> -
> -<!-- _______________________________________________________________________ -->
> -<h4>
> - <a name="objc_metadata">Objective-C Metadata</a>
> -</h4>
> -
> -<div>
> -
> -<p>The following module flags are used to convey Objective-C metadata to the
> - linker.</p>
> -
> -<table border="1" cellspacing="0" cellpadding="4">
> - <tbody>
> - <tr>
> - <th>Value</th>
> - <th>Behavior</th>
> - </tr>
> - <tr>
> - <td>1</td>
> - <td align="left">
> - <dl>
> - <dt><tt>Error</tt></dt>
> - <dd>Causes the linker to emit an error when two values disagree.</dd>
> - </dl>
> - </td>
> - </tr>
> - <tr>
> - <td>2</td>
> - <td align="left">
> - <dl>
> - <dt><tt>Require</tt></dt>
> - <dd>Causes the linker to emit an error when the specified value is not
> - present.</dd>
> - </dl>
> - </td>
> - </tr>
> - <tr>
> - <td>3</td>
> - <td align="left">
> - <dl>
> - <dt><tt>Override</tt></dt>
> - <dd>Causes the linker to use the specified value if the two values
> - disagree. It's an error if two pieces of the same metadata have
> - the <tt>Override</tt> behavior but different values.</dd>
> - </dl>
> - </td>
> - </tr>
> - </tbody>
> -</table>
> -
> -<p>The names are:</p>
> -
> -<ul>
> - <li><tt>Objective-C Version</tt></li>
> - <li><tt>Objective-C Garbage Collection</tt></li>
> - <li><tt>Objective-C GC Only</tt></li>
> - <li><tt>Objective-C Image Info Section</tt></li>
> -</ul>
> -
> -<p>
> -
> -<p>Here is an example of how to use the Objective-C metadata:</p>
> -
> -<pre class="doc_code">
> -<u>Module A</u>
> -!0 = metadata !{ i32 1, metadata !"Objective-C Version", i32 2 }
> -!1 = metadata !{ i32 1, metadata !"Objective-C Garbage Collection", i32 2 }
> -!2 = metadata !{ i32 1, metadata !"Objective-C Image Info Section",
> - metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip" }
> -!llvm.module.flags = !{ !0, !1, !2 }
> -
> -<u>Module B</u>
> -!0 = metadata !{ i32 1, metadata !"Objective-C Version", i32 2 }
> -!1 = metadata !{ i32 1, metadata !"Objective-C Garbage Collection", i32 2 }
> -!2 = metadata !{ i32 1, metadata !"Objective-C GC Only", i32 4 }
> -!3 = metadata !{ i32 1, metadata !"Objective-C Image Info Section",
> - metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip" }
> -!4 = metadata !{ i32 2, metadata !"Objective-C GC Only",
> - metadata !{
> - metadata !"Objective-C Garbage Collection", i32 2
> - }
> -}
> -!llvm.module.flags = !{ !0, !1, !2, !3, !4 }
> -
> -<u>Linked Module</u>
> -!0 = metadata !{ i32 1, metadata !"Objective-C Version", i32 2 }
> -!1 = metadata !{ i32 3, metadata !"Objective-C Garbage Collection", i32 2 }
> -!2 = metadata !{ i32 1, metadata !"Objective-C GC Only", i32 4 }
> -!3 = metadata !{ i32 1, metadata !"Objective-C Image Info Section",
> - metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip" }
> -!4 = metadata !{ i32 2, metadata !"Objective-C GC Only",
> - metadata !{
> - metadata !"Objective-C Garbage Collection", i32 2
> - }
> -}
> -!llvm.module.flags = !{ !0, !1, !2, !3, !4 }
> -</pre>
> -
> -
> -</div>
> -
> </div>
>
> <!-- *********************************************************************** -->
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=148065&r1=148064&r2=148065&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu Jan 12 17:06:28 2012
> @@ -930,71 +930,6 @@
> if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
> OutStreamer.SwitchSection(S);
>
> - // If we have module flags, then emit them.
> - NamedMDNode *ModFlags = M.getNamedMetadata("llvm.module.flags");
> - if (ModFlags) {
> - const char *ObjCGCName = "Objective-C Garbage Collection";
> - const char *ObjCGCOnlyName = "Objective-C GC Only";
> - const char *ObjCImageInfoVersion = "Objective-C Image Info Version";
> - const char *ObjCImageInfoSec = "Objective-C Image Info Section";
> -
> - MDNode *GC = 0;
> - MDNode *GCOnly = 0;
> - MDNode *ImageInfoVersion = 0;
> - MDNode *ImageInfoSec = 0;
> -
> - for (unsigned I = 0, E = ModFlags->getNumOperands(); I != E; ++I) {
> - MDNode *MD = ModFlags->getOperand(I);
> - unsigned Behavior = cast<ConstantInt>(MD->getOperand(0))->getZExtValue();
> - (void) Behavior;
> - MDString *Str = cast<MDString>(MD->getOperand(1));
> -
> - if (Str->getString() == ObjCImageInfoVersion) {
> - assert(Behavior == 1 && "Invalid behavior for module flag!");
> - ImageInfoVersion = MD;
> - } else if (Str->getString() == ObjCGCName) {
> - assert((Behavior == 1 || Behavior == 3) &&
> - "Invalid behavior for module flag!");
> - GC = MD;
> - } else if (Str->getString() == ObjCGCOnlyName) {
> - if (Behavior == 2) continue; // Ignore the 'require' clause.
> - GCOnly = MD;
> - } else if (Str->getString() == ObjCImageInfoSec) {
> - assert(Behavior == 1 && "Invalid behavior for module flag!");
> - ImageInfoSec = MD;
> - }
> - }
> -
> - if (ImageInfoVersion || GC || GCOnly || ImageInfoSec) {
> - // FIXME: Duh!
> - unsigned version = 0;
> - unsigned flags = 0;
> -
> - version =
> - cast<ConstantInt>(ImageInfoVersion->getOperand(2))->getZExtValue();
> - if (GC)
> - flags |= cast<ConstantInt>(GC->getOperand(2))->getZExtValue();
> - if (GCOnly)
> - flags |= cast<ConstantInt>(GCOnly->getOperand(2))->getZExtValue();
> -
> - Type *Int32Ty = Type::getInt32Ty(M.getContext());
> - Constant *values[2] = {
> - ConstantInt::get(Int32Ty, version),
> - ConstantInt::get(Int32Ty, flags)
> - };
> - ArrayType *AT = ArrayType::get(Int32Ty, 2);
> - StringRef Sec = cast<MDString>(ImageInfoSec->getOperand(2))->getString();
> -
> - GlobalVariable *GV =
> - cast<GlobalVariable>(M.getOrInsertGlobal("L_OBJC_IMAGE_INFO", AT));
> - GV->setConstant(true);
> - GV->setSection(Sec);
> - GV->setInitializer(ConstantArray::get(AT, values));
> -
> - EmitGlobalVariable(GV);
> - }
> - }
> -
> // Allow the target to emit any magic that it wants at the end of the file,
> // after everything else has gone out.
> EmitEndOfAsmFile(M);
>
>
> _______________________________________________
> 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