Displaying 7 results from an estimated 7 matches for "gettypeatindex".
2008 Jul 16
3
[LLVMdev] GEP::getIndexValid() with other iterators
...s cast and also makes the other getIndexedType
implementation (which is called by this one) a template, passing in an
iterator over unsigned should also work. The actual types over which an
iterator is allowed should now be limited by the parameters to
CompositeType::indexValid() and CompositeType::getTypeAtIndex() (which
currently are Value* or unsigned).
I've attached a patch which does exactly this. Since my template-fu is not so
strong, please review :-) I've also attached another patch to argpromotion,
which passes an unsigned iterator to getIndexedType()
(look for the comment
// This uses t...
2008 Jul 16
0
[LLVMdev] GEP::getIndexValid() with other iterators
...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 the new type forwards to another type, then it is in the middle
- // of being refined to another type (and hence, may have dropped all
- // references to what it was using before). So, use the new forwarded
- // type.
- if (const Type *Ty = Agg->getForwardedType...
2008 Jul 23
0
[LLVMdev] GEP::getIndexValid() with other iterators
...,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);
@@ -1103,6 +1107,18 @@
return CurIdx == NumIdx ? Agg : 0;
}
+const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,
+ Value* const *Idxs,
+ unsigned NumIdx) {
+ return getIndexedTypeIn...
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 Nov 15
1
[LLVMdev] How to use EE->runFunction for a function with StructRet set?
...turning std::string
Function *F = M->getFunction("_Z9get_hellov");
// XXX Is all of this the right way?
const Type* paramType = F->getFunctionType()->getParamType(0); //
pointer to struct
const Type* structRetType = dynamic_cast<const
PointerType*>(paramType)->getTypeAtIndex((unsigned)0);
const std::string structRetName(M->getTypeName(structRetType));
if (structRetName != "struct.std::string")
return 1;
// Get object size
uint64_t size = EE->getTargetData()->getABITypeSize(structRetType);
// Make room on stack
void* p = alloca(size)...
2020 Oct 01
3
Creating a global variable for a struct array
...xternalLinkage, htabInit, "htab");
Here is the error message:
opt: /home/chaitra/llvm-5-src/lib/IR/Constants.cpp:879: llvm::ConstantAggregate::ConstantAggregate(llvm::CompositeType*, llvm::Value::ValueTy, llvm::ArrayRef<llvm::Constant*>): Assertion `V[I]->getType() == T->getTypeAtIndex(I) && "Initializer for composite element doesn't match!"' failed.
#0 0x0000000001e558fa (opt+0x1e558fa)
#1 0x0000000001e5366e (opt+0x1e5366e)
#2 0x0000000001e537e2 (opt+0x1e537e2)
#3 0x00007f8a98a55390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007...
2020 Oct 01
2
Creating a global variable for a struct array
Thank you very much. The code to initialize h1 to non-zero values was what I was looking for.
It's almost working except for a type mismatch wrt dlist* llist field of h1.
dlist static_lst[10] = { {1, 5, NULL}, ... };
dhash h1[10] = {{"myfile.txt", static_lst}, ... };
Along the lines of the code you had sent, I created a GlobalVariable* llist of type [10 x %struct.dlist]* for the