llvm: we need custom rules so had to redo the build a little bit

also don't use sse when llvm is enabled
This commit is contained in:
Zack Rusin
2008-01-04 09:27:42 -05:00
parent 3385f3d250
commit 9789c301b4
8 changed files with 117 additions and 37 deletions
+4 -4
View File
@@ -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
+7 -4
View File
@@ -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)
+5 -1
View File
@@ -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
+7 -3
View File
@@ -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
+80
View File
@@ -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
+8 -8
View File
@@ -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);
+5 -7
View File
@@ -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;
+1 -10
View File
@@ -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 = \