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><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">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>