This turned out to work ok.
If you need to get the attributes (or function IR) of a function you are
calling:
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
llvm::StringRef Sym = G->getGlobal()->getName();
Function *F = G->getGlobal()->getParent()->getFunction(Sym);
if (F->hasFnAttribute("__Mips16RetHelper")) {
SpecialCallingConv = MipsCC::Mips16RetHelperConv;
DEBUG(dbgs() << "mips16 return helper needed from attr"
<< "\n");
}
DEBUG(dbgs() << "print global Float return" << Sym
<< "\n");
}
In this case I believe I can do this a little differently by using a
target calling convention in the IR but there are other cases where you
need to know other things from the function attributes or function IR
itself.
At the time you are processing a callee node, you already have a
selection DAG for the callee and can't see it's machine function
directly.
The idea is that if you have different calling conventions on
On 04/29/2013 03:24 PM, Reed Kotler wrote:> On 04/28/2013 09:49 PM, reed kotler wrote:
>> Is there a way to find the IR that corresponds to a callee DAG node?
>>
>> In other words to get the function definition, attributes, etc.?
>>
>> Tia.
>>
>> Reed
>
> It looks like you can do this by:
>
> 1) getParent will return the Module that some global value is in
> 2) in Module, getFunction will return the function