search for: funcptr

Displaying 15 results from an estimated 15 matches for "funcptr".

Did you mean: func_ptr
2011 Oct 17
2
[LLVMdev] Typo in IsLegalToCallImmediateAddr?
Rafael, I believe your example is not related to IsLegalToCallImmediateAddr. This is an example of calling to an immediate address: typedef int (*funcptr)(void); int main() { funcptr foo = (funcptr)0x100; foo(); } If IsLegalToCallImmedateAddr is true, this generates a call to absolute address 0x100: call 0x100 This requires a relocation of the value 0x100 - PC. (NOTE: this is NOT the same as: "foo: call foo+0x100", which requires n...
2008 Nov 04
4
[LLVMdev] Debugging lli using bugpoint
Hi Evan, Thanks for the pointers. We found a simple test case that causes the problem (thanks to Tom in my group): #include<stdio.h> #include<stdlib.h> void test(); void (*funcPtr)(); int main(int argc, char **argv) { funcPtr = test; test(); } void test() { if(funcPtr == test) { printf("OK!\n"); } else { fprintf(stderr, "Bad!\n"); exit(1); } } $ llvm-gcc -emit-llvm -o FPtrEqTest.bc -c FPtrEqTest.c $ llc -f FPtrEqTest.bc $ gcc -o F...
2011 Jul 01
2
[LLVMdev] Typo in IsLegalToCallImmediateAddr?
It seems that the || should be && here? /// IsLegalToCallImmediateAddr - Return true if the subtarget allows calls /// to immediate address. bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const { if (Is64Bit) return false; return isTargetELF() || TM.getRelocationModel() == Reloc::Static; } For example, if you are doing ELF PIC (i.e. for a shared
2011 Jul 02
0
[LLVMdev] Typo in IsLegalToCallImmediateAddr?
On 2011-07-01 17:13, David Meyer wrote: > It seems that the || should be && here? > > /// IsLegalToCallImmediateAddr - Return true if the subtarget allows calls > /// to immediate address. > bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const { > if (Is64Bit) > return false; > return isTargetELF() || TM.getRelocationModel() ==
2011 Oct 20
0
[LLVMdev] Typo in IsLegalToCallImmediateAddr?
2011/10/17 David Meyer <pdox at google.com>: > Rafael, > > I believe your example is not related to IsLegalToCallImmediateAddr. > > This is an example of calling to an immediate address: > > typedef int (*funcptr)(void); > > int main() { >  funcptr foo = (funcptr)0x100; >  foo(); > } > > If IsLegalToCallImmedateAddr is true, this generates a call to > absolute address 0x100: > > call 0x100 > If so there is a bug, but I cannot reproduce it. I am getting: 0: b8 00 01 00 0...
2008 Nov 11
0
[LLVMdev] Debugging lli using bugpoint
...this. Evan On Nov 3, 2008, at 4:00 PM, Prakash Prabhu wrote: > Hi Evan, > > Thanks for the pointers. We found a simple test case that causes the > problem (thanks to Tom in my group): > > #include<stdio.h> > #include<stdlib.h> > > void test(); > void (*funcPtr)(); > > int main(int argc, char **argv) { > funcPtr = test; > test(); > } > > void test() { > if(funcPtr == test) { > printf("OK!\n"); > } else { > fprintf(stderr, "Bad!\n"); > exit(1); > } > } > > $ llvm-gcc...
2011 Sep 20
2
Is it possible to pass a function argument from R to compiled code in C?
I have a function in R that takes another function as argument: f <- function(g, ...) { #g is expected to be a function } I want to see if there is a way to implement "f" in C and calling it from R using ".C" interface. I know that I can use function pointers for my C implementation, but I imagine it's going to be nearly impossible to pass a function from R to C. Are
2012 Nov 11
1
[LLVMdev] wrong value with getPointerToGlobal
...ret i32 %3 } Where "gresult" is created with: auto global = new llvm::GlobalVariable( *module, int32Type, /*constant*/false, llvm::GlobalValue::ExternalLinkage, /*init*/0, "gresult" ); I run the function and get the results with: llvm::GenericValue gv = ee->runFunction( funcPtr, args/*empty*/ ); void * gptr = ee->getPointerToGlobal( global ); gv.IntVal has the correct value, but *static_cast<int32_t*>(gptr) does not. -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sign: Please digitally sign your emails. Encrypt: I&...
2010 May 27
1
[PATCH matahari] Introduces a multiplexer for taking requests and mapping them to APIs.
...ion) +{ + _apis.insert(APIMAP::value_type(string(name), apifunction)); +} + +t_apifunction +Multiplexer::getAPI(string name) +{ + return (*_apis.find(name)).second; +} + +string +Multiplexer::invokeAPI(string name, string input) +{ + string result = string(""); + t_apifunction funcptr = (*_apis.find(name)).second; + + if(funcptr) + { + result = funcptr(input.c_str()); + } + + return result; +} diff --git a/src/virtio/multiplexer.h b/src/virtio/multiplexer.h new file mode 100644 index 0000000..26a288c --- /dev/null +++ b/src/virtio/multiplexer.h @@ -0,0 +1,48 @@ +#if...
2008 Nov 03
0
[LLVMdev] Debugging lli using bugpoint
Hi Prakash, Unfortunately it looks like you need to do quite a bit of investigation into this. However, I hope I can provide some useful tips. 1. In general, lli and llc generate exact the same code except lli default to static codegen while llc defaults to dynamic-no-pic codegen. So try passing -relocation-model=dynamic-no-pic to lli. If this works, that means there are issues with
2008 Nov 02
2
[LLVMdev] Debugging lli using bugpoint
Hi Eli, Thanks for the reply. I tried with -Xlinker="-ldl ". However it does not seem to make a difference. It seems that when bugpoint is run with --run-jit, the linker args are not passed to gcc (from tools/bugpoint/ExecutionDriver.cpp) : if (InterpreterSel == RunLLC || InterpreterSel == RunCBE || InterpreterSel == CBE_bug || InterpreterSel == LLC_Safe) RetVal =
2019 Dec 04
2
PC relative load/store in LLVM Target?
Hello, Is there any exist LLVM Target (backend) that support PC relative load and store? If so, what exactly is the instruction? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191204/c345ac5c/attachment.html>
2012 Jul 06
2
[LLVMdev] Self-referential function pointer
Hey guys, I could use some advice on a special case of a function pointer as a formal argument. I would like the function pointer type to contain the actual signature of the function, i.e. not a pointer to var args function. This becomes an issue when I have a function which can take a pointer to itself as an argument... our terminology for this is "a recursive procedure". That is, of
2015 Jul 14
3
[LLVMdev] RFC: ThinLTO Symbol Linkage and Renaming
...nd on several factors such as whether it is address taken, its size, etc. This is discussed in more detail further on. Note that address taken static functions must always be promoted for correctness. The reason can be seen with the following example: a.cc: static void foo() { … }; static funcptr P; void bar() { if (P == &foo) { ... } } void baz() { P = &foo; } b.cc: … bar(); … If bar() is imported into b.cc (and gets inlined), then b.cc will have a reference to static foo(). It we then import foo() and leave the imported copy loca...
2015 Jul 21
1
[LLVMdev] RFC: ThinLTO Symbol Linkage and Renaming
...etc. This > is discussed in more detail further on. > > > > Note that address taken static functions must always be promoted for > correctness. The reason can be seen with the following example: > > > > a.cc: > > static void foo() { … }; > > static funcptr P; > > > > void bar() { > > if (P == &foo) { > > ... > > } > > } > > > > void baz() { > > P = &foo; > > } > > > > b.cc: > > … bar(); … > > > > > > I...