<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/24/2016 1:07 PM, Peter
      Collingbourne via llvm-dev wrote:<br>
    </div>
    <blockquote
cite="mid:CAPQLkRhYkQQxm=imN4=jcQxOETV3V1CvQPLOKBmDdF5NX8i7rg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Mon, Oct 10, 2016 at 8:12 PM,
            Peter Collingbourne <span dir="ltr"><<a
                moz-do-not-send="true" href="mailto:peter@pcc.me.uk"
                target="_blank">peter@pcc.me.uk</a>></span> wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div dir="ltr">
                <div>The specific change I have in mind is to allow
                  !range metadata on GlobalObjects. This would<br>
                </div>
                <div>
                  <div>be similar to existing !range metadata, but it
                    would apply to the "address" of the attached
                    GlobalObject, rather than any value loaded from it.
                    Its presence on a GlobalObject would also imply that
                    the address of the GlobalObject is "fixed" at link
                    time.</div>
                </div>
              </div>
            </blockquote>
            <div> </div>
            <div>Going back to IR-level representation: here is an
              alternative representation based on a suggestion from Eli.</div>
            <div><br>
            </div>
            <div>Introduce a new type of GlobalValue called
              GlobalConstant. GlobalConstant would fit into the
              GlobalValue hierarchy like this:</div>
            <div>
              <ul>
                <li>GlobalValue<br>
                </li>
                <ul>
                  <li>GlobalConstant</li>
                  <li>GlobalPointer</li>
                  <ul>
                    <li>GlobalIndirectSymbol</li>
                    <ul>
                      <li>GlobalAlias</li>
                      <li>GlobalIFunc</li>
                    </ul>
                    <li>GlobalObject</li>
                    <ul>
                      <li>Function</li>
                      <li>GlobalVariable</li>
                    </ul>
                  </ul>
                </ul>
              </ul>
              <div>GlobalValue would no longer be assumed to be of
                pointer type. The getType() overload that takes a
                PointerType, as well as getValueType() would be moved
                down to GlobalPointer. (A nice side benefit of this is
                that it would help flush out cases where we are
                unnecessarily depending on global pointee types.)</div>
              <div><br>
              </div>
              <div>A GlobalConstant can either be a definition or a
                declaration. A definition would look like this:</div>
              <div><br>
              </div>
              <div>@foo = globalconst i32 42</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    This is equivalent to writing "foo = 42" in assembly?<br>
    <br>
    <blockquote
cite="mid:CAPQLkRhYkQQxm=imN4=jcQxOETV3V1CvQPLOKBmDdF5NX8i7rg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>
              <div>while a declaration would look like this:</div>
              <div><br>
              </div>
              <div>@foo = external globalconst i32</div>
              <div><br>
              </div>
              <div>GlobalConstant could also hold a linkage and
                visibility. Looking at the other attributes that a
                GlobalValue can hold, many of them do not seem
                appropriate for GlobalConstant and could potentially be
                moved to GlobalPointer.</div>
              <div><br>
              </div>
              <div>Thoughts?</div>
              <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    How do you plan to use this?  The concept makes sense, but I've
    never actually seen anyone use symbols this way.<br>
    <br>
    -Eli<br>
    <pre class="moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </body>
</html>