[llvm-dev] Passing Array base address/pointer to runtime function in LLVM IR

Bernard Nongpoh via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 8 23:08:12 PST 2018


Hello LLVM,

I am a beginner in  LLVM

My Goal is to initialize array element with random values.

 llvm::Type *i32_type = llvm::IntegerType::getInt32Ty(allocaInst->getContext());

    llvm::Value *value = llvm::ConstantInt::get(i32_type, numberOfElement);


    args.push_back(getElementPtrInst->getPointerOperand());
    args.push_back(value);

callInst = llvm::CallInst::Create(runtimeInitializeRandomIntegerArrayValue,
args,""
                                           , allocaInst->getNextNode());

Tried the above code but no luck ..
Any method that can easily pass array base address/pointer to function.

Question on stackoverlfow:
https://stackoverflow.com/questions/48162515/passing-array-base-address-pointer-to-runtime-function-in-llvm-ir

 Thanks in advance..

Bernard Nongpoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180109/9d999b9b/attachment.html>


More information about the llvm-dev mailing list