need help on llvm support for Chapel


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

Hello, All

Does anyone know about the LLVM support for Chapel project ? I couldn’t find any useful document online so if anyone can give me some sort of information, I really appreciate that.

thanks !

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

Hi Hui Zhang,

I have no clue about the Chapel project but I see that they have a sourceforge page and their own mailinglist. Maybe you'll have more luck if you try asking your question there.