summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_screen.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-08-23 05:52:20 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-08-29 09:21:41 +0100
commit08dd41fd6899bd6b3289d30dc31f8b2998406889 (patch)
tree06e983e67d5c99eadd59a418b568082175bc8bbb /src/gallium/drivers/llvmpipe/lp_screen.c
parent97b4681d7e1ccf40d1584436ade7c70fc1893e27 (diff)
llvmpipe: Centralize the C <-> JIT interfaces in one place.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_screen.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 750573a4a9a..f302b99ad76 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -26,8 +26,6 @@
**************************************************************************/
-#include <llvm-c/Transforms/Scalar.h>
-
#include "util/u_memory.h"
#include "util/u_simple_screen.h"
#include "pipe/internal/p_winsys_screen.h"
@@ -36,6 +34,7 @@
#include "lp_texture.h"
#include "lp_winsys.h"
+#include "lp_jit.h"
#include "lp_screen.h"
@@ -162,11 +161,7 @@ llvmpipe_destroy_screen( struct pipe_screen *_screen )
struct pipe_winsys *winsys = _screen->winsys;
- if(screen->engine)
- LLVMDisposeExecutionEngine(screen->engine);
-
- if(screen->pass)
- LLVMDisposePassManager(screen->pass);
+ lp_jit_screen_cleanup(screen);
if(winsys->destroy)
winsys->destroy(winsys);
@@ -184,7 +179,6 @@ struct pipe_screen *
llvmpipe_create_screen(struct pipe_winsys *winsys)
{
struct llvmpipe_screen *screen = CALLOC_STRUCT(llvmpipe_screen);
- char *error = NULL;
if (!screen)
return NULL;
@@ -202,25 +196,7 @@ llvmpipe_create_screen(struct pipe_winsys *winsys)
llvmpipe_init_screen_texture_funcs(&screen->base);
u_simple_screen_init(&screen->base);
- screen->module = LLVMModuleCreateWithName("llvmpipe");
-
- screen->provider = LLVMCreateModuleProviderForExistingModule(screen->module);
-
- if (LLVMCreateJITCompiler(&screen->engine, screen->provider, 1, &error)) {
- fprintf(stderr, "%s\n", error);
- LLVMDisposeMessage(error);
- abort();
- }
-
- screen->pass = LLVMCreateFunctionPassManager(screen->provider);
- LLVMAddTargetData(LLVMGetExecutionEngineTargetData(screen->engine), screen->pass);
- /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
- * but there are more on SVN. */
- LLVMAddConstantPropagationPass(screen->pass);
- LLVMAddInstructionCombiningPass(screen->pass);
- LLVMAddPromoteMemoryToRegisterPass(screen->pass);
- LLVMAddGVNPass(screen->pass);
- LLVMAddCFGSimplificationPass(screen->pass);
+ lp_jit_screen_init(screen);
return &screen->base;
}