Devang Patel wrote:> On Dec 15, 2007, at 12:15 PM, Richard Pennington 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 at 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. :-( 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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: llvmbuilder.patch
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20071217/7cb6fd27/attachment.ksh>