[LLVMdev] Getting TargetData and TargetLibraryInfo for determining Malloc size
Caldarale, Charles R
Chuck.Caldarale at unisys.com
Tue Oct 29 06:18:35 PDT 2013
> 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
More information about the llvm-dev
mailing list