[LLVMdev] Text or Data symbol
damien.llvm at gmail.com
Mon Mar 21 14:00:19 CDT 2011
I reply to myself... I didn't go in the right direction in my previous
There is an easy way to tell if a GlobalValue corresponds to data or code:
const GlobalValue *GV;
... // process the global value as a function
... // process the global value as data
On Fri, Mar 18, 2011 at 3:16 PM, Damien Vincent <damien.llvm at gmail.com>wrote:
> I am again calling for help from LLVM developers ;)
> 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.
> So I tried at the lowering stage to use:
> GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op);
> const GlobalValue *GV = GSDN->getGlobal();
> GV->hasSection() and GV->getSection()
> But the section is not set at this stage (hasSection = false)
> And at the AsmPrinter stage:
> const GlobalValue *GV = MO.getGlobal();
> SectionKind sectionKind = Mang->getSymbol(GV)->getSection().getKind();
> But again the section does not seem to be set (sectionKind.isInSection() =
> 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...
> Thank you !
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LLVMdev