+# -*-makefile-*-
# Configuration for Linux and LLVM with debugging info
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)
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
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 $@
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)
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
COMMON_SOURCES =
OBJECTS = $(C_SOURCES:.c=.o) \
+ $(CPP_SOURCES:.cpp=.o) \
$(ASM_SOURCES:.S=.o)
##### 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 $@
$(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
--- /dev/null
+# -*-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
/*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(
/*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(
/*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
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);
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);
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);
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);
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);
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()) {
}
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;
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
ALL_SOURCES = \
$(GLAPI_SOURCES) \
$(SOLO_SOURCES) \
- $(LLVMTGSI_SOURCES) \
$(ASM_SOURCES) \
$(COMMON_DRIVER_SOURCES)\
$(X11_DRIVER_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 = \