search for: getoffsetof

Displaying 19 results from an estimated 19 matches for "getoffsetof".

Did you mean: getoffset
2009 Sep 23
2
[LLVMdev] DebugFactory
...onst Type * type) { > // Calculates the alignment of T using "sizeof({i8, T}) - sizeof > (T)" > return ConstantExpr::getSub( > getSize(StructType::get(Type::Int8Ty, type, NULL)), > getSize(type)); > } Are ConstantExpr::getAlignOf, getSizeOf, and getOffsetOf what you're looking for? Dan
2011 Feb 04
3
[LLVMdev] ConstantBuilder proposal
...r::getAlignOf(Ty); } /// GetSizeOf constant expr - computes the (alloc) size of a type (in /// address-units, not bits) in a target independent way (Note: the return /// type is an i64). /// static Constant *GetSizeOf(const Type* Ty) { return ConstantExpr::getSizeOf(Ty); } /// GetOffsetOf constant expr - computes the offset of a struct field in a /// target independent way (Note: the return type is an i64). /// static Constant *GetOffsetOf(const StructType* STy, unsigned FieldNo) { return ConstantExpr::getOffsetOf(STy, FieldNo); } /// GetOffsetOf constant expr - This...
2009 Sep 23
0
[LLVMdev] DebugFactory
...; // Calculates the alignment of T using "sizeof({i8, T}) - sizeof(T)" >> return ConstantExpr::getSub( >> getSize(StructType::get(Type::Int8Ty, type, NULL)), >> getSize(type)); >> } >> > > Are ConstantExpr::getAlignOf, getSizeOf, and getOffsetOf what > you're looking for? > > That will work. Now all I need is for the methods of DIFactory to take a Constant* instead of uint64. -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20...
2014 Sep 24
2
[LLVMdev] Runtime alignment
For the size of a type to be calculated at runtime, there is a known trick with gep. Is there any similar trick for determining the alignment of a type at runtime for target-independent IR? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140924/887f8612/attachment.html>
2010 Sep 07
2
[LLVMdev] Union type, is it really used or necessary?
...t use a non-packed struct: { i32, pointer } ? Or if you really want a packed struct, can you use <{ i32, i32, pointer }>, since you're already emitting target-dependent IR anyway? If you're computing the offset in order to use as a value within the program, you can use ConstantExpr::getOffsetOf. (If this isn't exposed in whatever bindings you're using, that can be fixed.) Dan
2015 Jan 02
2
[LLVMdev] Evaluation of offsetof() macro
Hi! LLVM has a class, ConstantExpr, that is very handy for compile-time evaluation of const expressions. Unfortunately I cannot find any methods in it that would be helpful in evaluation of expressions similar to this: (uintptr_t)(&(*(TYPE*)0).FIELD), which is basically the implementation of the offsetof(TYPE, FIELD) macro. Specifically, there seem to be no provisions for dereferencing a
2009 Sep 23
2
[LLVMdev] DebugFactory
...tes the alignment of T using "sizeof({i8, T}) - sizeof(T)" >>>    return ConstantExpr::getSub( >>>        getSize(StructType::get(Type::Int8Ty, type, NULL)), >>>        getSize(type)); >>> } >> >> Are ConstantExpr::getAlignOf, getSizeOf, and getOffsetOf what >> you're looking for? >> > That will work. Now all I need is for the methods of DIFactory to take a > Constant* instead of uint64. ok. Feel free to add /// CreateBasicType - Create a basic type like int, float, etc. DIBasicType CreateBasicType(DIDescriptor Conte...
2015 Jan 02
2
[LLVMdev] Evaluation of offsetof() macro
...that would be helpful in evaluation of expressions similar to this: >> (uintptr_t)(&(*(TYPE*)0).FIELD), which is basically the implementation of >> the offsetof(TYPE, FIELD) macro. >> > > I think the closest entity for this sort of thing is LLVM's > ConstantExpr::getOffsetOf. > Certainly, but I think this requires either making `offsetof` a first-class operation in the source language, or handling the folding of <pointer deref>-<field select>-<get-address-of> combo in the front-end. > Specifically, there seem to be no provisions for dereferen...
2010 May 08
0
[LLVMdev] does llvm have some way to get the size of data type
Hello! You can do this: http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt On Fri, May 7, 2010 at 8:26 PM, Gang.Yao <ttoole9 at gmail.com> wrote: > Hi: > > just like the c function sizeof(). I would avoid the usage of the c > function call, and expect something like llvm > intrinsic or some class providing this functionality. > > Does someone
2010 Sep 08
0
[LLVMdev] Union type, is it really used or necessary?
...t: { i32, pointer } ? Or if you really want > a packed struct, can you use <{ i32, i32, pointer }>, since you're > already emitting target-dependent IR anyway? > > If you're computing the offset in order to use as a value > within the program, you can use ConstantExpr::getOffsetOf. > (If this isn't exposed in whatever bindings you're using, > that can be fixed.) The thing is, I am not using the LLVM library, I generate IR code directly from Haskell (not using the library because it makes bootstrapping the compiler I'm working on more difficult). Secondly,...
2010 Nov 03
0
[LLVMdev] StructType member offset
...t; You can also use getelementptr to get the offset of a struct member: > > http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt Yup, except that this returns a constant expression in general, rather than a number. There's even a helper for doing this: ConstantExpr:getOffsetOf Ciao, Duncan. > > - Mark > > On Wed, Oct 27, 2010 at 2:25 AM, Duncan Sands <baldrick at free.fr > <mailto:baldrick at free.fr>> wrote: > > Hi Alex, > > I think you are looking for getStructLayout from TargetData (the > StructLayout type is al...
2010 Sep 18
2
[LLVMdev] Converting a Constant GEP to a POD integer?
Working on my garbage collector...I need to be able to convert a ConstantExpr to a plain int at link time. At compile time, I use ContactExpr::getOffsetOf() to calculate the offsets for pointer fields to be traced by the collector. Since the target machine has not yet been selected at this point, we don't yet know what the exact offset will be, so the expression cannot be flattened into a simple integer. That's OK, however, because most of th...
2009 Oct 02
0
[LLVMdev] DebugFactory
...quot;sizeof({i8, T}) - sizeof(T)" > >>> return ConstantExpr::getSub( > >>> getSize(StructType::get(Type::Int8Ty, type, NULL)), > >>> getSize(type)); > >>> } > >> > >> Are ConstantExpr::getAlignOf, getSizeOf, and getOffsetOf what > >> you're looking for? > >> > > That will work. Now all I need is for the methods of DIFactory to take a > > Constant* instead of uint64. > > ok. Feel free to add > /// CreateBasicType - Create a basic type like int, float, etc. > DIBasicTy...
2010 Oct 26
2
[LLVMdev] StructType member offset
Hi, how can i correctly calculate the size of a member of a struct (including alignment etc)? This doesn't work : const StructType *STy = cast<StructType>(Ty); for (StructType::element_iterator I = STy->element_begin(), E = STy->element_end(); I != E; ++I) { usigned size =I->get()->getScalarSizeInBits(); //often
2010 May 08
5
[LLVMdev] does llvm have some way to get the size of data type
Hi: just like the c function sizeof(). I would avoid the usage of the c function call, and expect something like llvm intrinsic or some class providing this functionality. Does someone have experience in this? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100507/056bae50/attachment.html>
2010 Sep 07
0
[LLVMdev] Union type, is it really used or necessary?
Chris Lattner wrote: > I removed unions from mainline in r112356. Sorry for reviving this old thread, but I think the removal of unions is a real pity. I use Haskell to generate LLVM code using David Terei's LLVM code from the GHC compiler (the compiler I'm working on is also written in Haskell). Once I've generated LLVM IR code I use llc to generate object code. I'm
2009 Sep 22
0
[LLVMdev] DebugFactory
On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com>wrote: > On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com> > wrote: > > On Tue, Sep 22, 2009 at 12:14 AM, Talin <viridia at gmail.com> wrote: > >> So, one feature of the late, lamented DebugInfoBuilder that I am missing > >> quite badly, and which is not
2009 Sep 22
3
[LLVMdev] DebugFactory
On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com> wrote: > On Tue, Sep 22, 2009 at 12:14 AM, Talin <viridia at gmail.com> wrote: >> So, one feature of the late, lamented DebugInfoBuilder that I am missing >> quite badly, and which is not available in the current DIFactory, is the >> ability to specify structure offsets abstractly. The
2010 Aug 28
4
[LLVMdev] Union type, is it really used or necessary?
I removed unions from mainline in r112356. -Chris On Jul 20, 2010, at 2:46 PM, Talin wrote: > On Tue, Jul 20, 2010 at 8:34 AM, Chris Lattner <clattner at apple.com> wrote: > > On Jul 20, 2010, at 1:36 AM, Anton Korobeynikov wrote: > > >> used to make the code manipulating the union type "well typed". This > >> approach seems work very well, is