Displaying 10 results from an estimated 10 matches for "curidx".
2008 Jul 07
0
[LLVMdev] (GEP) Index validity
...llvm {
Index: lib/Target/TargetData.cpp
===================================================================
--- lib/Target/TargetData.cpp (revision 53136)
+++ lib/Target/TargetData.cpp (working copy)
@@ -553,8 +553,7 @@
TI = gep_type_begin(ptrTy, Indices, Indices+NumIndices);
for (unsigned CurIDX = 0; CurIDX != NumIndices; ++CurIDX, ++TI) {
if (const StructType *STy = dyn_cast<StructType>(*TI)) {
- assert(Indices[CurIDX]->getType() == Type::Int32Ty &&
- "Illegal struct idx");
+ assert(isa<ConstantInt>(Indices[CurIDX]) && &q...
2008 Jul 10
2
[LLVMdev] (GEP) Index validity
...etData.cpp
> ===================================================================
> --- lib/Target/TargetData.cpp (revision 53136)
> +++ lib/Target/TargetData.cpp (working copy)
> @@ -553,8 +553,7 @@
> TI = gep_type_begin(ptrTy, Indices, Indices+NumIndices);
> for (unsigned CurIDX = 0; CurIDX != NumIndices; ++CurIDX, ++TI) {
> if (const StructType *STy = dyn_cast<StructType>(*TI)) {
> - assert(Indices[CurIDX]->getType() == Type::Int32Ty &&
> - "Illegal struct idx");
> + assert(isa<ConstantInt>(Indices[Cu...
2008 Jul 07
2
[LLVMdev] (GEP) Index validity
Hi all,
I'm fiddling around a bit with programmatically created GEP instructions,
which is failing when using i64 for any indix, except the first.
The reason behind this, is that StructureType::indexValid only accepts Value*
that are constant ints of width 32. I can't really see why this limitation is
here.
SequentialType solves this slightly differently, it allows for both 32 and 64
2008 Jul 16
0
[LLVMdev] GEP::getIndexValid() with other iterators
...unsigned NumIdx) {
- const PointerType *PTy = dyn_cast<PointerType>(Ptr);
- if (!PTy) return 0; // Type isn't a pointer type!
- const Type *Agg = PTy->getElementType();
-
- // Handle the special case of the empty set index set...
- if (NumIdx == 0)
- return Agg;
-
- unsigned CurIdx = 1;
- for (; CurIdx != NumIdx; ++CurIdx) {
- const CompositeType *CT = dyn_cast<CompositeType>(Agg);
- if (!CT || isa<PointerType>(CT)) return 0;
- Value *Index = Idxs[CurIdx];
- if (!CT->indexValid(Index)) return 0;
- Agg = CT->getTypeAtIndex(Index);
-
- // If...
2008 Jul 23
0
[LLVMdev] GEP::getIndexValid() with other iterators
...IndexTy const *Idxs,
+ unsigned NumIdx) {
const PointerType *PTy = dyn_cast<PointerType>(Ptr);
if (!PTy) return 0; // Type isn't a pointer type!
const Type *Agg = PTy->getElementType();
@@ -1089,7 +1093,7 @@
for (; CurIdx != NumIdx; ++CurIdx) {
const CompositeType *CT = dyn_cast<CompositeType>(Agg);
if (!CT || isa<PointerType>(CT)) return 0;
- Value *Index = Idxs[CurIdx];
+ IndexTy Index = Idxs[CurIdx];
if (!CT->indexValid(Index)) return 0;
Agg = CT->getTypeAtIndex(Index);...
2008 Jul 16
3
[LLVMdev] GEP::getIndexValid() with other iterators
Hi all,
currently, GetElementPtrInst has a method getIndexedType, which has a
templated variant. You pass in a begin and an end iterator, and it will find
the indexed type for those. However, both iterators must iterate over Value*.
For some argpromotion code, I would like to pass in iterators that iterate
over unsigneds instead of Value*. I currently solve this by transforming my
2008 Jul 23
2
[LLVMdev] GEP::getIndexValid() with other iterators
On Jul 22, 2008, at 11:54 PM, Matthijs Kooijman wrote:
> Hi Chris,
>
>
>> I'd prefer to not turn this into a template. Why not just define a
>> version that takes an array of uint64_t's or something like that?
> because I want to be able to pass in iterators. I could define a
> version that
> takes std<uint64_t>::iterators, but next thing we know, we
2008 Jul 10
0
[LLVMdev] (GEP) Index validity
...=================================================================
>> --- lib/Target/TargetData.cpp (revision 53136)
>> +++ lib/Target/TargetData.cpp (working copy)
>> @@ -553,8 +553,7 @@
>> TI = gep_type_begin(ptrTy, Indices, Indices+NumIndices);
>> for (unsigned CurIDX = 0; CurIDX != NumIndices; ++CurIDX, ++TI) {
>> if (const StructType *STy = dyn_cast<StructType>(*TI)) {
>> - assert(Indices[CurIDX]->getType() == Type::Int32Ty &&
>> - "Illegal struct idx");
>> + assert(isa<ConstantInt...
2010 Mar 15
0
[LLVMdev] [patch] Writing ConstantUnions
...e Type::VoidTyID:
AlignType = INTEGER_ALIGN;
@@ -600,6 +620,11 @@
// Update Ty to refer to current element
Ty = STy->getElementType(FieldNo);
+ } else if (const UnionType *UnTy = dyn_cast<UnionType>(*TI)) {
+ unsigned FieldNo = cast<ConstantInt>(Indices[CurIDX])->getZExtValue();
+
+ // Offset into union is canonically 0, but type changes
+ Ty = UnTy->getElementType(FieldNo);
} else {
// Update Ty to refer to current element
Ty = cast<SequentialType>(Ty)->getElementType();
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.
--------------