search for: structty

Displaying 20 results from an estimated 29 matches for "structty".

2005 Mar 08
0
[LLVMdev] Recursive Types using the llvm support library
On Mon, 7 Mar 2005, John Carrino wrote: > As far as I can tell, when you construct a type using the support > library StructType::get, you have to pass in a list of types. How can > you make a Recursive type by passing in a pointer to the type you are > constucting. > > An example where something really simple like the line below was output > would be perfect. > > %struct.linked_list = type { %struct....
2005 Mar 08
2
[LLVMdev] Recursive Types using the llvm support library
>> An example where something really simple like the line below was output >> would be perfect. >> >> %struct.linked_list = type { %struct.linked_list*, %sbyte* } > > Use something like this: > > PATypeHolder StructTy = OpaqueType::get(); > std::vector<const Type*> Elts; > Elts.push_back(PointerType::get(StructTy)); > Elts.push_back(PointerType::get(Type::SByteTy)); > StructType *NewSTy = StructType::get(Elts); > > // At this point, NewSTy = "{ opaque*, sbyte* }", tel...
2005 Mar 08
3
[LLVMdev] Recursive Types using the llvm support library
As far as I can tell, when you construct a type using the support library StructType::get, you have to pass in a list of types. How can you make a Recursive type by passing in a pointer to the type you are constucting. An example where something really simple like the line below was output would be perfect. %struct.linked_list = type { %struct.linked_list*, %sbyte* } Thanks...
2004 Oct 06
1
[LLVMdev] generating function declarations in c frontend
I'm trying to generate the declarations for function intrinsics, and I must be misunderstanding how to create new functions - I saw that a function with no basic blocks is treated as a declaration, so I tried to just create one and add it to the globals list: llvm_type *structTy, *ptrToStructTy; structTy = llvm_type_create_struct(0, 0); structTy = llvm_type_get_cannonical_struct(structTy); ptrToStructTy = llvm_type_get_pointer(structTy); llvm_function *dbg_stoppoint_fn = llvm_function_new(ptrToStructTy, "llvm.dbg.stoppoint"); llvm_argument *arg = llvm...
2005 Mar 15
2
[LLVMdev] Dynamic Creation of a simple program
Thanks for the information I am trying to use one of your examples for recursive data structures: ========================= PATypeHolder StructTy = OpaqueType::get(); std::vector<const Type*> Elts; Elts.push_back(PointerType::get(StructTy)); Elts.push_back(PointerType::get(Type::SByteTy)); StructType *NewSTy = StructType::get(Elts); // At this point, NewSTy = "{ opaque*, sbyte* }", tell VMCore that // the struct and the opaq...
2005 Mar 08
0
[LLVMdev] Recursive Types using the llvm support library
...erzliakov wrote: >>> An example where something really simple like the line below was output >>> would be perfect. >>> >>> %struct.linked_list = type { %struct.linked_list*, %sbyte* } >> >> Use something like this: >> >> PATypeHolder StructTy = OpaqueType::get(); >> std::vector<const Type*> Elts; >> Elts.push_back(PointerType::get(StructTy)); >> Elts.push_back(PointerType::get(Type::SByteTy)); >> StructType *NewSTy = StructType::get(Elts); >> >> // At this point, NewSTy = "{ opaq...
2005 Mar 15
0
[LLVMdev] Dynamic Creation of a simple program
On Tue, 15 Mar 2005, xavier wrote: > Thanks for the information > I am trying to use one of your examples for recursive data structures: > > ========================= > PATypeHolder StructTy = OpaqueType::get(); > std::vector<const Type*> Elts; > Elts.push_back(PointerType::get(StructTy)); > Elts.push_back(PointerType::get(Type::SByteTy)); > StructType *NewSTy = StructType::get(Elts); > > // At this point, NewSTy = "{ opaque*, sbyte* }", tell VMCore th...
2008 Sep 12
2
[LLVMdev] Order of fiels and structure usage
...structure type and its fields before it is completely defined. To be specific, let me ask detailed questions at various stages in the construction of a recursive type. I copy from http://llvm.org/docs/ProgrammersManual.html#TypeResolve // Create the initial outer struct PATypeHolder StructTy = OpaqueType::get(); Is it possible to declare variables of type StructTy at this point? Is it possible to define other structured types that have fields of type StructTy at this point? I'm guessing the answers to these questions are "Yes". std::vector<const Type*> Elts...
2020 Jan 14
2
sizeof implementation: how to get size as a constantInt?
I'm implementing c style "sizeof()", and I did as http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt illuarstrated, and it works find, here's an example of my implementation: auto *p = builder.CreateGEP(structTy, llvm::ConstantPointerNull::get(pointerTy), constint1); auto *size = builder.CreatePtrToInt(p, llvm::IntegerType::get(context, 64)); and type definitions: auto *constint1 = llvm::ConstantInt::get(context, llvm::APInt(64, 1)); auto *int...
2008 Oct 03
1
[LLVMdev] Question about recursive types
Dear all, I'm trying to run the example of recursive type construction examples in LLVM Programmer's Manual, here is the code: // Create the initial outer struct PATypeHolder StructTy = OpaqueType::get(); std::vector<const Type*> Elts; Elts.push_back(PointerType::get(StructTy)); Elts.push_back(Type::Int32Ty); StructType *NewSTy = StructType::get(Elts); // At this point, NewSTy = "{ opaque*, i32 }". Tell VMCore that // the struct and the opaque type are actually...
2008 Jun 13
1
[LLVMdev] code generation order revisited.
...-0400, Gordon Henriksen wrote: > > Partially opaque types can be refined. This section of the programmer's > manual is applicable: > > http://llvm.org/docs/ProgrammersManual.html#BuildRecType > > — Gordon Here it is: : // Create the initial outer struct : PATypeHolder StructTy = OpaqueType::get(); : std::vector<const Type*> Elts; : Elts.push_back(PointerType::get(StructTy)); : Elts.push_back(Type::Int32Ty); : StructType *NewSTy = StructType::get(Elts); Here NewSTy is a pointer to StructType. : // At this point, NewSTy = "{ opaque*, i32 }". Tell VMCore t...
2008 Sep 12
0
[LLVMdev] Order of fiels and structure usage
...ds before > it is completely defined. To be specific, let me ask detailed questions > at various stages in the construction of a recursive type. I copy from > > http://llvm.org/docs/ProgrammersManual.html#TypeResolve > > // Create the initial outer struct > PATypeHolder StructTy = OpaqueType::get(); > > Is it possible to declare variables of type StructTy at this point? I think you can, although you have to be careful; if you don't make sure the variable eventually has a computable size, the module won't be valid. Declaring variables of type pointer to Stru...
2005 Mar 16
1
[LLVMdev] Dynamic Creation of a simple program
...o that? Thanks --- Chris Lattner <sabre at nondot.org> wrote: > On Tue, 15 Mar 2005, xavier wrote: > > Thanks for the information > > I am trying to use one of your examples for recursive data structures: > > > > ========================= > > PATypeHolder StructTy = OpaqueType::get(); > > std::vector<const Type*> Elts; > > Elts.push_back(PointerType::get(StructTy)); > > Elts.push_back(PointerType::get(Type::SByteTy)); > > StructType *NewSTy = StructType::get(Elts); > > > > // At this point, NewSTy = "{ opaque*,...
2008 Jun 12
0
[LLVMdev] code generation order revisited.
On Jun 12, 2008, at 13:25, Hendrik Boom wrote: > So it appears that types are processed for identity the moment they > are made during parse tree construction? Yes. > This means that a type has to be completely known on creation. Yes. > Presumably there's some mechanism tor a type that isn't completely > known yet -- or is thet avoided by having a type
2008 Jun 12
2
[LLVMdev] code generation order revisited.
>> >> I think I may have found an exception to this -- the API seems to >> require me to have all the fields for a struct ready before I >> construct the struct. I don't have the ability to make a struct >> type, use it to declare some variables, and still contribute fields >> to it during the rest of the compilation. >> >> Is there a
2008 Oct 03
0
[LLVMdev] Making Sense of ISel DAG Output
On Fri, October 3, 2008 9:10 am, David Greene wrote: > On Thursday 02 October 2008 19:32, Dan Gohman wrote: > >> Looking at your dump() output above, it looks like the pre-selection >> loads have multiple uses, so even though you've managed to match a >> larger pattern that incorporates them, they still need to exist to >> satisfy some other users. > > Yes,
2005 Mar 09
4
[LLVMdev] Recursive Types using the llvm support library
...;> An example where something really simple like the line below was output >>>> would be perfect. >>>> >>>> %struct.linked_list = type { %struct.linked_list*, %sbyte* } >>> >>> Use something like this: >>> >>> PATypeHolder StructTy = OpaqueType::get(); >>> std::vector<const Type*> Elts; >>> Elts.push_back(PointerType::get(StructTy)); >>> Elts.push_back(PointerType::get(Type::SByteTy)); >>> StructType *NewSTy = StructType::get(Elts); >>> >>> // At this point...
2008 Oct 03
3
[LLVMdev] Making Sense of ISel DAG Output
On Thursday 02 October 2008 19:32, Dan Gohman wrote: > Looking at your dump() output above, it looks like the pre-selection > loads have multiple uses, so even though you've managed to match a > larger pattern that incorporates them, they still need to exist to > satisfy some other users. Yes, I looked at that too. It looks like these other uses end up being chains to
2008 Sep 13
3
[LLVMdev] Order of fiels and structure usage
...efined. To be specific, let me ask detailed >> questions at various stages in the construction of a recursive type. I >> copy from >> >> http://llvm.org/docs/ProgrammersManual.html#TypeResolve >> >> // Create the initial outer struct >> PATypeHolder StructTy = OpaqueType::get(); >> >> Is it possible to declare variables of type StructTy at this point? > > I think you can, although you have to be careful; if you don't make sure > the variable eventually has a computable size, the module won't be > valid. Of course, even...
2012 Nov 09
1
[LLVMdev] Do I need to calculate padding by myself to construct a StructType ?
...e API requires user to handle padding and value combination for the initializer by themselves. Is there any way to create the struct more simply like this: fields.push_back(Type::getIntNTy(context, 1)); fields.push_back(Type::getIntNTy(context, 2)); fields.push_back(Type::getIntNTy(context, 64)); structTy.setBody(fields, false /* isPacked*/); It's really tough to do layout work and it's very likely to cause bugs. Combining the values for the initializer is also not easy. As my understanding, if I tell llvm API that the struct is not packed, it should handle padding automatically, right? A...