Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] clang: call application function"
2010 Aug 15
0
[LLVMdev] clang: call application function
Ive tried the following code, but does not work.
What am I doing wrong?
// function I would like to call using JIT
extern "C"
void yipee(double val)
{
fprintf(stderr, "yipee!");
}
std::vector<const llvm::Type*> Double(1,
llvm::Type::getDoubleTy(llvm::getGlobalContext()));
llvm::FunctionType *FT =
2010 Aug 17
4
[LLVMdev] clang: call extern function using JIT
hi, im creating a music application(image below).
At the moment im using tcc compiler but im moving across to clang because of
the improved compiler warnings.
Can anyone please explain and show code so I can use clang's JIT to call
functions in my application?
Thanks.
http://old.nabble.com/file/p29449300/51709341.jpeg
--
View this message in context:
2010 Aug 18
2
[LLVMdev] clang: call extern function using JIT
gafferuk <gafferuk at gmail.com> writes:
> Can someone pease tell me what I am doing wrong?
It is hard to say because you don't say what the problem is, but let's
try.
> Im trying to register an external function with the JIT, so can call
> functions in my music
>
> application.
>
> Here my function
>
> int Execute(llvm::Module *Mod, char * const *envp)
2010 Aug 18
2
[LLVMdev] clang: call extern function using JIT
gafferuk <gafferuk at gmail.com> writes:
> Im confused. The function i wish to call is a return type of int.
> Im calling it with int dd = yipee(1);
>
> What's wrong?
Declare the function:
int yipee(int);
int main()
{
int dd = yipee(1);
return 0;
}
If that still crashes, put a breakpoint on `yipee' and see if the
execution gets there, if the argument is
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
I tried what you said, now I get:
LLVM ERROR: Program used external function 'yipee' which could not be
resolved!
Stack dump:
0. Running pass 'X86 Machine Code Emitter' on function '@main'
did not even get as far as a breakpoint.
Óscar Fuentes wrote:
>
> gafferuk <gafferuk at gmail.com> writes:
>
>> Im confused. The function i wish to call is
2010 Aug 18
1
[LLVMdev] clang: call extern function using JIT
Heres my full code listing, im totally stuck.
// Whistle.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Tool.h"
#include
2010 Aug 17
0
[LLVMdev] clang: call extern function using JIT
On Aug 17, 2010, at 1:56 PM, gafferuk wrote:
>
> hi, im creating a music application(image below).
>
> At the moment im using tcc compiler but im moving across to clang because of
> the improved compiler warnings.
> Can anyone please explain and show code so I can use clang's JIT to call
> functions in my application?
You'll probably want to take a look at the
2009 Aug 23
1
[LLVMdev] Having JIT resolve extern "C" functions declared in executible
2009/8/22 Bill Wendling <isanbard at gmail.com>:
> I think you might have to provide an empty list if your function doesn't
> take parameters. Maybe using an irbuilder would help?
It does take one parameter. Here's the important bits:
// My Function
extern "C"
void print(double X) {
printf("%f\n", X);
}
// Args type
std::vector<const Type*>
2015 Mar 10
4
[LLVMdev] noob IR builder question
I am trying to get a handle on IR builder, at least some basics. I ran through a tutorial here: Create a working compiler with the LLVM framework, Part 1 <http://www.ibm.com/developerworks/library/os-createcompilerllvm1/>, and it worked well enough. I have some simple code that creates a hello world IR. I am trying to now bring in some concepts from the Kaleidoscope tutorial, namely
2009 Aug 22
0
[LLVMdev] Having JIT resolve extern "C" functions declared in executible
I think you might have to provide an empty list if your function
doesn't take parameters. Maybe using an irbuilder would help?
-bw
On Aug 22, 2009, at 2:13 PM, Renato Golin <rengolin at systemcall.org>
wrote:
> 2009/7/4 Albert Graef <Dr.Graef at t-online.de>:
>> This is all I ever needed to interface to C functions using LLVM.
>> It's
>> really
2009 Aug 22
1
[LLVMdev] Having JIT resolve extern "C" functions declared in executible
2009/7/4 Albert Graef <Dr.Graef at t-online.de>:
> This is all I ever needed to interface to C functions using LLVM. It's
> really easy. Of course you still need a prototype of the external
> function (function definition without body) in your IR, but that's it.
Hi Albert,
I'm having a similar problem and I found I can't declare the function
and use it, most likely
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
Can someone pease tell me what I am doing wrong?
Im trying to register an external function with the JIT, so can call
functions in my music
application.
Here my function
int Execute(llvm::Module *Mod, char * const *envp) {
llvm::InitializeNativeTarget();
std::string Error;
llvm::OwningPtr<llvm::ExecutionEngine> EE(
llvm::ExecutionEngine::createJIT(Mod, &Error));
if (!EE) {
2010 Aug 18
3
[LLVMdev] clang: call extern function using JIT
> when I run my app the compiler says:
> E:\Projects\Whistle\Whistle\Release>Whistle file.c
> file.c(3) : warning: implicit declaration of function 'yipee' is invalid in
> C99
>
> [-Wimplicit-function-declaration]
> int dd = yipee(1);
> ^
This way you're creating a call to variadic function. It's of different type
compared to function
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
Im confused. The function i wish to call is a return type of int.
Im calling it with int dd = yipee(1);
What's wrong?
Anton Korobeynikov-2 wrote:
>
>> when I run my app the compiler says:
>> E:\Projects\Whistle\Whistle\Release>Whistle file.c
>> file.c(3) : warning: implicit declaration of function 'yipee' is invalid
>> in
>> C99
>>
2010 Jan 04
4
[LLVMdev] Getting Kaleidoscope to compile
Hi all,
I've started work on a new programming language for which I am
considering using LLVM as the backend, and trying to experiment with
it using the Kaleidoscope demo compiler.
Taking the full source listing from
http://llvm.org/docs/tutorial/LangImpl3.html#code and trying to
compile it with the provided instructions gives me the following
errors:
a at a-desktop:~$ g++ -g -O3 toy.cpp
2010 Jan 04
0
[LLVMdev] Getting Kaleidoscope to compile
Probably you missed to install llvm-dev package with headers for llvm.
2010/1/4 Russell Wallace <russell.wallace at gmail.com>
> Hi all,
>
> I've started work on a new programming language for which I am
> considering using LLVM as the backend, and trying to experiment with
> it using the Kaleidoscope demo compiler.
>
> Taking the full source listing from
>
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
ok, i have changed functionType code to:
llvm::FunctionType* ft =
llvm::FunctionType::get(llvm::Type::getInt32Ty(llvm::getGlobalContext()),
std::vector<const llvm::Type*>(1,
llvm::Type::getInt32Ty(llvm::getGlobalContext())), false);
when I run my app the compiler says:
E:\Projects\Whistle\Whistle\Release>Whistle file.c
file.c(3) : warning: implicit declaration of function
2016 Sep 19
3
llvm interpreter does not find function defined by addGlobalMapping
Hi,
I want to use a function defined in c(++)-code from code generated by llvm. For this I use ExecutionEngine.addGlobalMapping(). I started with the JIT execution engine and everything worked, then I switched to the interpreter engine and it stopped working, but only if compiled on a Linux system. More precisely it works if I use
llvm 3.8.1 + gcc (Linux) + JIT
llvm 3.8.0 + mingw-gcc
2013 May 21
1
[LLVMdev] Is it valid to add parameters to a function once it is created
I create a function with an empty signature:
void llvm_start_new_function() {
llvm::outs() << "Staring new LLVM function ...\n";
Mod = new llvm::Module("module", llvm::getGlobalContext());
builder = new llvm::IRBuilder<>(llvm::getGlobalContext());
llvm::FunctionType *funcType =
llvm::FunctionType::get(builder->getVoidTy(), false);
2011 May 31
2
[LLVMdev] How to identify LLVM version?
Hi, all
I'd like to write a code that can build different codes based on LLVM version.
Like code snippets in the below.
#ifdef __LLVM_29__
PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), 2, "iftmp");
#elif __LLVM_28__
PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), "iftmp");
#else
assert ("wrong