search for: structtype

Displaying 20 results from an estimated 276 matches for "structtype".

2013 Jan 22
2
[LLVMdev] StructType opaque->sized
I'm building a StructType without a body using StructType *StructType::create(LLVMContext &Context, StringRef Name); and then later adding a body to with setBody(). It starts of isOpaque() == true, and isSized() == false, and after I add the body, isOpaque() == false, but isSized() is still false. If I create a Stru...
2011 Jul 25
4
[LLVMdev] Lack of use of LLVMContextImpl::NamedStructTypes
Several people on this list have reported issues with the linker regarding a named StructType instance with the same name in two different modules being resolved into two StructTypes with different names due to StructType:: setName(…) collision behavior. Looking at BitcodeReader::ParseTypeTableBody(…), I don't see use of LLVMContextImpl::NamedStructTypes or of Module::getTypeByName(…)....
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 returns 0, not what I need } Basically I...
2006 Dec 08
0
[LLVMdev] Proposed: first class packed structures
...ould be propagated into the code generator. This is http://llvm.org/PR400. It would be great if you were interested in tackling this too, but your patch isn't a regression, so it can go in without it. Comments: *** You need to update LangRef.html. @@ -154,24 +154,28 @@ public: class StructType : public CompositeType { friend class TypeMap<StructValType, StructType>; StructType(const StructType &); // Do not implement const StructType &operator=(const StructType &); // Do not implement + // is this a packed structure? + bool packed;...
2010 Jan 18
5
[LLVMdev] [patch] Union Types - work in progress
...t CS. LLParser.cpp: In LLParser::ParseUnionType, you can use SmallVector instead of std::vector for ParamsList & ParamsListTy. @@ -2135,7 +2173,8 @@ ParseToken(lltok::rparen, "expected ')' in extractvalue constantexpr")) return true; - if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val- >getType())) + if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val- >getType()) && + !isa<UnionType>(Val->getType())) return Error(ID.Loc, "extractvalue oper...
2013 Jan 22
0
[LLVMdev] StructType opaque->sized
Hi Rick, On 22/01/13 09:04, Rick Mann wrote: > I'm building a StructType without a body using > > StructType *StructType::create(LLVMContext &Context, StringRef Name); > > and then later adding a body to with setBody(). It starts of isOpaque() == true, and isSized() == false, and after I add the body, isOpaque() == false, but isSized() is still false....
2015 Aug 14
2
[LLVM RFC] Add llvm.typeid.for intrinsic
...return nullptr; + } } } @@ -6769,6 +6773,29 @@ void SelectionDAGBuilder::visitPatchpoint(ImmutableCallSite CS, FuncInfo.MF->getFrameInfo()->setHasPatchPoint(); } +void SelectionDAGBuilder::visitTypeidfor(const CallInst &CI) { + SDValue Res; + static std::vector<const StructType *> StructTypes; + int ID = -1; + Value *PtrArg = CI.getArgOperand(0); + PointerType *PTy = cast<PointerType>(PtrArg->getType()); + if (PTy) { + StructType *STy = cast<StructType>(PTy->getElementType()); + if (STy) { + for (unsigned i = 0, N = StructTypes.size(); i != N...
2018 Jul 24
2
StructType --> DICompositeType?
...name: "x", scope: !6, file: !3, line: 2, baseType: !9, size: 32) !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) !10 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !6, file: !3, line: 2, baseType: !9, size: 32, offset: 32) but given just the StructType for S there is no direct way to get to the DICompositeType. I've made something work by prescanning all the DITypes in my Module and creating a map that uses type names as the key, being careful to strip "struct." prefixes and maintain scoping for nested structs (e.g., S1::S2), which...
2006 Dec 06
4
[LLVMdev] Proposed: first class packed structures
Currently, Structure layout is left to targets, which implement them according to the ABI of that platform. While this is fine for most structures, it makes packed structures very ugly. All fields in a packed type must be converted to byte arrays with casts to access fields, which bloats accesses and obsfucates the types. First class support for packed types would clean up the generated code
2011 Jul 26
0
[LLVMdev] Lack of use of LLVMContextImpl::NamedStructTypes
On Jul 25, 2011, at 10:50 AM, Garrison Venn wrote: > Several people on this list have reported issues with the linker regarding a > named StructType instance with the same name in two different modules > being resolved into two StructTypes with different names due to StructType:: > setName(…) collision behavior. Looking at BitcodeReader::ParseTypeTableBody(…), > I don't see use of LLVMContextImpl::NamedStructTypes or of Module::get...
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...rser::ParseUnionType, you can use SmallVector instead of std::vector > for ParamsList & ParamsListTy. > > @@ -2135,7 +2173,8 @@ > ParseToken(lltok::rparen, "expected ')' in extractvalue > constantexpr")) > return true; > > - if (!isa<StructType>(Val->getType()) && > !isa<ArrayType>(Val->getType())) > + if (!isa<StructType>(Val->getType()) && > !isa<ArrayType>(Val->getType()) && > + !isa<UnionType>(Val->getType())) > return Error(ID.Loc, "...
2011 Jul 19
1
[LLVMdev] StructType::setName(...)
My apologies if this has already been discussed/explained (reference?). In browsing the new type system implementation, I was wondering if someone could give a simple example of why one would want to reset the name of a previous realized StructType instance (setBody(...) has been called). My curiosity is enhanced by the fact that reseting a name of a StructType instance may result in a symbol table collision which would result in the renamed name not matching the parameter name to setName(...). This question is for my own edification. It is...
2011 Aug 31
2
[LLVMdev] StructTypes in module
Quick question: how do I get a list of StructType* defined/used in a Module? I can't seem to find an appropriate iterator in the Module class... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110831/17715c85/attachment.html> -------------- next part...
2011 Aug 31
1
[LLVMdev] StructTypes in module
Nella citazione mercoledì 31 agosto 2011 20:35:46, Chris Lattner ha scritto: > On Aug 31, 2011, at 10:23 AM, Carlo Alberto Ferraris wrote: >> Quick question: how do I get a list of StructType* defined/used in a Module? I can't seem to find an appropriate iterator in the Module class... > Module::findUsedStructTypes. Note that this requires scanning the entire module, it is not an efficient operation. Thanks! By any chance, is there also a way (short of iterating on all instruct...
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
...k of a better word) of the alloca instruction. Correct. > My suggestion is to use the getAllocatedType() method of the > AllocaInst > class. I'm pretty sure it does what you want: > > if (AI->getAllocatedType()->getTypeID() == Type::StructTyID) > Better: if (isa<StructType>) or if (StructType *sT = dyn_cast<StructType>). — Gordon
2008 Jun 13
1
[LLVMdev] code generation order revisited.
...> 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 that : // the struct and the opaque type are actually the same. : cast<OpaqueType>(StructTy.get())->refineAbstractTypeTo(NewSTy); : // NewSTy i...
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 fo...
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...rser::ParseUnionType, you can use SmallVector instead of std::vector > for ParamsList & ParamsListTy. > > @@ -2135,7 +2173,8 @@ > ParseToken(lltok::rparen, "expected ')' in extractvalue > constantexpr")) > return true; > > - if (!isa<StructType>(Val->getType()) && > !isa<ArrayType>(Val->getType())) > + if (!isa<StructType>(Val->getType()) && > !isa<ArrayType>(Val->getType()) && > + !isa<UnionType>(Val->getType())) > return Error(ID.Loc, "...
2020 Jan 07
3
Best way of implement a fat pointer for C
Dear All, I’m working on a project that extends C. I’m adding a new type of pointer that is a fat pointer. It has some metadata about the pointed object besides the starting address of the object. Currently I implemented this pointer as an llvm:StructType. In llvm::Type generation function llvm::Type *CodeGenTypes::ConvertType(QualType T) in the case for clang::Type::Pointer, instead of creating an llvm::PointerType I create an llvm::StructType type for this new type of pointer. And I added some helper code in llvm::StructType and in multiple places...
2010 Nov 03
0
[LLVMdev] StructType member offset
...ctLayout type is also defined in TargetData.h). > > Ciao, > > Duncan. > > > 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()->getScalarSizeInBit...