Displaying 5 results from an estimated 5 matches for "elmentptr".
Did you mean:
elementptr
2011 May 18
3
[LLVMdev] access array problem
...nter,
&index[0], index.size());
Value *oldcounter = new LoadInst(ElementPtr, "oldcounter", InsertPos);
Value *newcounter = BinaryOperator::Create(Instruction::Add,
oldcounter, ConstantInt::get(Type::getInt64Ty(Context), 1),
"newcounter", InsertPos);
new StoreInst(newcounter, ElmentPtr, InserPos);
//store the memory address to counterArray[oldcounter]
std::vector<Constant*> indexC(2);
indexC[0] = Constant::getNullvalue(Type:getInt32Ty(Context));
indexC[1] = dync_cast(llvm::ConstantInt>(oldcounter);
Constant *ElmentPtr = ConstantExpr::getGetElementPtr(counterArray,
&...
2011 May 18
0
[LLVMdev] access array problem
...x.size());
> Value *oldcounter = new LoadInst(ElementPtr, "oldcounter", InsertPos);
> Value *newcounter = BinaryOperator::Create(Instruction::Add,
> oldcounter, ConstantInt::get(Type::getInt64Ty(Context), 1),
> "newcounter", InsertPos);
> new StoreInst(newcounter, ElmentPtr, InserPos);
>
> //store the memory address to counterArray[oldcounter]
> std::vector<Constant*> indexC(2);
> indexC[0] = Constant::getNullvalue(Type:getInt32Ty(Context));
> indexC[1] = dync_cast(llvm::ConstantInt>(oldcounter);
Since oldcounter is not a constant (its value...
2011 May 18
2
[LLVMdev] access array problem
...Value *oldcounter = new LoadInst(ElementPtr, "oldcounter", InsertPos);
>> Value *newcounter = BinaryOperator::Create(Instruction::Add,
>> oldcounter, ConstantInt::get(Type::getInt64Ty(Context), 1),
>> "newcounter", InsertPos);
>> new StoreInst(newcounter, ElmentPtr, InserPos);
>>
>> //store the memory address to counterArray[oldcounter]
>> std::vector<Constant*> indexC(2);
>> indexC[0] = Constant::getNullvalue(Type:getInt32Ty(Context));
>> indexC[1] = dync_cast(llvm::ConstantInt>(oldcounter);
> Since oldcounter is...
2011 May 18
0
[LLVMdev] access array problem
...index
> to access an array?
No, this is perfectly possible. I think you are confusing constants and
instructions. Instructions are executed at runtime. Constants are known
at compile time. You clearly need an instruction here but you are trying
to create a constant.
>>> Constant *ElmentPtr = ConstantExpr::getGetElementPtr(counterArray,
>>> &indexC[0], indexC.size());
Here you should be using GetElementPtrInst::Create to make a getelementptr
instruction rather than using ConstantExpr::getGetElementPtr which creates a
getelementptr constant (which represents a constant ad...
2011 May 18
2
[LLVMdev] access array problem
...ray?
> No, this is perfectly possible. I think you are confusing constants and
> instructions. Instructions are executed at runtime. Constants are known
> at compile time. You clearly need an instruction here but you are trying
> to create a constant.
>
>>>> Constant *ElmentPtr = ConstantExpr::getGetElementPtr(counterArray,
>>>> &indexC[0], indexC.size());
> Here you should be using GetElementPtrInst::Create to make a getelementptr
> instruction rather than using ConstantExpr::getGetElementPtr which creates a
> getelementptr constant (which repres...