Hi, Probably I did not mention my question correctly. I need to emit declarations of the libcalls (that are made in the current module) at the beginning of the assembly file. The class "Module" does not maintain any list of the libcalls made during the program. Although, it maintains lists of all the global variables and functions in the current module. Traversing each instruction and its operand to find if any libcall has been invoked seems to be very very costly. Is there some other way to find the libcalls that are made in module? Regards Sachin ________________________________ From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Evan Cheng See MachineOperand.h. If a MachineOperand represents an external symbol, getSymbolName() returns a string. Evan On Jan 27, 2009, at 8:26 PM, Sachin.Punyani at microchip.com wrote: Hi All, I need to print some extra information about libcall names in assembly. Libcall names are managed as ExternalSymbols in LLVM. How do I access these ExternalSymbols from Asmprinter? AsmPrinter uses class Module that lists all the global variables (including extern variables) and functions (include extern functions). But it does not list any information about the libcalls (ExternalSymbols) generated during lowering. Regards Sachin _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090128/36084820/attachment.html>
Hi Sachin, The declaration of functions called via the "call" instruction is a GlobalValue in your Module. You can go through all of the GlobalValues, look for those that are Function declarations (use the "Function::isDeclaration()" method), and then placing them in the appropriate place in your assembly file. Would that work? -bw On Jan 28, 2009, at 12:23 AM, <Sachin.Punyani at microchip.com> <Sachin.Punyani at microchip.com > wrote:> Hi, > > Probably I did not mention my question correctly. > > I need to emit declarations of the libcalls (that are made in the > current module) at the beginning of the assembly file. The class > “Module” does not maintain any list of the libcalls made during the > program. Although, it maintains lists of all the global variables > and functions in the current module. > > Traversing each instruction and its operand to find if any libcall > has been invoked seems to be very very costly. Is there some other > way to find the libcalls that are made in module? > > Regards > Sachin > > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev- > bounces at cs.uiuc.edu] On Behalf Of Evan Cheng > See MachineOperand.h. If a MachineOperand represents an external > symbol, getSymbolName() returns a string. > > Evan > > On Jan 27, 2009, at 8:26 PM, Sachin.Punyani at microchip.com wrote: > Hi All, > > I need to print some extra information about libcall names in > assembly. Libcall names are managed as ExternalSymbols in LLVM. > > How do I access these ExternalSymbols from Asmprinter? > > AsmPrinter uses class Module that lists all the global variables > (including extern variables) and functions (include extern > functions). But it does not list any information about the libcalls > (ExternalSymbols) generated during lowering. > > Regards > Sachin > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> Hi Sachin, > > The declaration of functions called via the "call" instruction is a > GlobalValue in your Module. You can go through all of the > GlobalValues, look for those that are Function declarations (use the > "Function::isDeclaration()" method), and then placing them in the > appropriate place in your assembly file. > > Would that work?Hi Bill, Function definitions and declarations that are parsed by clang make part of the FunctionList in Module. However the libcalls that are created during the lowering do not make part of this list. For example PIC16 does not support shift operation of 16 bits. For this LLVM generates the libcall. For creating such a call it uses ExternalSymbol and therefore it is not available in the FunctionList. I need to emit declaration for these libcalls. So FunctionList does not provide me the information. Is there any other way I can get the information of these libcalls in AsmPrinter? Regards Sachin> -bw > > On Jan 28, 2009, at 12:23 AM, <Sachin.Punyani at microchip.com> > <Sachin.Punyani at microchip.com > > wrote: > > > Hi, > > > > Probably I did not mention my question correctly. > > > > I need to emit declarations of the libcalls (that are made in the > > current module) at the beginning of the assembly file. The class > > "Module" does not maintain any list of the libcalls made during the > > program. Although, it maintains lists of all the global variables > > and functions in the current module. > > > > Traversing each instruction and its operand to find if any libcall > > has been invoked seems to be very very costly. Is there some other > > way to find the libcalls that are made in module? > > > > Regards > > Sachin > > > > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev- > > bounces at cs.uiuc.edu] On Behalf Of Evan Cheng > > See MachineOperand.h. If a MachineOperand represents an external > > symbol, getSymbolName() returns a string. > > > > Evan > > > > On Jan 27, 2009, at 8:26 PM, Sachin.Punyani at microchip.com wrote: > > Hi All, > > > > I need to print some extra information about libcall names in > > assembly. Libcall names are managed as ExternalSymbols in LLVM. > > > > How do I access these ExternalSymbols from Asmprinter? > > > > AsmPrinter uses class Module that lists all the global variables > > (including extern variables) and functions (include extern > > functions). But it does not list any information about the libcalls > > (ExternalSymbols) generated during lowering. > > > > Regards > > Sachin > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev