similar to: [LLVMdev] Passing an array to an external function

Displaying 20 results from an estimated 2000 matches similar to: "[LLVMdev] Passing an array to an external function"

2013 Jan 27
1
[LLVMdev] Passing an array to an external function
Hi, I tried passing the array directly using and changing the getorInsertFunction accordingly but this didn't work. It fails with Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed. hookFunc = M.getOrInsertFunction("hook", Type::getVoidTy(M.getContext()),
2013 Jan 27
0
[LLVMdev] Passing an array to an external function
On Jan 26, 2013, at 19:24 , SArora <silkyar at umich.edu> wrote: > Hi all, > > I am new to LLVM, and I am learning how to use LLVM for profiling. I need to > pass an array to an external method, and insert a call instruction to the > method in the code. > > After reading a few source files, I've tried using GetElementPtrInst to pass > an array, but it fails at
2011 May 18
2
[LLVMdev] access array problem
Thank you, Duncan. I rewrote the code, please help check why it still does not work: //declare global variable const Type *IntTy = Type::getInt32Ty(M.getContext()); const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, GlobalValue::InternalLinkage,
2011 May 18
0
[LLVMdev] access array problem
Hi Guangming Tan, >>> GlobalVariable: >>> int *counter; //counter the number of load/store operations in run-time >>> int *counterArray; //record the load/store addresses >> strictly speaking these are not arrays, they are pointers. Also, you have >> written them in some kind of C-style idiom. What are the declarations in >> LLVM IR? > const Type
2011 May 18
2
[LLVMdev] access array problem
于 2011/5/18 14:29, Duncan Sands 写道: > Hi Tan Guangming, > >> I want to access an array in my instrumentation code. For example: >> >> GlobalVariable: >> int *counter; //counter the number of load/store operations in run-time >> int *counterArray; //record the load/store addresses > strictly speaking these are not arrays, they are pointers. Also, you have
2012 Jun 17
3
[LLVMdev] BlockAddress instruction is copied instead of cloned during module link?
I have a module having the blockaddress instruction. When I link it into another module and delete the original, blockaddress disappears and is replaced by inttoptr (i32 1 to i8*). Please compile and run the attached program to see the demo of this problem. Right after linking modules, blockaddress still exists: @switch.bbs = internal global [3 x i8*] [i8* blockaddress(@my_func,
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Evening, I was writing some code that tried to insert calls to the llvm.annotation intrinsic function, which has a signature of (i32, i8*, i8*, i32). The code is below. void addAnnotation( BasicBlock *block, Function *F) { string foo = "foo"; string bar = "barr"; Type *charTy = Type::getInt8Ty(block->getContext()); ArrayType *s1Ty =
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Andrew Ruef wrote: > Evening, > > I was writing some code that tried to insert calls to the > llvm.annotation intrinsic function, which has a signature of (i32, > i8*, i8*, i32). The code is below. > > void addAnnotation( BasicBlock *block, Function *F) > { > string foo = "foo"; > string bar = "barr"; > > Type
2020 Oct 01
3
Creating a global variable for a struct array
>The type you pass to GlobalVariable's constructor for that variable should be "[10 x %struct.dlist]" because that's what you want storage for. Then the GlobalVariable itself will be a Constant of type "[10 x %struct.dlist]*". Yes, I verified that this is the case. I enabled assertions and the error seems to occur while creating GlobalVariable for both struct dhash
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
I am trying to create such module with API (it's equivalent to c++: const char* ss[] = {"s1","s2"};): @ss = global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @.str1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0)] ; <[2 x i8*]*> [#uses=0] @.str1 = private constant [3 x i8] c"s1\00", align 1 ; <[3 x i8]*> [#uses=1]
2013 Aug 19
4
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
Hello LLVMDev List, It's my first time sending a message to the List - I have been working on a tool for my research project using LLVM. Thanks for your awesome work! I have come across some bytecode like the following with an GetElementPtr instruction in brackets: Bytecode:%3 = call i32 @_Z4funcPKc(i8* getelementptr inbounds ([5 x i8]* @.str2, i32 0, i32 0)) C++ code:func("bleh");
2018 Jan 09
2
Passing Array base address/pointer to runtime function in LLVM IR
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 =
2010 May 05
2
[LLVMdev] How to cast an integer array to an integer pointer? (user question)
I am new to LLVM and couldn't find any llvm-user list, so I am posting my user question here, sorry. I am trying to create a simple "puts" call accepting the static string, with the code below. The last line (CallInst::Create) fails with an assert: "Calling a function with a bad signature!" Because the type of function is void(u8*) and the argument supplied is:
2012 Sep 19
0
[LLVMdev] newbie question on getelementptr
Hi Óscar, Thank you for your prompt reply. Unfortunately, I still need more guidance as using the Demo page to generate C++ code didn't result in a global variable being used. Basically, I'm following your advice to use a LoadInst: Value *v = new LoadInst(result, "", theBasicBlock); Function *myfn = cast<Function>(v); I was not sure how I could get a BasicBlock for the
2012 Feb 01
1
[LLVMdev] Function Insertion Error
Hi, I am trying to insert a function into the LLVM IR. But i get a stack dump exception. My code is as follows.   #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/Module.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/IRBuilder.h" using namespace llvm;   namespace {
2010 Nov 18
0
[LLVMdev] How to construct parameters for a insert function? one from a return value from previous call, the other one is a string....
Hi, I want to insert a write operation to a fd opened, but I have some questions to construct parameters to pass to function that I want to insert, because one from a return value from previous call, the other one is a string, The detailed description of the problem is as follows; I have: int fd = open(g_settings_path, O_RDONLY); and I want to insert this function after the instruction above:
2011 Mar 31
2
[LLVMdev] inserting exit function into IR
I did M.getOrInsertFunction and called the exit function with . IRBuilder<> builder = IRBuilder<>(...); Value *one = ConstantInt::get(Type::getInt32Ty(M.getContext()),1); builder.CreateCall(exitF,one,"tmp4"); "Instruction has a name, but provides a void value! %tmp4 = call void @exit(i32 1) Broken module found, compilation aborted! " On Thu, Mar 31,
2011 Apr 01
3
[LLVMdev] insert printf into IR
Hi All, I am trying to insert printf ("%d", v), where v is an integer param, into the IR. I am doing something wrong because I keep getting segfaults. Below is my code. Thanks. vector<const Type *> params; params.push_back(Type::getInt8PtrTy(M.getContext())); params.push_back(Type::getInt32Ty(M.getContext())); FunctionType *fType =
2013 Jan 16
2
[LLVMdev] Dynamic Profiling - Instrumentation basic query
Hi Alastair, Thank you so much for the information on the tools. Actually, I need to analyze which sections of code are prone to misses and mis predicts, and would have to eventually instrument the code. I was able to instrument and call an external function, but faced an issue while passing an argument to the function. I am following EdgeProfiling.cpp but couldn't figure out the problem.
2011 May 18
0
[LLVMdev] access array problem
Hi Tan Guangming, > I want to access an array in my instrumentation code. For example: > > GlobalVariable: > int *counter; //counter the number of load/store operations in run-time > int *counterArray; //record the load/store addresses strictly speaking these are not arrays, they are pointers. Also, you have written them in some kind of C-style idiom. What are the declarations