<br>In fact, my initial idea was to use "dyn_cast<GlobalAlias>(GV)", but I didn't use the resulting pointer (except for testing if the pointer is null). That's why I used classof... but I forgot about the existence of isa<>.<br>
<br>Thank you for this clarification,<br><br>Damien<br><br><br><br><div class="gmail_quote">On Mon, Mar 21, 2011 at 12:08 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

  
    
  
  <div bgcolor="#ffffff" text="#000000"><div class="im">
    On 3/21/11 2:00 PM, Damien Vincent wrote:
    <blockquote type="cite">I reply to myself... I didn't go in the right
      direction in my previous email.<br>
      <br>
      There is an easy way to tell if a GlobalValue corresponds to data
      or code:<br>
      const GlobalValue *GV;<br>
      if(Function::classof(GV)) <br>
         ... // process the global value as a function<br>
      else<br>
        ... // process the global value as data<br>
      <br>
        Damien<br>
    </blockquote>
    <br></div>
    You should be able to use isa<Function>(GV) to determine if GV
    is a function.  You may have to put in an additional check to see if
    GV is a GlobalAlias and to determine if the GlobalAlias is an alias
    for a function:<br>
    <br>
    if (GlobalAlias * GA = dyn_cast<GlobalAlias>(GV)) {<br>
        ... Check to see if GA is an alias for a function<br>
    }<br>
    <br>
    I recommend looking at the doxygen documentation on <a href="http://llvm.org" target="_blank">llvm.org</a> to
    learn the class hierarchy relationships between GlobalValue,
    GlobalVariable, GlobalAlias, and Function.  You should also read the
    Programmer's Guide to get familiar with the isa<>() and
    dyn_cast<>() functions if you are not familiar with them
    already.<br>
    <br>
    -- John T.<div class="im"><br>
    <br>
    <blockquote type="cite"><br>
      <br>
      <br>
      <br>
      <div class="gmail_quote">On Fri, Mar 18, 2011 at 3:16 PM, Damien
        Vincent <span dir="ltr"><<a href="mailto:damien.llvm@gmail.com" target="_blank">damien.llvm@gmail.com</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
          I am again calling for help from LLVM developers ;)<br>
          <br>
          For my DSP backend, at the lowering stage and also at the
          AsmPrinter stage, I need to know if a GlobalAddress is a code
          or a data address.<br>
          <br>
          So I tried at the lowering stage to use: <br>
          GlobalAddressSDNode *GSDN =
          cast<GlobalAddressSDNode>(Op);<br>
          const GlobalValue *GV = GSDN->getGlobal();<br>
          GV->hasSection()  and  GV->getSection()<br>
          But the section is not set at this stage (hasSection = false)<br>
          <br>
          And at the AsmPrinter stage: <br>
          const GlobalValue *GV = MO.getGlobal();<br>
          SectionKind sectionKind =
          Mang->getSymbol(GV)->getSection().getKind();<br>
          But again the section does not seem to be set
          (sectionKind.isInSection() = false)<br>
          <br>
          Do you know a way to tell if a global address corresponds to
          data or code ? I have to process differently text and data
          address...<br>
          <br>
            Thank you !<br>
          <font color="#888888"><br>
              Damien<br>
            <br>
          </font></blockquote>
      </div>
      <br>
    </blockquote>
    <br>
  </div></div>

</blockquote></div><br>