Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] clang: call extern function using JIT"
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
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 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
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
1
[LLVMdev] clang: call extern function using JIT
Im trying to call fuctions in my music application from c code which will be
used by the JIT.
Here my function, i have made no other changes to the clang interpreter
example. Can you see anything else I have to add to either the fuction below
or to the c code to be JIT at the bottom?
// function I wish to call.
int yipee(int aVar)
{
aVar = 5;
}
int Execute(llvm::Module *Mod, char * const
2010 Aug 14
2
[LLVMdev] clang: call application function
im using code from the clang interpreter example.
what code do I need to add so I can call functions in my main application?
Thanks.
Paul.
--
View this message in context: http://old.nabble.com/clang%3A-call-application-function-tp29439756p29439756.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
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
2009 Oct 06
1
[LLVMdev] 2.6/trunk Execution Engine question
On Tue, Oct 6, 2009 at 5:49 PM, Reid Kleckner <rnk at mit.edu> wrote:
>> Also, the null pointer is coming from a call to JCE->allocateSpace().
>> This is a virtual function; I'm trying to discover what subclass it
>> is.
>
> So, there's JITEmitter::allocateSpace which overrides
> JITCodeEmitter::allocateSpace(), but *most* of the time it just calls
>
2009 Oct 06
0
[LLVMdev] 2.6/trunk Execution Engine question
>
> It just occurred to me... in the case where it's failing, the
> ExecutionEngine was trying to JIT a global, and it had never JITted
> any functions! I'll work up a small test case, but I think it's
> relevant since the thing is trying to allocate the globals with the
> functions.
>
That was it! The following small test program crashes in getPointerToGlobal:
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
>>
2015 Aug 05
2
[BUG] Incorrect ASCII escape characters on Mac
On Wed, 2015-08-05 at 10:02 -0400, Ramkumar Ramachandra wrote:
>
> - at 5 = internal global [10 x i8] c"\22\D0\12\F4!\00\15\F9\EC\E1"
> - at 6 = internal global [10 x i8] c"\D0\19\FB+\FD\F8#\03\E2\11"
> + at 5 = internal global [10 x i8] c"\22Ð\12ô!\00\15ùìá"
> + at 6 = internal global [10 x i8] c"Ð\19û+ýø#\03â\11"
>
> The diff
2009 Oct 06
4
[LLVMdev] 2.6/trunk Execution Engine question
> 6. When ExecutionEngine::create was called with parameter
> "GVsWithCode" set to its default value of true, I got a segfault when
> trying to get a pointer to one of my globals. JIT::getMemoryForGV was
> returning NULL in that case. Explicitly passing false for
> "GVsWithCode" cleared it up.
That's no good. Could you send me a stack trace and explain
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
2014 Aug 02
2
[LLVMdev] LLVM Basic Program Compilation
Thank you Chris.
I am using llvm-3.4.2. I am facing the same issue when using clang++ as
well.
$ clang++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
`llvm-config --cxxflags --ldflags --libs` -S -emit-llvm
gives me errors
$clang++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -S
-emit-llvm
$ lli try.s
gives me Program used external function
2015 Nov 24
2
How to create a sprintf call in IR
Hi,
I created a global char array, char buffer[1024]. I want to call a function
to append the string information to the buffer repeatedly. For example, I
need to implement the following code, where length, a, b, c, are global
variables.
int length = 0;
length += sprintf(buffer+length, "str%d", a);
length += sprintf(buffer+length, "str%c", b);
length += sprintf(buffer+length,
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 =
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