Elsa and LLVM and LLVM submissions

Hi,

I've been writing an Elsa to LLVM interface.
It has been going very well, I think both sets of software are very nice.
At this point I've been able to compile and run a small program (sieve.c).
I've also compiled a pretty complete version of printf(). (It seemed like
a good choice because it touches many data types, varargs, etc.)

I've had to make quite a few changes to Elsa to get this going, but so far
I haven't had to touch LLVM.

I got the current version of LLVM via svn yesterday and modified my code to
use the LLVMFoldingBuilder. Very nice!

My question is this: I noticed that the folding builder doesn't fold some
operations, e.g. casts. Is there some reason why? If I implemented some of
these unhandled cases could I sumbit the changes back to the LLVM project?

-Rich

Sure. Though, I do not exactly understand what do you mean by folding casts operations, we encourage patches to improve LLVMFoldingBuilder!

Devang Patel wrote:

I got the current version of LLVM via svn yesterday and modified my code to
use the LLVMFoldingBuilder. Very nice!

My question is this: I noticed that the folding builder doesn't fold some
operations, e.g. casts. Is there some reason why? If I implemented some of
these unhandled cases could I sumbit the changes back to the LLVM project?

Sure. Though, I do not exactly understand what do you mean by folding casts operations, we encourage patches to improve LLVMFoldingBuilder!

-
Devang
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Hi Devang,

Folding a cast is like folding any other operator: If the operand is constant, the cast can be done at compile time. I've made the necessary changes to LLVMFoldingBuilder.h to handle casts and several other operators.

I have attached the patch. There is one glaring thing that should be addressed. The #ifdef RICH around code in CreateGEP is there because I'm not familiar with STL enough to figure out how to get an array of pointers out of a vector. :frowning: If someone could clue me in as to the best way to do this, I'd greatly appreciate it.

I've tested this code with my Elsa->LLVM stuff and also recompiled the LLVM itself, so I'm pretty confident that the patch doesn't break anything.

Since this is my first patch to LLVM and I've only been using LLVM for two weeks, please be gentle with me. If I made any glaring submission errors, I'll gladly fix them.

-Rich

llvmbuilder.patch (6.12 KB)

I used &Idx[0]. In future, please avoid tabs in your patch.

I applied your patch.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071217/056403.html

Devang,

This patch is dangerous:

+ template<typename InputIterator>
+ Value *CreateGEP(Value *Ptr, InputIterator IdxBegin,
+ InputIterator IdxEnd, const char *Name = "") {