similar to: [LLVMdev] how to add and call a function with void return value in functionpass.

Displaying 20 results from an estimated 6000 matches similar to: "[LLVMdev] how to add and call a function with void return value in functionpass."

2010 Nov 23
1
[LLVMdev] how to get a void type value in llvm
Hi, sivart Thanks for pointing it out. I used it, and it works. Thank you again. BTW, for any later reference, the function prototype declaration with no arguments is not what I wrote: fcall2 = M.getOrInsertFunction("foo", IntegerType::get(M.getContext(), 32), Type::getVoidTy(M.getContext())); INSTEAD, I changed to : fcall2 = M.getOrInsertFunction("foo",
2010 Nov 23
2
[LLVMdev] how to get a void type value in llvm
Hi, I want to insert a function with a void type parameter, for example: int foo(void); OI declared fcall2 = M.getOrInsertFunction("foo", IntegerType::get(M.getContext(), 32), Type::getVoidTy(M.getContext())); then the question is how to get the void type value to make the CallInst inserted sucessfully? (what should be ********) CallInst::Create(fcall2, ******,
2010 Nov 23
0
[LLVMdev] how to get a void type value in llvm
Hi Shuying, You will find in the documentation that amongst the overloaded CallInst::Create()'s there is one that takes no function arguments: static CallInst* llvm::CallInst::Create ( Value * F, const Twine & NameStr, BasicBlock * InsertAtEnd); Regards On 23/11/2010, at 11:20 AM, Shuying Liang wrote: > Hi, I want to insert a function with a void type parameter, > for example:
2011 Nov 19
2
[LLVMdev] Insert a function call in the code
Hello, everyone I am new to LLVM, now I got a problem I want to add a function call before sleep(int a, int b) code below #include <stdio.h> int sleep(int a, int b) { return a+b; } int main(int argc, char **argv) { sleep(1,2); } after use opt -load ../llvm-2.8/Release+Asserts/lib/bishe_insert.so -bishe_insert <1.bc> 2.bc I want get the code #include <stdio.h>
2011 Nov 20
0
[LLVMdev] Insert a function call in the code
Thank you for your help I found the problem, as hook() is a no paramter function,so for(Function::arg_iterator i = hook->arg_begin(), e = hook->arg_end(); i != e; ++i) { Args.push_back(i); /////////////Wong } we can add a call by Instruction *newInst = CallInst::Create(hook,
2014 Jan 08
3
[LLVMdev] reference to non-static member function must be called
Hi,everyone. I'm writing a pass in which a CallInst to an external function will be inserted. The function is declared like this: void func(int a, unsigned chat *p); and in the Pass(a Function Pass ,and using the InstVistor template ), I wrote like this: void visitStoreInst(StoreInst &SI) { //Get the refference of the types Module *M =
2013 Jan 03
2
[LLVMdev] Opt error
Hi Team, I am migrating one of the Pass that was written for llvm2.2 or older to llvm3.1. The code snippet looks like the following: Constant *func; void add( Module *M) { func = M->getOrInsertFunction("func", Type::getVoidTy(M->getContext()), NULL); } virtual bool runOnModule(Module &M) { add (&M); for(Module::iterator F = M.begin(), E = M.end(); F !=
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
Hi, I'm trying to get my head around c++ - IR - c++ API and getting used tramform manual information to code. The manual states alloca is defined for <type>. FunstionType is a type, so alloca for functionType should be possible? Not? If we have a valid Module *m we can get an allocate instruction allocating space for a non-argumented function as follows: AllocaInst* pa2 = new
2013 Jan 03
0
[LLVMdev] Opt error
Hi Ahmad, On 03/01/13 16:26, Hassan, Ahmad wrote: > Hi Team, > > I am migrating one of the Pass that was written for llvm2.2 or older to llvm3.1. > The code snippet looks like the following: > > Constant *func; > > void add( Module *M) { > > func = M->getOrInsertFunction("func", Type::getVoidTy(M->getContext()), NULL); this function has no
2012 Apr 23
2
[LLVMdev] Eliminating the 'void' type
Hello Chris The general concept is to replace void with {}. Void is a weird type in >> that it is only allowed as the return value of functions and as the type of >> instructions like store. It seems better (though also not particularly >> high priority) to eliminate it to make the type system more consistent. >> > MVT::isVoid and Type::VoidTyID (getVoidTy) have
2012 May 08
0
[LLVMdev] Discussion of eliminating the void type
Hello Duncan, There is a discussion with Chris Lattner: http://old.nabble.com/Eliminating-the-'void'-type-td33726468.html In the discussion, Chris Lattner suggest Type::getVoidTy() should still exist and return {} for API continuity. If VoidTy and isVoidTy() go away, how do deal with the isVoidTy() function call in LLVM source tree? Another issue is: What should ReturnInst constructor
2014 Jan 09
2
[LLVMdev] reference to non-static member function must be called
I'm using LLVM 3.3 Release. From the Class Reference Page. CallInst has a member function : static CallInst * Create (Value *Func, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=0) This is what I want to use! the default name is "" and I also use that . Thanks! ----- Kind Regards! -JinHuang -- View this message in context:
2012 Apr 21
2
[LLVMdev] Eliminating the 'void' type
Hello all, I noticed Eliminating the 'void' type<http://nondot.org/sabre/LLVMNotes/EliminatingVoid.txt>in Random LLVM notes. I am wondering to know what's the meaning of "eliminating" the void type. Is it means the goal is deleting VoidTyID from TypeID enumeration in Type.h? And what Type::getVoidTy() returned is a pointer to a {}? Thanks Mitnick -------------- next
2011 Mar 31
3
[LLVMdev] inserting exit function into IR
Hi Joshua, I have a function foo and I want to insert exit(0) at the end of foo. The problem is M.getFunction returns null, which is understandable. I am not sure what to do. Below is the code snippet. void foo(int argc, char* argv[]) { printf("hello world\n"); exit(0); //***I want to insert this exit } My llvm code snippet is vector<const Type *> params =
2012 May 07
0
[LLVMdev] Discussion of eliminating the void type
Hi Mitnick, > === Overview === > > The general concept is to replaced void with {}. And 'ret void' is a synonym of > 'ret {} {}.' in a sense the concept is just to delete void and not to replace it with anything in particular. Of course front-ends (clang, dragonegg) need to produce something instead of void, and {} is an example of what they might produce, but they
2011 Mar 31
0
[LLVMdev] inserting exit function into IR
On Thu, Mar 31, 2011 at 9:31 PM, George Baah <georgebaah at gmail.com> wrote: > Hi Joshua, >       I have a function foo and I want to insert exit(0) at the end of foo. > The problem is M.getFunction returns null, which is understandable. I am not > sure what to do. Below is the code snippet. > void foo(int argc, char* argv[]) { >   printf("hello world\n"); >
2011 Aug 19
0
[LLVMdev] How to halt a program
Victor Campos wrote: > Guys, > > I would like to instrument the bytecode that LLVM produces with > assertions. I have written the instrumentation code manually, but I do > not know how to halt the program in case the assertion is false. I took > a look into the bytecode that LLVM produces for a program like: > > #include <stdlib.h> > int main() { >
2012 May 07
4
[LLVMdev] Discussion of eliminating the void type
Hello all, I am willing to do "eliminating the void type" project. Is there anyone working on it? === Overview === The general concept is to replaced void with {}. And 'ret void' is a synonym of 'ret {} {}.' === Further Implementation Details === 1. Deleting VoidTyID 2. Deleting LLVMVoidTypeKind (one-to-one relation between VoidTyID and LLVMVoidTypeKind) 3. Use
2011 Sep 16
0
[LLVMdev] How to duplicate a function?
Hi all, I am a newbie in LLVM and I am trying to replace the function like: old function || new function ======================================= int haha(int a) { int haha(int a, char* ID) { ===> } } Of course in the newly replaced function "int haha(int,
2013 Jan 27
2
[LLVMdev] Passing an array to an external function
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 llvm::GetElementPtrInst::hasAllZeroIndices() const + 0 std::vector<Value*> Args(1);