[llvm-commits] [PATCH] Add malloc call utility functions
Evan Cheng
evan.cheng at apple.com
Mon Sep 7 18:43:22 PDT 2009
Hi Victor,
Some comments:
+// This family of functions help identify calls to malloc.
This comment isn't accurate, right? Please update. Thanks.
+const CallInst* IsMallocCall(const Value* I);
+const PointerType* GetMallocType(const CallInst* CI);
I don't have a strong opinion about this. But our naming convention
seems to be lower case 'is' and 'get'. See Constants.h.
+CallInst* IsMallocCall(Value* I);
This is not a very good name for what is does. Perhaps ExtractMallocCall
IsMallocBitCast
Perhaps isBitCastOfMallocCall?
+ // Determine type only if there is only 1 bitcast use of CI
Period at the end please. :-)
+#if 1
return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), 0, Name));
+#else
Please don't leave #if #else around.
Thanks,
Evan
On Sep 4, 2009, at 5:58 PM, Victor Hernandez wrote:
> Here is an update to this patch to incorporate suggested changes.
>
> I also went ahead and started modifying the optimization passes and
> transforms to use the MallocHelper functions, so that I know I have
> the right helper functions. The changes to the passes are not in
> this patch, but will be coming next.
>
> Also I have included the LLParser, BitCodeReader, and VMCore changes
> that use the new malloc codegen instead of MallocInst. Those
> changes are disabled by default until the changes to the passes are
> in.
>
> <MallocHelper.diff>
>
> Victor
>
>> I am working on fixing the MallocInst/i64 alloca bug:
>> http://llvm.org/bugs/show_bug.cgi?id=715
>>
>> Here is the first of a series of patches that will result in
>> tearing out MallocInst. Before I can tear it out, I need to update
>> all of the optimization passes and transforms that operate on
>> MallocInst to operate on malloc CallInst instead.
>>
>> This patch consists of a set of utility functions that create IR
>> for malloc calls and identify that IR. It also rewrites
>> LowerAllocations to use the new utility function,
>> CallInst::CreateMalloc().
>>
>> <mallocUtils.diff>
>>
>> Victor
>>
>> ---
>> Victor Hernandez vhernandez at apple.com
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list