summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/linux-llvm8
-rw-r--r--src/mesa/Makefile11
-rw-r--r--src/mesa/pipe/Makefile6
-rw-r--r--src/mesa/pipe/Makefile.template10
-rw-r--r--src/mesa/pipe/llvm/Makefile80
-rw-r--r--src/mesa/pipe/llvm/llvm_base_shader.cpp16
-rw-r--r--src/mesa/pipe/softpipe/sp_state_fs.c12
-rw-r--r--src/mesa/sources11
8 files changed, 117 insertions, 37 deletions
diff --git a/configs/linux-llvm b/configs/linux-llvm
index 6d1f31daa2..915189f462 100644
--- a/configs/linux-llvm
+++ b/configs/linux-llvm
@@ -1,3 +1,4 @@
+# -*-makefile-*-
# Configuration for Linux and LLVM with debugging info
include $(TOP)/configs/linux
@@ -5,7 +6,7 @@ include $(TOP)/configs/linux
CONFIG_NAME = linux-llvm
OPT_FLAGS = -g -ansi -pedantic
-DEFINES += -DDEBUG -DDEBUG_MATH
+DEFINES += -DDEBUG -DDEBUG_MATH -DMESA_LLVM=1
LLVM_VERSION := $(shell llvm-config --version)
@@ -18,9 +19,8 @@ else
endif
ifeq ($(MESA_LLVM),1)
-# LLVM_CFLAGS=`llvm-config --cflags` -DMESA_LLVM=1
- LLVM_CFLAGS=-DMESA_LLVM=1
- LLVM_CXXFLAGS=`llvm-config --cxxflags` -DMESA_LLVM=1 -Wno-long-long
+# LLVM_CFLAGS=`llvm-config --cflags`
+ LLVM_CXXFLAGS=`llvm-config --cxxflags` -Wno-long-long
LLVM_LDFLAGS=`llvm-config --ldflags`
LLVM_LIBS=`llvm-config --libs`
MKLIB_OPTIONS=-cplusplus
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index dd8e2c3762..681c566140 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -20,14 +20,17 @@ CELL_LIB = $(TOP)/src/mesa/pipe/cell/ppu/libcell.a
CELL_LIB_SPU = $(TOP)/src/mesa/pipe/cell/spu/g3d_spu.a
endif
+ifeq ($(CONFIG_NAME), linux-llvm)
+LLVM_LIB = $(TOP)/src/mesa/pipe/llvm/libgallivm.a
+endif
.SUFFIXES : .cpp
.c.o:
- $(CC) -c $(LLVM_CFLAGS) $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+ $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
.cpp.o:
- $(CXX) -c $(LLVM_CXXFLAGS) $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
+ $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
.S.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
@@ -120,12 +123,12 @@ stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$
osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
# Make the GL library
-$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU)
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU) $(LLVM_LIB)
@ $(TOP)/bin/mklib -o $(GL_LIB) \
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
-install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(STAND_ALONE_OBJECTS) \
- $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU) $(GL_LIB_DEPS)
+ $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU) $(LLVM_LIB) $(GL_LIB_DEPS)
# Make the OSMesa library
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
diff --git a/src/mesa/pipe/Makefile b/src/mesa/pipe/Makefile
index c0345a9cb5..da044036ff 100644
--- a/src/mesa/pipe/Makefile
+++ b/src/mesa/pipe/Makefile
@@ -6,7 +6,11 @@ ifeq ($(CONFIG_NAME), linux-cell)
CELL_DIR = cell
endif
-SUBDIRS = softpipe i915simple i965simple failover pipebuffer $(CELL_DIR)
+ifeq ($(CONFIG_NAME), linux-llvm)
+LLVM_DIR = llvm
+endif
+
+SUBDIRS = softpipe llvm i915simple i965simple failover pipebuffer $(CELL_DIR) $(LLVM_DIR)
default: subdirs
diff --git a/src/mesa/pipe/Makefile.template b/src/mesa/pipe/Makefile.template
index 8c2f84b328..3cd07660b6 100644
--- a/src/mesa/pipe/Makefile.template
+++ b/src/mesa/pipe/Makefile.template
@@ -8,6 +8,7 @@
COMMON_SOURCES =
OBJECTS = $(C_SOURCES:.c=.o) \
+ $(CPP_SOURCES:.cpp=.o) \
$(ASM_SOURCES:.S=.o)
@@ -22,7 +23,10 @@ INCLUDES = \
##### RULES #####
.c.o:
- $(CC) -c $(INCLUDES) $(LLVM_CFLAGS) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+.cpp.o:
+ $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
@@ -37,10 +41,10 @@ $(LIBNAME): $(OBJECTS) Makefile $(TOP)/src/mesa/pipe/Makefile.template
$(TOP)/bin/mklib -o $@ -static $(OBJECTS)
-depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
+depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
rm -f depend
touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
+ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
$(ASM_SOURCES) 2> /dev/null
diff --git a/src/mesa/pipe/llvm/Makefile b/src/mesa/pipe/llvm/Makefile
new file mode 100644
index 0000000000..b1463f67cf
--- /dev/null
+++ b/src/mesa/pipe/llvm/Makefile
@@ -0,0 +1,80 @@
+# -*-makefile-*-
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = gallivm
+
+
+GALLIVM_SOURCES = \
+ gallivm.cpp \
+ instructions.cpp \
+ storage.cpp
+
+INC_SOURCES = gallivm_builtins.cpp llvm_base_shader.cpp
+
+CPP_SOURCES = \
+ $(GALLIVM_SOURCES)
+
+C_SOURCES =
+ASM_SOURCES =
+
+OBJECTS = $(C_SOURCES:.c=.o) \
+ $(CPP_SOURCES:.cpp=.o) \
+ $(ASM_SOURCES:.S=.o)
+
+### Include directories
+INCLUDES = \
+ -I. \
+ -I$(TOP)/src/mesa/pipe \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/include
+
+
+##### RULES #####
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(LLVM_CFLAGS) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+.cpp.o:
+ $(CXX) -c $(INCLUDES) $(LLVM_CXXFLAGS) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+.S.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+##### TARGETS #####
+
+default:: depend symlinks $(LIBNAME)
+
+
+$(LIBNAME): $(OBJECTS) Makefile
+ $(TOP)/bin/mklib -o $@ -static $(OBJECTS)
+
+
+depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(INC_SOURCES)
+ rm -f depend
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
+ $(ASM_SOURCES) $(INC_SOURCES) 2> /dev/null
+
+
+gallivm_builtins.cpp: llvm_builtins.c
+ clang --emit-llvm $< |llvm-as|opt -std-compile-opts|llvm2cpp -gen-contents -o=$@ -f -for=shader -funcname=createGallivmBuiltins
+
+llvm_base_shader.cpp: llvm_entry.c
+ clang --emit-llvm $< |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -o=$@ -funcname=createBaseShader
+
+# Emacs tags
+tags:
+ etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+ -rm -f *.o */*.o *~ *.so *~ server/*.o
+ -rm -f depend depend.bak
+ -rm -f gallivm_builtins.cpp llvm_base_shader.cpp
+
+symlinks:
+
+
+include depend
diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp
index 951afc390e..b574b550ae 100644
--- a/src/mesa/pipe/llvm/llvm_base_shader.cpp
+++ b/src/mesa/pipe/llvm/llvm_base_shader.cpp
@@ -209,7 +209,7 @@ Module* createBaseShader() {
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"run_vertex_shader", mod);
func_run_vertex_shader->setCallingConv(CallingConv::C);
- ParamAttrsList *func_run_vertex_shader_PAL = 0;
+ const ParamAttrsList *func_run_vertex_shader_PAL = 0;
func_run_vertex_shader->setParamAttrs(func_run_vertex_shader_PAL);
Function* func_execute_shader = new Function(
@@ -217,7 +217,7 @@ Module* createBaseShader() {
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"execute_shader", mod); // (external, no body)
func_execute_shader->setCallingConv(CallingConv::C);
- ParamAttrsList *func_execute_shader_PAL = 0;
+ const ParamAttrsList *func_execute_shader_PAL = 0;
func_execute_shader->setParamAttrs(func_execute_shader_PAL);
Function* func_run_fragment_shader = new Function(
@@ -225,7 +225,7 @@ Module* createBaseShader() {
/*Linkage=*/GlobalValue::ExternalLinkage,
/*Name=*/"run_fragment_shader", mod);
func_run_fragment_shader->setCallingConv(CallingConv::C);
- ParamAttrsList *func_run_fragment_shader_PAL = 0;
+ const ParamAttrsList *func_run_fragment_shader_PAL = 0;
func_run_fragment_shader->setParamAttrs(func_run_fragment_shader_PAL);
// Global Variable Declarations
@@ -644,7 +644,7 @@ Module* createBaseShader() {
StoreInst* void_110 = new StoreInst(ptr_arraydecay16, ptr_tmp12, false, label_forbody_92);
CallInst* void_111 = new CallInst(func_execute_shader, ptr_args, "", label_forbody_92);
void_111->setCallingConv(CallingConv::C);
- void_111->setTailCall(false);ParamAttrsList *void_111_PAL = 0;
+ void_111->setTailCall(false);const ParamAttrsList *void_111_PAL = 0;
void_111->setParamAttrs(void_111_PAL);
BinaryOperator* int32_indvar_next_112 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_106, const_int32_31, "indvar.next", label_forbody_92);
@@ -790,7 +790,7 @@ Module* createBaseShader() {
StoreInst* void_162 = new StoreInst(const_int32_29, ptr_tmp, false, label_from_consts_exit_124);
CallInst* void_163 = new CallInst(func_execute_shader, ptr_args_127, "", label_from_consts_exit_124);
void_163->setCallingConv(CallingConv::C);
- void_163->setTailCall(false);ParamAttrsList *void_163_PAL = 0;
+ void_163->setTailCall(false);const ParamAttrsList *void_163_PAL = 0;
void_163->setParamAttrs(void_163_PAL);
LoadInst* int32_tmp23 = new LoadInst(ptr_tmp, "tmp23", false, label_from_consts_exit_124);
@@ -807,7 +807,7 @@ Module* createBaseShader() {
StoreInst* void_166 = new StoreInst(const_int32_29, ptr_tmp, false, label_from_consts_exit_124);
CallInst* void_167 = new CallInst(func_execute_shader, ptr_args_127, "", label_from_consts_exit_124);
void_167->setCallingConv(CallingConv::C);
- void_167->setTailCall(false);ParamAttrsList *void_167_PAL = 0;
+ void_167->setTailCall(false);const ParamAttrsList *void_167_PAL = 0;
void_167->setParamAttrs(void_167_PAL);
LoadInst* int32_tmp23_1 = new LoadInst(ptr_tmp, "tmp23.1", false, label_from_consts_exit_124);
@@ -826,7 +826,7 @@ Module* createBaseShader() {
StoreInst* void_170 = new StoreInst(const_int32_29, ptr_tmp, false, label_from_consts_exit_124);
CallInst* void_171 = new CallInst(func_execute_shader, ptr_args_127, "", label_from_consts_exit_124);
void_171->setCallingConv(CallingConv::C);
- void_171->setTailCall(false);ParamAttrsList *void_171_PAL = 0;
+ void_171->setTailCall(false);const ParamAttrsList *void_171_PAL = 0;
void_171->setParamAttrs(void_171_PAL);
LoadInst* int32_tmp23_2 = new LoadInst(ptr_tmp, "tmp23.2", false, label_from_consts_exit_124);
@@ -845,7 +845,7 @@ Module* createBaseShader() {
StoreInst* void_174 = new StoreInst(const_int32_29, ptr_tmp, false, label_from_consts_exit_124);
CallInst* void_175 = new CallInst(func_execute_shader, ptr_args_127, "", label_from_consts_exit_124);
void_175->setCallingConv(CallingConv::C);
- void_175->setTailCall(false);ParamAttrsList *void_175_PAL = 0;
+ void_175->setTailCall(false);const ParamAttrsList *void_175_PAL = 0;
void_175->setParamAttrs(void_175_PAL);
LoadInst* int32_tmp23_3 = new LoadInst(ptr_tmp, "tmp23.3", false, label_from_consts_exit_124);
diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c
index 830c873b25..945c93411f 100644
--- a/src/mesa/pipe/softpipe/sp_state_fs.c
+++ b/src/mesa/pipe/softpipe/sp_state_fs.c
@@ -59,13 +59,6 @@ softpipe_create_fs_state(struct pipe_context *pipe,
tgsi_dump(state->shader.tokens, 0);
}
-#if defined(__i386__) || defined(__386__)
- if (softpipe->use_sse) {
- x86_init_func( &state->sse2_program );
- tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program );
- }
-#endif
-
#ifdef MESA_LLVM
state->llvm_prog = gallivm_from_tgsi(state->shader.tokens, GALLIVM_FS);
if (!gallivm_global_cpu_engine()) {
@@ -73,6 +66,11 @@ softpipe_create_fs_state(struct pipe_context *pipe,
}
else
gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog);
+#elif defined(__i386__) || defined(__386__)
+ if (softpipe->use_sse) {
+ x86_init_func( &state->sse2_program );
+ tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program );
+ }
#endif
return state;
diff --git a/src/mesa/sources b/src/mesa/sources
index 56ea6dbce2..90ce9ce370 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -186,12 +186,6 @@ TGSIUTIL_SOURCES = \
pipe/tgsi/util/tgsi_parse.c \
pipe/tgsi/util/tgsi_util.c
-
-LLVMTGSI_SOURCES = \
- pipe/llvm/gallivm.cpp \
- pipe/llvm/storage.cpp \
- pipe/llvm/instructions.cpp
-
STATECACHE_SOURCES = \
pipe/cso_cache/cso_hash.c \
pipe/cso_cache/cso_cache.c
@@ -370,7 +364,6 @@ FBDEV_DRIVER_SOURCES = \
ALL_SOURCES = \
$(GLAPI_SOURCES) \
$(SOLO_SOURCES) \
- $(LLVMTGSI_SOURCES) \
$(ASM_SOURCES) \
$(COMMON_DRIVER_SOURCES)\
$(X11_DRIVER_SOURCES) \
@@ -397,15 +390,13 @@ SOLO_SOURCES = \
CORE_SOURCES = \
$(GLAPI_SOURCES) \
- $(SOLO_SOURCES) \
- $(LLVMTGSI_SOURCES)
+ $(SOLO_SOURCES)
### Object files
SOLO_OBJECTS = \
$(SOLO_SOURCES:.c=.o) \
- $(LLVMTGSI_SOURCES:.cpp=.o) \
$(ASM_SOURCES:.S=.o)
GLAPI_OBJECTS = \