Harel Cain
2011-Jan-24 09:56 UTC
[LLVMdev] How to create an IntegerType of the native word size
Hi all, I couldn't find any reasonable way to create the IntegerType that would match, say, intptr_t, that is the native word size of the machine I'm building on. More accurately defined, when compiling on a 64 bit Mac OS machine I want it to be Int64Ty, but if for example I'm using the "-arch i386" command line option on that machine during compilation, I want it to be Int32Ty. I'm sure that has to be some perfect solution out there, does anyone know? Thanks! Harel Cain -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110124/fdd53a9e/attachment.html>
Duncan Sands
2011-Jan-24 10:22 UTC
[LLVMdev] How to create an IntegerType of the native word size
Hi Harel Cain,> I couldn't find any reasonable way to create the IntegerType that would match, > say, intptr_t, that is the native word size of the machine I'm building on. More > accurately defined, when compiling on a 64 bit Mac OS machine I want it to be > Int64Ty, but if for example I'm using the "-arch i386" command line option on > that machine during compilation, I want it to be Int32Ty. > > I'm sure that has to be some perfect solution out there, does anyone know?try the getIntPtrType method defined in TargetData. It is defined in TargetData because you need to know the target in order to know the size of a pointer. Ciao, Duncan.
ether zhhb
2011-Jan-24 10:25 UTC
[LLVMdev] How to create an IntegerType of the native word size
hi, You may try TargetData's "getIntPtrType" for intptr_t. best regards ether On Mon, Jan 24, 2011 at 5:56 PM, Harel Cain <harel.cain at gmail.com> wrote:> Hi all, > > I couldn't find any reasonable way to create the IntegerType that would > match, say, intptr_t, that is the native word size of the machine I'm > building on. More accurately defined, when compiling on a 64 bit Mac OS > machine I want it to be Int64Ty, but if for example I'm using the "-arch > i386" command line option on that machine during compilation, I want it to > be Int32Ty. > > I'm sure that has to be some perfect solution out there, does anyone know? > > > Thanks! > > Harel Cain > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >