similar to: [LLVMdev] Passing a function pointer as parameter to function call?

Displaying 20 results from an estimated 4000 matches similar to: "[LLVMdev] Passing a function pointer as parameter to function call?"

2016 Apr 05
3
Add Call instruction in IR for a non-existing function
Hello everyone, I am trying to add checkpoints to my IR code. In order to do that I need to add this instruction: call void @m5_checkpoint(i64 0, i64 0) to some of the basic blocks in my benchmark. m5_checkpoint is a function defined for checkpointing in another simulator and is not included in my benchmark source code. So I need to create this instruction and I couldn't figure out how to do
2020 Apr 30
2
Discrepancy between Debug and Release+Asserts versions of Clang/LLVM
I agree that the ArrayRef is likely the issue. I've debugged a crash caused by a temporary ArrayRef like that a couple times. Either do what David suggested or use a normal array: Metadata *mdArray[] = {ConstantInt::get(Int64Ty, 0), newMD}; ~Craig On Thu, Apr 30, 2020 at 9:56 AM David Blaikie via llvm-dev < llvm-dev at lists.llvm.org> wrote: > > > On Thu, Apr 30, 2020 at
2020 Jan 14
2
sizeof implementation: how to get size as a constantInt?
I'm implementing c style "sizeof()", and I did as http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt illuarstrated, and it works find, here's an example of my implementation: auto *p = builder.CreateGEP(structTy, llvm::ConstantPointerNull::get(pointerTy), constint1); auto *size =
2008 Jul 01
2
[LLVMdev] vmkit on x86_64
Hello, I'm trying to compile vmkit on a x86_64 linux box with gcc-4.1.2, but I'm running into troubles because of various problems with casts between pointers and integers. Is there anybody who succeeded in this task? Az I see, some of the problems can be fixed with an appropriate typedef/macro declaration, but in VMCore/JavaObject.cpp some lowlevel bitmanipulation is used, to mark
2008 Jul 01
0
[LLVMdev] vmkit on x86_64
Hi Zsombor, Thanks for the patch! Unfortunately I can't apply it because the llvm API has moved from BinaryOperator::create to BinaryOperator::Create. Are you using svn head? Now on the x86_64 part. There has been very little work on porting vmkit on x86_64. If you're having compilation problems, I suppose it's in the garbage collector directory (GCMmap2). If you could make the
2009 Mar 08
2
[LLVMdev] Creating Pointer Constants
Hello, I am writing a JIT compiler for a subset of the Matlab language and as a part of my implementation, I would like to be able to pass a constant pointer to a native function I'm calling. Right now, this is what I do: llvm::Constant* constInt = llvm::ConstantInt::get(llvm::Type::Int64Ty, (int64)thePointer); llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt,
2011 Jan 24
2
[LLVMdev] How to create an IntegerType of the native word size
Hi all, I couldn't find any reasonable way to create the IntegerType that would match, say, intptr_t, that is the native word size of the machine I'm building on. More accurately defined, when compiling on a 64 bit Mac OS machine I want it to be Int64Ty, but if for example I'm using the "-arch i386" command line option on that machine during compilation, I want it to be
2020 Apr 30
2
Discrepancy between Debug and Release+Asserts versions of Clang/LLVM
Hello, I am editing the LowerTypeTests pass in LLVM, and part of my additions include the following 3 lines of code: // newTypeName is a std::string MDString* newMD = MDString::get(M.getContext(), newTypeName); ArrayRef<Metadata*> mdArray {ConstantInt::get(Int64Ty, 0), newMD}; auto* node = MDTuple::get(M.getContext(), mdArray); Thus far, I have been developing on a version of Clang with
2007 Feb 27
2
[LLVMdev] another problem with function arguments aligment
I think, we must move function arguments lowering from frontend to LLVM core. This lowering is generating machine dependent bytecode. See http://llvm.org/bugs/show_bug.cgi?id=1230 Lauro 2007/2/26, Chris Lattner <sabre at nondot.org>: > On Mon, 26 Feb 2007, Lauro Ramos Venancio wrote: > > The problem is: llvm-gcc generates the same bytecode for both functions: > > > >
2007 Feb 26
0
[LLVMdev] another problem with function arguments aligment
On Mon, 26 Feb 2007, Lauro Ramos Venancio wrote: > The problem is: llvm-gcc generates the same bytecode for both functions: > > declare void @f(i32, i64) > declare void @g(i32, i64) > > I can't differ an i64 argument from a struct argument. Oops. You can fix this by changing llvm-gcc: gcc/llvm-abi.h Grep for instances of Int64Ty there. I can help answer any q's you
2012 May 04
2
[LLVMdev] Convert a vector size
Hi, Based on LLVM lang spec (http://llvm.org/docs/LangRef.html#i_bitcast<http://www.google.com/url?sa=D&q=http://llvm.org/docs/LangRef.html%23i_bitcast&usg=AFQjCNFsBtV4Cr8zpL5UpgoIASRDFvcdSw>) notes I have understood ,that bitcast of vectors to vectors is OK,only if provided the vectors are of the same size.Is it possible to convert a vectors from different size? For example a
2017 Nov 23
1
JIT and atexit crash
Hi, Not sure whether this matches your use case, but the Orc-based JIT used in LLI appears to be using `llvm::orc::LocalCXXRuntimeOverrides` (http://llvm.org/doxygen/classllvm_1_1orc_1_1LocalCXXRuntimeOverrides.html) to override `__cxa_atexit`: https://github.com/llvm-mirror/llvm/blob/release_50/tools/lli/OrcLazyJIT.h#L74
2013 Jul 25
1
[LLVMdev] Passing String to an external function in llvm
> OK - seems you might want to take a few steps back & understand how > C++ code is written/structured generally (and/or take a look at other > parts of the compiler). You'll need a header file with the declaration > of your function & you can include that header file in the > hashtable.cpp and testing.cpp - if that sentence doesn't make sense to > you yet, please
2009 May 21
3
[LLVMdev] Passing a pointer to a function
I recently began hacking around with my first LLVM pass. The big picture is that I would like to insert function calls for each instruction type, and pass some parameters based on the instruction type. Then I will link the output to some C file that implements those functions. Things were going well until I started trying to make function calls with a pointer as a parameter. For example, I would
2013 Jul 25
0
[LLVMdev] Passing String to an external function in llvm
On Thu, Jul 25, 2013 at 11:40 AM, Abhinash Jain <omnia at mailinator.com> wrote: > I have one file named hashtable.cpp whose link is > "http://pastebin.com/Cq2Qy50C" > > and one llvm pass named testing.cpp whose link is > "http://pastebin.com/E3RemxLF" > > Now on this testing.cpp pass I have computed the string named "expr" which I > want
2013 Jul 25
2
[LLVMdev] Passing String to an external function in llvm
I have one file named hashtable.cpp whose link is "http://pastebin.com/Cq2Qy50C" and one llvm pass named testing.cpp whose link is "http://pastebin.com/E3RemxLF" Now on this testing.cpp pass I have computed the string named "expr" which I want to pass to the function named hashtable(string) in hashtable.cpp (on line 106 of testing.cpp) > looking at simple
2014 Oct 27
2
[LLVMdev] How to call a pointer that points to a C function
I have a pointer to a function that I need to invoke without going through llvm::Module::getOrInsertFunction. This example does not work: static int add(int x, int y); llvm::Value *one, *two; llvm::Constant* addfn = llvm::ConstantInt::get(JB->getIntPtrTy(DataLayout), (intptr_t)add); llvm::Type* args[] = { Int32Ty, Int32Ty }; llvm::FunctionType* ftype = llvm::FunctionType::get(Int32Ty,
2015 Feb 27
2
[LLVMdev] Walking thru CallGraph bottom up
Hi Simon, > From: Simone Atzeni <simone.at at gmail.com> > To: John Criswell <jtcriswel at gmail.com> > Cc: llvmdev at cs.uiuc.edu > Subject: Re: [LLVMdev] Walking thru CallGraph bottom up > Message-ID: <318EBA41-2040-4EFE-B330-5813C817C2A2 at gmail.com> > Content-Type: text/plain; charset="windows-1252" > > I think I got it and the example is
2013 Oct 07
1
[LLVMdev] Typecasting int32ty to int64ty
I have something like this on my code :- vector<Value*> args3; args3.push_back(instr->getOperand(0)); //where 'instr' is store instruction Now when I check the Type of instr->getOperand(0). It varies to i32 and i64, depending on the operand(0) of instruction. Due to which my vector<Value*> has different Type of Value*. How can I convert i32 to i64 type before pushing
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()),