search for: fibf

Displaying 20 results from an estimated 25 matches for "fibf".

Did you mean: fib
2007 Nov 26
1
[LLVMdev] How to declare and use sprintf
...g_function_type sp [| sp; sp |] Awesome stuff. Here is my most elegant Fibonacci example in OCaml so far: open Llvm let ( |> ) x f = f x let int n = const_int i32_type n let return b x = build_ret x b |> ignore let build_fib m = let ty = function_type i32_type [| i32_type |] in let fibf = define_function "fib" ty m in let bb = builder_at_end (entry_block fibf) in let n = param fibf 0 in let retbb = append_block "return" fibf in let retb = builder_at_end retbb in let recursebb = append_block "recurse" fibf in let recurseb = builder_at_end...
2004 Aug 17
5
[LLVMdev] JIT API example (fibonacci)
...gt; > > > int n = argc > 1 ? atol(argv[1]) : 44; > > > > // Create some module to put our function into it. > > Module *M = new Module("test"); > > > > > > // We are about to create the "fib" function: > > Function *FibF; > > > > { > > // first create type for the single argument of fib function: > > // the type is 'int ()' > > std::vector<const Type*> ArgT(1); > > ArgT[0] = Type::IntTy; > > > > // now create full type of the "...
2004 Aug 17
0
[LLVMdev] JIT API example (fibonacci)
...> int main(int argc, char**argv) { > > int n = argc > 1 ? atol(argv[1]) : 44; > > // Create some module to put our function into it. > Module *M = new Module("test"); > > > // We are about to create the "fib" function: > Function *FibF; > > { > // first create type for the single argument of fib function: > // the type is 'int ()' > std::vector<const Type*> ArgT(1); > ArgT[0] = Type::IntTy; > > // now create full type of the "fib" function: > Function...
2004 Aug 17
4
[LLVMdev] JIT API example (fibonacci)
Hi LLVMers, the example attached I have used to prove that JIT and some visible optimizations are really invoked. Proved OK. I got 30% speed-up in comparison to gcc 3.3.3 on my Athlon XP 1500. Nice. P.S. guys, no fears, I don't plan to flood the cvs repository with my "brilliant" examples ;) --- Valery A.Khamenya -------------- next part -------------- An
2004 Aug 17
0
[LLVMdev] JIT API example (fibonacci)
...t; int n = argc > 1 ? atol(argv[1]) : 44; >>> >>> // Create some module to put our function into it. >>> Module *M = new Module("test"); >>> >>> >>> // We are about to create the "fib" function: >>> Function *FibF; >>> >>> { >>> // first create type for the single argument of fib function: >>> // the type is 'int ()' >>> std::vector<const Type*> ArgT(1); >>> ArgT[0] = Type::IntTy; >>> >>> // now create full...
2004 Aug 18
1
[LLVMdev] JIT API example (fibonacci)
...[1]) : 44; > >>> > >>> // Create some module to put our function into it. > >>> Module *M = new Module("test"); > >>> > >>> > >>> // We are about to create the "fib" function: > >>> Function *FibF; > >>> > >>> { > >>> // first create type for the single argument of fib function: > >>> // the type is 'int ()' > >>> std::vector<const Type*> ArgT(1); > >>> ArgT[0] = Type::IntTy; > >>>...
2007 Nov 26
0
[LLVMdev] How to declare and use sprintf
On Nov 25, 2007, at 18:53, Jon Harrop wrote: > So my Fib program is segfaulting and I'm not sure why. I think it > might be because my declaration and use of sprintf is wrong. > > I notice llvm-gcc produces declarations containing "..." like: > > declare int %printf(sbyte*, ...) > > What is the correct way to do this? The type you want is: let sp =
2007 Nov 25
2
[LLVMdev] How to declare and use sprintf
So my Fib program is segfaulting and I'm not sure why. I think it might be because my declaration and use of sprintf is wrong. I notice llvm-gcc produces declarations containing "..." like: declare int %printf(sbyte*, ...) but I'm not sure how to do this so I've used: let sprintf = declare_function "sprintf" (function_type (pointer_type
2012 Apr 09
2
[LLVMdev] How to instrument a this function using insertBefore instruction???
Hi, I don't think the code you pasted can be the correct code, where does FibF come from? Anyway, the problem is that you're calling the FibF from Module A, however you defined it for Module B. You need to insert the FibF function into the Module that you're running. To do this override "virtual bool doInitialization(Module &M);" and insert FibF into M...
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
...or 846227103 at qq.com TEL: 15810729006(Beijing) Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084. At 2012-04-09 17:16:52,"Joey Gouly" <joel.gouly at gmail.com> wrote: Hi, I don't think the code you pasted can be the correct code, where does FibF come from? Anyway, the problem is that you're calling the FibF from Module A, however you defined it for Module B. You need to insert the FibF function into the Module that you're running. To do this override "virtual bool doInitialization(Module &M);" and insert FibF into...
2012 Apr 09
1
[LLVMdev] How to instrument a this function using insertBefore instruction???
...006(Beijing) > Address: Room I-406, Central Building, Tsinghua University, Beijing, > China. 100084. > > At 2012-04-09 17:16:52,"Joey Gouly" <joel.gouly at gmail.com> wrote: > > Hi, > > I don't think the code you pasted can be the correct code, where does FibF > come from? > > Anyway, the problem is that you're calling the FibF from Module A, however > you defined it for Module B. > > You need to insert the FibF function into the Module that you're running. > To do this override "virtual bool doInitialization(Module &amp...
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
Here's my translation of the Fibonacci example into OCaml: open Printf open Llvm let build_fib m = let fibf = define_function "fib" (function_type i32_type [| i32_type |]) m in let bb = builder_at_end (entry_block fibf) in let one = const_int i32_type 1 and two = const_int i32_type 2 in let argx = param fibf 0 in set_value_name "AnArg" argx; let retbb = append_...
2004 Aug 17
0
[LLVMdev] JIT API example (fibonacci)
...ArgT, /*not vararg*/false); // Now create the fib function entry and // insert this entry into module M // (By passing a module as the last parameter to the Functionconstructor, // it automatically gets appended to the Module.) FibF = new Function(FibT, Function::ExternalLinkage, // maybe too much "fib", M); You can do this same thing with code like this: Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy, 0); Thanks! I really lik...
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
...rintf("Hello me!!\n"); return 0; } Module * M; LLVMContext Context; FunctionType *STy=FunctionType::get(Type::getInt32Ty(Context), false); Function *check = Function::Create(STy, Function::InternalLinkage, "check" ,&M); CallInst *callcheck = CallInst::Create(FibF,"CallCheck"); namespace { struct Hello : public FunctionPass { static char ID; Hello() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F) { errs() &l...
2012 Apr 09
3
[LLVMdev] How to instrument a this function using insertBefore instruction???
...rintf("Hello me!!\n"); return 0; } Module * M; LLVMContext Context; FunctionType *STy=FunctionType::get(Type::getInt32Ty(Context), false); Function *check = Function::Create(STy, Function::InternalLinkage, "check" ,&M); CallInst *callcheck = CallInst::Create(FibF,"CallCheck"); namespace { struct Hello : public FunctionPass { static char ID; Hello() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F) { errs() &l...
2012 Apr 10
2
[LLVMdev] How to get the module handle of a .bc file??
...t;. 2, Use the "insertBefore"API to insert the CallInst into the right position. My problem is about the step 1. How can I get the handle of the .bc file (Probably is a Module*)? so I can declare the extern function like // insert the " i32 @fib(i32 )" to the module M Function *FibF = cast<Function>(M->getOrInsertFunction("fib", Type::getInt32Ty(Context), Type::getInt32Ty(Context), (Type *)0)); How can I get the "M" of the .bc file?????? Any help~ --...
2007 Jul 14
1
[LLVMdev] JIT Leaks?
...mply deleting the execution engine instance in the fibonacci code and looping all the main code give me memory leaks. Can anybody confirm this? - Conserving the module, the execution engine and the module provider, but releasing the fibonacci function with: EE->freeMachineCodeForFunction(FibF); FibF->eraseFromParent(); and recreating the function from scratch leaks even more. Idem, someone can confirm this? Thanks in advance. Paolo Invernizzi
2007 Sep 05
2
[LLVMdev] Seeing a crash with ConstantFP::get
...line to the Fibonacci example program: int main(int argc, char **argv) { int n = argc > 1 ? atol(argv[1]) : 24; // Create some module to put our function into it. Module *M = new Module("test"); // We are about to create the "fib" function: Function *FibF = CreateFibFunction(M); // add the following line Constant* C = ConstantFP::get(Type::FloatTy,0.0); Can someone verify this? This is on the PC side of my system which I build with the VStudio files. I don't know if the Mac side sees this as well, but I'll try and verify. Se...
2012 Apr 10
0
[LLVMdev] How to get the module handle of a .bc file??
...fore"API to insert the CallInst into the right position. > > My problem is about the step 1. How can I get the handle of the .bc file > (Probably is a Module*)? so I can > declare the extern function like > // insert the " i32 @fib(i32 )" to the module M > Function *FibF = >     cast<Function>(M->getOrInsertFunction("fib", Type::getInt32Ty(Context), >                                           Type::getInt32Ty(Context), >                                           (Type *)0)); > How can I get the "M" of the .bc file?????? >...
2007 Sep 05
2
[LLVMdev] Seeing a crash with ConstantFP::get
...line to the Fibonacci example program: int main(int argc, char **argv) { int n = argc > 1 ? atol(argv[1]) : 24; // Create some module to put our function into it. Module *M = new Module("test"); // We are about to create the "fib" function: Function *FibF = CreateFibFunction(M); // add the following line Constant* C = ConstantFP::get(Type::FloatTy,0.0); Can someone verify this? This is on the PC side of my system which I build with the VStudio files. I don't know if the Mac side sees this as well, but I'll try and verify. Se...