Arnamoy Bhattacharyya
2013-Oct-29 11:02 UTC
[LLVMdev] Getting TargetData and TargetLibraryInfo for determining Malloc size
Hello; I was trying to use the computeArraySize() function from the MemoryBuiltins.cpp file. It requires two arguments DataLayout *TD and const TargetLibraryInfo *TLI. Can anyone tell me how to get the TargetLibraryInfo? I am getting the DataLayout using: DataLayout *TD; TD = new DataLayout(&M); I hope that's the right way of getting it. Thanks a lot; -- Arnamoy Bhattacharyya Athabasca Hall 143 Department of Computing Science - University of Alberta Edmonton, Alberta, Canada, T6G 2E8 587-710-7073
Caldarale, Charles R
2013-Oct-29 13:18 UTC
[LLVMdev] Getting TargetData and TargetLibraryInfo for determining Malloc size
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Arnamoy Bhattacharyya > Subject: [LLVMdev] Getting TargetData and TargetLibraryInfo for determining Malloc size> I was trying to use the computeArraySize() function from the > MemoryBuiltins.cpp file. It requires two arguments DataLayout *TD and > const TargetLibraryInfo *TLI. Can anyone tell me how to get the > TargetLibraryInfo?For examples, take a look at the related code in the LLVM tools: tools/clang/lib/CodeGen/BackendUtil.cpp tools/opt/opt.cpp tools/llc/llc.cpp // Add an appropriate TargetLibraryInfo pass for the module's triple. TargetLibraryInfo *TLI = new TargetLibraryInfo(TheTriple); if (DisableSimplifyLibCalls) TLI->disableAllFunctions(); PM.add(TLI); - Chuck