[LLVMdev] Type get size
Scott Ricketts
sricketts at maxentric.com
Mon Jun 29 18:58:09 PDT 2009
Ah, I needed some target-dependent stuff (TargetData) to make this work.
On Mon, Jun 29, 2009 at 3:41 PM, Scott Ricketts<sricketts at maxentric.com> wrote:
> I am trying to get the address ranges that are allocated by the global
> variable list of a module. I cannot seem to find an easy way to get
> the size of a global variable.
I used TargetData::getTypeSizeInBits(const Type* Ty). Also, I added:
AU.addRequired<TargetData>();
to getAnalysisUsage(AnalysisUsage &AU) for my pass struct.
There are a few other options for getting type size from TargetData
(e.g. getTypeAllocSize).
Scott
More information about the llvm-dev
mailing list