Displaying 6 results from an estimated 6 matches for "f_ptr".
Did you mean:
a_ptr
2011 Mar 30
2
[LLVMdev] Counting pointers to functions
...milar recent post). However, this will not
always be sufficient - for example, consider the following C code:
#include "stdio.h"
int foo(){
printf ("Reached function foo\n");
return 0;
}
int bar(){
printf("Reached function bar\n");
return 1;
}
int main(){
int (*f_ptr)() = &foo;
(*f_ptr)();
int diff = (int)&bar- (int)&foo;
f_ptr = (int (*)()) ( (int)f_ptr + diff);
(*f_ptr)();
return 0;
}
This code changes f_ptr from pointing at the function foo to pointing at the
function bar, by explicitly advancing the pointer by the difference in
memor...
2011 Mar 30
0
[LLVMdev] Counting pointers to functions
...or example, consider the following C code:
>
> #include "stdio.h"
>
> int foo(){
> printf ("Reached function foo\n");
> return 0;
> }
> int bar(){
> printf("Reached function bar\n");
> return 1;
> }
>
> int main(){
> int (*f_ptr)() =&foo;
> (*f_ptr)();
> int diff = (int)&bar- (int)&foo;
> f_ptr = (int (*)()) ( (int)f_ptr + diff);
> (*f_ptr)();
>
>
> return 0;
>
> }
>
> This code changes f_ptr from pointing at the function foo to pointing at the
> function bar, by e...
2019 Jul 22
2
Run llvm pass from standalone project
Hi all,
I am trying to use LLVM's AliasAnalysis pass, but from a standalone tool
that uses llvm libraries.
The following is the code snippet I am currently using.
PassBuilder PB;
auto mod_manager = ModuleAnalysisManager { };
PB.registerModuleAnalyses(mod_manager);
AAResults& AAR = mod_manager.getResult<AAManager>(*M);
But the code fails at .getResult with the following error:
2014 Mar 20
2
[LLVMdev] load bytecode from string for jiting problem
...eKind::JIT).setUseMCJIT(true).setErrorStr(&eeError).create();
if (!nee) {
fprintf(stderr, "Could not create ExecutionEngine: %s\n", eeError.c_str());
assert(false);
}
Function f = ret_fct(Mjit); // Function* ret_fct (Module*); return the function we want to jit.
uint64_t f_ptr = nee->getFunctionAddress(f->getName());
long (*fjited)(param_t, phi_state_t, long, long, long, long)
= (long (*)(param_t, phi_state_t, long, long, long, long)) (intptr_t)f_ptr;
return fjited (params, phi_state, lower, upper, inst_outer, inst_inner);
}
Thanks,
--
Willy WOLFF
On 20 Ma...
2014 Mar 20
2
[LLVMdev] load bytecode from string for jiting problem
...t; if (!nee) {
>> fprintf(stderr, "Could not create ExecutionEngine: %s\n",
>> eeError.c_str());
>> assert(false);
>> }
>>
>> Function f = ret_fct(Mjit); // Function* ret_fct (Module*); return
>> the function we want to jit.
>> uint64_t f_ptr = nee->getFunctionAddress(f->getName());
>>
>> long (*fjited)(param_t, phi_state_t, long, long, long, long)
>> = (long (*)(param_t, phi_state_t, long, long, long, long))
>> (intptr_t)f_ptr;
>>
>> returnfjited (params, phi_state, lower, upper, inst_outer, in...
2014 Mar 19
2
[LLVMdev] load bytecode from string for jiting problem
all of:
----
// cout << "lsr: " << lsr << "\n";
llvm::MemoryBuffer* mbjit =
llvm::MemoryBuffer::getMemBufferCopy (sr);
------
string lsr = sr.str();
// cout << "lsr: " << lsr << "\n";