Displaying 10 results from an estimated 10 matches for "emitllvmonlyaction".
2020 Nov 17
2
JIT compiling CUDA source code
...To JIT compile C++ code, we do basically as follows:
1. call Driver::BuildCompilation(), which returns a clang Command to execute
2. create a CompilerInvocation using the arguments from the Command
3. create a CompilerInstance around the CompilerInvocation
4. use the CompilerInstance to execute an EmitLLVMOnlyAction
5. retrieve the resulting Module from the action and add it to the JIT
But to compile C++ requires only a single clang command. When you add CUDA
to the equation, you add several other steps. If you use the clang front
end to compile, clang does the following:
1. compiles the driver source code
2...
2013 Feb 21
0
[LLVMdev] Missing common linkage
Hi,
I'm writing to both lists as I'm not sure what the cause of this
issue is. I use code like this to compile C source into LLVM IR
as suggested on the Clang mailing list previously.
class CompileBitcodeAction : public clang::EmitLLVMOnlyAction
{
protected:
Module*& dstModule;
public:
inline CompileBitcodeAction(Module*& dstModule, LLVMContext* const context = NULL)
: clang::EmitLLVMOnlyAction(context), dstModule(dstModule)
{}
protected:
virtual inline void EndSourceFileAction()
{
clang::EmitL...
2020 Nov 19
1
JIT compiling CUDA source code
...at lists.llvm.org> wrote:
> I have made a bit of progress... When compiling CUDA source code in
> memory, the Compilation instance returned by Driver::BuildCompilation()
> contains two clang Commands: one for the host and one for the CUDA device.
> I can execute both commands using EmitLLVMOnlyActions. I add the Module
> from the host compilation to my JIT as usual, but... what to do with the
> Module from the device compilation? If I just add it to the JIT, I get an
> error message like this:
>
> Added modules have incompatible data layouts:
> e-i64:64-i128:128-v16:16-v32...
2013 Feb 08
2
[LLVMdev] Possible issue with DenseMap when using AliasSetTracker
...developers to adhere strictly to coding guidelines, I
wrote the attached program called "alias-detector". The program's intent is to
utilize the BasicAliasAnalysis to get a list of aliases for each pointer in a
certain program code. First it initializes clang as frontend, executes the
EmitLLVMOnlyAction, and then processes the produced Module with the following
three passes:
1. BasicAliasAnalysis -- The basic alias analysis
2. AliasTrackerPass -- BasicBlockPass that creates an AliasSet for each pointer
in the analyzed code (line 261 and line 94 respectively)
3. AliasDetectorPass -- BasicBlockPass...
2020 Nov 19
0
JIT compiling CUDA source code
I have made a bit of progress... When compiling CUDA source code in memory,
the Compilation instance returned by Driver::BuildCompilation() contains
two clang Commands: one for the host and one for the CUDA device. I can
execute both commands using EmitLLVMOnlyActions. I add the Module from the
host compilation to my JIT as usual, but... what to do with the Module from
the device compilation? If I just add it to the JIT, I get an error message
like this:
Added modules have incompatible data layouts:
e-i64:64-i128:128-v16:16-v32:32-n16:32:64 (module) vs
e-m...
2013 Feb 11
0
[LLVMdev] Possible issue with DenseMap when using AliasSetTracker
...strictly to coding guidelines, I
> wrote the attached program called "alias-detector". The program's intent is to
> utilize the BasicAliasAnalysis to get a list of aliases for each pointer in a
> certain program code. First it initializes clang as frontend, executes the
> EmitLLVMOnlyAction, and then processes the produced Module with the following
> three passes:
> 1. BasicAliasAnalysis -- The basic alias analysis
> 2. AliasTrackerPass -- BasicBlockPass that creates an AliasSet for each pointer
> in the analyzed code (line 261 and line 94 respectively)
> 3. AliasDetect...
2010 Aug 18
1
[LLVMdev] clang: call extern function using JIT
...des &&
Clang.getHeaderSearchOpts().ResourceDir.empty())
Clang.getHeaderSearchOpts().ResourceDir =
CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
// Create and execute the frontend to generate an LLVM bitcode module.
llvm::OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction());
if (!Clang.ExecuteAction(*Act))
return 1;
int Res = 255;
if (llvm::Module *Module = Act->takeModule())
{
Res = Execute(Module, envp);
}
// Shutdown.
llvm::llvm_shutdown();
return Res;
}
gafferuk wrote:
>
> I tried what y...
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
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
2013 Oct 03
0
[LLVMdev] libclang JIT frontend
...ir.empty())
Clang.getHeaderSearchOpts().ResourceDir =
CompilerInvocation::GetResourcesPath(argv, MainAddr);
// CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
// Create and execute the frontend to generate an LLVM bitcode module.
OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction());
if (!Clang.ExecuteAction(*Act))
return 1;
int Res = 255;
if (llvm::Module *Module = Act->takeModule())
Res = Execute(Module, envp);
llvm::errs() << "Result = " << Res << "\n"; //Not an error, but just report Res to see what happened....