similar to: [LLVMdev] Cast Pointer Address to Functions

Displaying 20 results from an estimated 500 matches similar to: "[LLVMdev] Cast Pointer Address to Functions"

2012 Jun 19
0
[LLVMdev] Cast Pointer Address to Functions
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Xin Tong > Subject: [LLVMdev] Cast Pointer Address to Functions > I have a function address held in an uint64_t. I would like to cast > the function address to a function prototype and create a call to the > function in LLVM. How could I do this ? This is what works for us:
2016 Mar 29
0
JIT compiler and calls to existing functions
There is no documentation I know of. Rough sketch: 1) Create a subclass of SectionMemoryManager 2) Create an instance of this class and add it the EngineBuilder via setMCJITMemoryManager (Make sure everything runs without changes) 3) Override the getSymbolAddress method, have your implementation call the base classes impl (Make sure everything runs without changes) 4) Add handling to map
2016 Mar 29
3
JIT compiler and calls to existing functions
True, I care more about how fast the code runs than how long it takes to compile it. So if the symbolic approach enables better code generation, that is a very significant advantage from my perspective. Is there any example code or documentation you can point to for details about how to implement the symbolic approach? Is it similar to any of the versions of Kaleidoscope or any other extant
2016 Mar 29
2
JIT compiler and calls to existing functions
That seems to work, thanks! The specific code I ended up with to call int64_t print(int64_t) looks like: auto f = builder.CreateIntToPtr( ConstantInt::get(builder.getInt64Ty(), uintptr_t(print)), PointerType::getUnqual(FunctionType::get( builder.getInt64Ty(), {builder.getInt64Ty()}, false))); return builder.CreateCall(f, args); On Mon, Mar
2016 Mar 28
2
JIT compiler and calls to existing functions
In the context of a JIT compiler, what's the recommended way to generate a call to an existing function, that is, not one that you are generating on-the-fly with LLVM, but one that's already linked into your program? For example the cosine function (from the standard math library); the Kaleidoscope tutorial recommends looking it up by name with dlsym("cos"), but it seems to me
2012 Aug 09
1
Factor moderators in metafor
I'm puzzled by the behaviour of factors in rma models, see example and comments below. I'm sure there's a simple explanation but can't see it... Thanks for any input John Hodgson ------------------------------------- code/selected output ----------------- library(metafor) ## Set up data (from Lenters et al A Meta-analysis of Asbestos and Lung Cancer... ##
2012 May 03
5
[PATCH/RFC 0/6] New mux client request to list open tcp forwardings.
These patches implement a new mux client request to list the currently opened TCP forwardings. It also removes some todos regarding keeping the list of forwardings in the options up-to-date. Bert Wesarg (6): attach the forwarding type to struct Forward merge local and remote forward lists generate unique ids for forwardings to be used for identification remove closed forwardings from
2016 Mar 28
0
JIT compiler and calls to existing functions
> From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] > On Behalf Of Russell Wallace via llvm-dev > Subject: [llvm-dev] JIT compiler and calls to existing functions > In the context of a JIT compiler, what's the recommended way to generate a call to an > existing function, that is, not one that you are generating on-the-fly with LLVM, but > one that's already
2011 Dec 04
2
a weird question about gdata:::
Dear R People: If I put in: > findPerl Error: object 'findPerl' not found But if I use: > gdata:::findPerl function (perl, verbose = "FALSE") { errorMsg <- "perl executable not found. Use perl= argument to specify the correct path." if (missing(perl)) { perl = "perl" } perl = Sys.which(perl) if (perl == "" ||
2016 Mar 29
2
JIT compiler and calls to existing functions
Right, but when you say link time, the JIT compiler I'm writing works the way openJDK or v8 do, it reads a script, JIT compiles it into memory and runs the code in memory without ever writing anything to disk (an option for ahead of time compilation may come later, but that will be a while down the road), so we might be doing different things? On Tue, Mar 29, 2016 at 2:59 AM, Philip Reames
2015 Sep 07
5
[PATCH 0/4 v3] builder: support for Simple Streams metadata
Hi, this series adds a basic support for Simple Streams v1.0 metadata files. This makes it possible to create a repository .conf files with [cirros] uri=http://download.cirros-cloud.net format=simplestreams to read the latest version of each CirrOS image. Thanks, Pino Toscano (4): builder: add non-int revisions builder: add simple libyajl binding build: expose HAVE_YAJL to automake
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 =
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,
2016 Mar 29
0
JIT compiler and calls to existing functions
The option we use is to have a custom memory manager, override the getPointerToNamedFunction function, and provide the pointer to the external function at link time. The inttoptr scheme works fairly well, but it does make for some pretty ugly and sometimes hard to analyze IR. I recommend leaving everything symbolic until link time if you can. Philip On 03/28/2016 06:33 PM, Russell Wallace
2006 Nov 02
6
Multiple items in the where clause while updating...
Hi The following is a database table named friends. +-----+------+------+-------+ | sid | id | fid | ftype | +-----+------+------+-------+ | 30 | 1 | 2 | F | | 31 | 1 | 3 | R | | 32 | 3 | 2 | F | | 33 | 3 | 4 | F | +-----+------+------+-------+ I want to update the ftype field based on id and fid. I want to achive the following. Update friends
2016 Mar 29
3
JIT compiler and calls to existing functions
Ah! Okay then, so you are saying something substantive that I think I disagree with, but that could be because there are relevant issues I don't understand. My reasoning is, I've already got a pointer to the function I want the generated code to call, so I just supply that pointer, it looks ugly on a microscopic scale because there are a couple of lines of casts to shepherd it through the
2016 Mar 24
0
attribute of intrinsic function
> On Mar 24, 2016, at 12:45 PM, Xiangyang Guo via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > When I define an intrinsic function with memory write permission, my assumption is that we can either attach [IntrReadWriteArgMem] or [] to the intrinsic function. Based on the comment of the source code , "IntrReadWriteArgMem - This intrinsic reads and writes
2016 Mar 29
0
JIT compiler and calls to existing functions
I think our use cases are actually quite similar. Part of generating the in memory executable code is resolving all the symbolic symbols and relocations. The details of this are mostly hidden from you by the MCJIT interface, but it's this step I was referring to as "link time". The way to think of MCJIT: generate object file, incrementally link, run dynamic loader, but do it all
2007 Mar 31
3
strange fisher.test result
A simple question - using the following fishers test it appears that the P value is significant, but the CI includes 1. Is this result correct? > data.50p10min <- matrix(c(16,15, 8, 24),nrow=2) > fisher.test(data.50p10min) Fisher's Exact Test for Count Data data: data.50p10min p-value = 0.03941 alternative hypothesis: true odds ratio is not equal to 1 95
2016 Mar 30
4
JIT compiler and calls to existing functions
For what it's worth we did a similar thing, but overrode RTDyldMemoryManager directly This allowed us to control where the RAM was allocated too (e.g. guarantee it was in the low 4GB so we could use small memory model and avoid the mov rax, xxxxxxx; call rax code generated for x86)*, and also override findSymbol() to have the same behaviour as described in 4). --matt * later issues in not