search for: uniontype

Displaying 20 results from an estimated 27 matches for "uniontype".

2010 Jan 09
0
[LLVMdev] [PATCH] - Union types, attempt 2
On Jan 6, 2010, at 12:45 PM, Talin wrote: > This patch adds a UnionType to DerivedTypes.h. Cool. When proposing an IR extension, it is usually best to start with a LangRef.html patch so that we can discuss the semantics of the extension. Please do write this before you get much farther. I assume that you want unions usable in the same situations as a struct. Howev...
2010 Jan 06
3
[LLVMdev] [PATCH] - Union types, attempt 2
This patch adds a UnionType to DerivedTypes.h. It also adds code to the bitcode reader / writer and the assembly parser for the new type, as well as a tiny .ll test file in test/Assembler. It does not contain any code related to code generation or type layout - I wanted to see if this much was acceptable before I proceeded an...
2007 May 28
2
[LLVMdev] Problem in llvm gcc back-end
...g..) ===================================================== #include <stdio.h> struct MyString { char *chars; int length; }; struct LongestMember { char *chars; char charlength; int empty1; int empty2; }; typedef union { MyString string; LongestMember mt; } UnionType; int main() { UnionType original; UnionType *pointerToUnion; UnionType buffer; pointerToUnion = &buffer; original.string.chars = "mystring"; original.string.length = 8000; *pointerToUnion = original; printf("from pointerToUnion: chars %s, len...
2010 Jan 18
5
[LLVMdev] [patch] Union Types - work in progress
...// expressions. You have a couple of these things which revert a recent patch, please don't :) Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and implementation missing :) In UnionValType methods, please use "UT" instead of "ST" as an acronym. +bool UnionType::isValidElementType(const Type *ElemTy) { + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != LabelTyID && + ElemTy->getTypeID() != MetadataTyID && ! isa<FunctionType>(ElemTy); +} Please use "!ElemTy->isVoidTy()" etc....
2010 Jan 11
2
[LLVMdev] [PATCH] - Union types, attempt 2
...bid this? As far as constants go, as long as the initializer is an exact match for one of the member types, it should be no problem. On Fri, Jan 8, 2010 at 11:00 PM, Chris Lattner <clattner at apple.com> wrote: > > On Jan 6, 2010, at 12:45 PM, Talin wrote: > > This patch adds a UnionType to DerivedTypes.h. > > > Cool. When proposing an IR extension, it is usually best to start with a > LangRef.html patch so that we can discuss the semantics of the extension. > Please do write this before you get much farther. I assume that you want > unions usable in the same s...
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...these things which revert a recent patch, please don't > :) > > > Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and > implementation missing :) > > In UnionValType methods, please use "UT" instead of "ST" as an acronym. > > +bool UnionType::isValidElementType(const Type *ElemTy) { > + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != > LabelTyID && > + ElemTy->getTypeID() != MetadataTyID && > !isa<FunctionType>(ElemTy); > +} > > Please use "!Elem...
2010 Mar 15
0
[LLVMdev] [patch] Writing ConstantUnions
...Vector::get(&NewOps[0], NewOps.size()); } else { @@ -1015,6 +1017,11 @@ Elts.push_back(ValueList.getConstantFwdRef(Record[i], STy->getElementType(i))); V = ConstantStruct::get(STy, Elts); + } else if (const UnionType *UnTy = dyn_cast<UnionType>(CurTy)) { + uint64_t Index = Record[0]; + Constant *Val = ValueList.getConstantFwdRef(Record[1], + UnTy->getElementType(Index)); + V = ConstantUnion::get(UnTy, Val); } else if (const ArrayType *A...
2010 Mar 15
3
[LLVMdev] [patch] Writing ConstantUnions
Hello, I noticed a bit of a gap in the current code for unions: a ConstantUnion cannot be written out to .ll. Hopefully I'm not stepping on Talin's toes by posting this, it's a fairly straightforward adaptation of the code for structs just above. Tim. -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. --------------
2010 Feb 10
3
[LLVMdev] [patch] Union Types - work in progress
...patch, please >> don't :) >> >> >> Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and >> implementation missing :) >> >> In UnionValType methods, please use "UT" instead of "ST" as an acronym. >> >> +bool UnionType::isValidElementType(const Type *ElemTy) { >> + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != >> LabelTyID && >> + ElemTy->getTypeID() != MetadataTyID && >> !isa<FunctionType>(ElemTy); >> +} >> &gt...
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...these things which revert a recent patch, please don't > :) > > > Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and > implementation missing :) > > In UnionValType methods, please use "UT" instead of "ST" as an acronym. > > +bool UnionType::isValidElementType(const Type *ElemTy) { > + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != > LabelTyID && > + ElemTy->getTypeID() != MetadataTyID && > !isa<FunctionType>(ElemTy); > +} > > Please use "!Elem...
2010 Feb 10
0
[LLVMdev] [patch] Union Types - work in progress
...39;t. There are a couple instances of this. +void ConstantUnion::replaceUsesOfWithOnConstant(Value *From, Value *To, + Use *U) { + assert(false && "Implement replaceUsesOfWithOnConstant for unions"); +} + Still not implemented? +UnionType *UnionType::get(const Type *type, ...) { + va_list ap; + std::vector<const llvm::Type*> UnionFields; + va_start(ap, type); Please use smallvector. +bool UnionType::isValidElementType(const Type *ElemTy) { + return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() && +...
2010 Jan 16
0
[LLVMdev] [patch] Union Types - work in progress
OK here's the patch for real this time :) On Fri, Jan 15, 2010 at 4:36 PM, Talin <viridia at gmail.com> wrote: > Here's a work in progress of the union patch. Note that the test "union.ll" > does not work, so you probably don't want to check this in as is. However, > I'd be interested in any feedback you're willing to give. > > -- > -- Talin
2009 Aug 02
3
[LLVMdev] Union type efforts and ComputeLinearIndex
...ctionality up to the DAG building stage. I am not sure if this would work so perhaps I could get some opinions. My thoughts were as follows- introduce a new CompositeType called union (possibly refactoring some stuff into a common parent class from StructType). Recycle GEP (using RTTI) to handle UnionType field lookups as well. Add type codes into bitreader/bitwriter which would cope with the new union type. Add u { ... } into the AsmParser. Revise some of the target classes to cope with the unusual data layout and report back correct size for the union type. Add support for DAG generation into the...
2010 Jan 16
2
[LLVMdev] [patch] Union Types - work in progress
Here's a work in progress of the union patch. Note that the test "union.ll" does not work, so you probably don't want to check this in as is. However, I'd be interested in any feedback you're willing to give. -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL:
2009 Aug 02
2
[LLVMdev] Union type efforts and ComputeLinearIndex
...re if this would work so perhaps I could > get some opinions. > > > > My thoughts were as follows- introduce a new > CompositeType called union (possibly refactoring some stuff > into a common parent class from StructType). > > > > Recycle GEP (using RTTI) to handle UnionType field > lookups as well. Add type codes into bitreader/bitwriter > which would cope with the new union type. Add u { ... } into > the AsmParser. > > > > Revise some of the target classes to cope with the > unusual data layout and report back correct size for the > union t...
2010 Mar 29
6
[LLVMdev] Union types
...-as: Constants.cpp:67: static llvm::Constant* llvm::Constant::getNullValue(const llvm::Type*): Assertion `!"Cannot create a null constant of that type!"' failed. The comment just above that line is: default: // Function, Label, or Opaque type? Which implies no one was expecting a UnionType there... Also, if I generate the object code directly, llc fails too... Is there any plan to implement the union type? The work-around is quite ugly... cheers, --renato http://systemcall.org/ [1] http://llvm.org/docs/LangRef.html#t_union
2009 Aug 02
0
[LLVMdev] Union type efforts and ComputeLinearIndex
...the DAG building stage. I am not sure if this would work so perhaps I could get some opinions. > > My thoughts were as follows- introduce a new CompositeType called union (possibly refactoring some stuff into a common parent class from StructType). > > Recycle GEP (using RTTI) to handle UnionType field lookups as well. Add type codes into bitreader/bitwriter which would cope with the new union type. Add u { ... } into the AsmParser. > > Revise some of the target classes to cope with the unusual data layout and report back correct size for the union type. Add support for DAG generation...
2009 Aug 02
0
[LLVMdev] Union type efforts and ComputeLinearIndex
...haps I could >> get some opinions. >> > >> > My thoughts were as follows- introduce a new >> CompositeType called union (possibly refactoring some stuff >> into a common parent class from StructType). >> > >> > Recycle GEP (using RTTI) to handle UnionType field >> lookups as well. Add type codes into bitreader/bitwriter >> which would cope with the new union type. Add u { ... } into >> the AsmParser. >> > >> > Revise some of the target classes to cope with the >> unusual data layout and report back correct s...
2010 Mar 29
0
[LLVMdev] Union types
On Mon, Mar 29, 2010 at 01:15:30PM +0100, Renato Golin wrote: > Hi All, > > Which implies no one was expecting a UnionType there... > > Also, if I generate the object code directly, llc fails too... > > Is there any plan to implement the union type? The work-around is quite ugly... Sorry to Renato for getting two copeis of this, I cocked up the reply first time. Anyway, here's a patch for this issue...
2010 Feb 12
1
[LLVMdev] [patch] Union Types - work in progress
...m, Value *To, > + Use *U) { > + assert(false && "Implement replaceUsesOfWithOnConstant for unions"); > +} > + > > Still not implemented? > > Not in this patch - as you say, it's too large already. > +UnionType *UnionType::get(const Type *type, ...) { > + va_list ap; > + std::vector<const llvm::Type*> UnionFields; > + va_start(ap, type); > > Please use smallvector. > Done - although I was just copying from what Struct does. > > +bool UnionType::isValidElementType(const T...