Displaying 6 results from an estimated 6 matches for "getarraysize".
2010 Apr 06
2
[LLVMdev] Getting size of array allocations
...tion:
%a = alloca [10 x i32]
This is different than the type of instruction generated by the AllocaInst
constructor, which is of the type:
%a = alloca i32, i32 10
Now, how do I go about extracting '10' as the array size from the first
alloca instruction? isArrayAllocation returns false and getArraySize returns
1.
Thanks,
--Aashay
--
View this message in context: http://old.nabble.com/Getting-size-of-array-allocations-tp28146893p28146893.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
2010 Apr 06
0
[LLVMdev] Getting size of array allocations
On 5 April 2010 22:27, aashays <aashay.shringarpure at gatech.edu> wrote:
>
> Now, how do I go about extracting '10' as the array size from the first
> alloca instruction? isArrayAllocation returns false and getArraySize returns
> 1.
>
As a guess, get the type of the first alloca instruction, [10 x i32],
and get the number of elements from the array type, rather than from
the alloca instruction.
2002 Nov 27
1
[LLVMdev] Instruciton replacement
...lace an
instruction, and I'm not quite sure of what to do. I have the
following snippet of code:
switch((*I)->getOpcode()) {
case Instruction::Malloc:
{
AllocaInst *AI;
AI = new AllocaInst(cast<AllocationInst>(*I)->getAllocatedType(),
cast<AllocationInst>(*I)->getArraySize());
(*I)->replaceAllUsesWith(AI);
// (*I)->dropAllReferences();
// (*I)->getParent()->getInstList().erase(*I);
// delete (*I);
// delete(AI);
}
break;
running the code will report:
Leaked objects found: after running pass 'move memory objects from the
heap to the stack...
2008 Apr 16
0
[LLVMdev] Problems in removing a cloned instruction.
Hi,
I'm gonna try to give some feedback, but I have only been working with LLVM
for a few days, so don't take what I'm saying without verifying :-)
> BasicBlock *ProgSlicer::CloneBasicBlock(const BasicBlock *BB,
> DenseMap<const Value*, Value*> &ValueMap,
> const char *NameSuffix, Function *F) {
>
> BasicBlock
2008 Apr 16
2
[LLVMdev] Problems in removing a cloned instruction.
Hi all,
I am trying to write a pass where i am creating a clone of a
function (the only difference being, the new function returns void ,
instead of any value).
I am creating a new Function Type with a void return type (rest being
the same as original function), and using this i am creating a new
function body. Then, i clone the body of the old function into new
function, but when ever i
2014 Nov 03
8
[LLVMdev] [PATCH] Protection against stack-based memory corruption errors using SafeStack
...// GEP with non-constant indices can lead to memory errors
+ return false;
+
+ // We assume that GEP on static alloca with constant indices is safe,
+ // otherwise a compiler would detect it and warn during compilation.
+
+ if (!isa<const ConstantInt>(AI->getArraySize()))
+ // However, if the array size itself is not constant, the access
+ // might still be unsafe at runtime.
+ return false;
+
+ /* fallthough */
+
+ case Instruction::BitCast:
+ case Instruction::PHI:
+ case Instruction::Select:
+ // The obj...