[LLVMdev] need help on llvm support for Chapel

John Criswell jtcriswel at gmail.com
Thu Oct 2 09:44:53 PDT 2014


Dear Hui,

I'm not familiar with the Chapel LLVM front-end.  However, I suspect the 
weird functions that you are seeing are either function declarations for 
functions within Chapel's run-time library (i.e., functions that 
implement part of the language's functionality) or constructor functions 
for the language.

All code in the LLVM IR needs to be inside of a function, and so the 
Chapel compiler will need to put any code it generates into an LLVM 
function.

As to your question of how to determine which functions are from the 
source code and which are not, that can be a bit tricky.  You can 
probably ignore any function declarations (functions which have no basic 
blocks).  As to whether the remaining functions are from the Chapel 
source code, there is no really good way to do that.  One option is to 
use debug metadata to figure it out; another option is to look at the 
Chapel front-end and see if the functions it adds have names that your 
pass can recognize.

All that said, your pass probably doesn't need to worry about whether a 
function is from the source code or added "behind the scenes" by the 
front-end compiler.  Most analyses and optimizations treat them the same 
way.

Hope that helps,

John Criswell



On 10/1/14, 2:59 PM, Hui Zhang wrote:
> Hello,
>
> I don't know if anyone gets familiar with the llvm Chapel front end, 
> it's version 3.3 and comes within Chapel source package. I'm trying to 
> parse the .bc code generated from a simple helloworld chapel program.
>
> Just run a basic Hello pass on the code (default one in the llvm 
> source code) that prints out all the function names in the module. 
> However,  it prints a bunch of functions (hundreds with weird names) 
> for a simple hello world chapel program (it should be just "main" or 
> null since Chapel programs doesn't necessarily need a function 
> definition inside).  SO why did "weird" functions come out and how can 
> I remove them from what I need (only functions from the source Chapel 
> program) ???
>
> thanks !!!
>
> -- 
> Best regards
>
>
> Hui Zhang
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141002/45e99923/attachment.html>


More information about the llvm-dev mailing list