summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk202
-rw-r--r--src/glsl/ir_to_llvm.cpp26
-rw-r--r--src/pixelflinger2/llvm_scanline.cpp8
3 files changed, 21 insertions, 215 deletions
diff --git a/Android.mk b/Android.mk
index d959a00..e69de29 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,202 +0,0 @@
-# USE_LLVM_EXECUTIONENGINE not fully implemented
-USE_LLVM_EXECUTIONENGINE := false
-# if using libLLVMExecutionEngine,
-# need to add files to several Android.mk in external/llvm, and comment out some stuff in llvm DynamicLibrary.cpp and Intercept.cpp
-
-DEBUG_BUILD := false
-
-LOCAL_PATH := $(call my-dir)
-LLVM_ROOT_PATH := external/llvm
-
-# these are for using llvm::ExecutionEngine, also remove libbcc
-#libLLVMX86CodeGen;libLLVMX86Info;libLLVMBitReader;libLLVMSelectionDAG;libLLVMAsmPrinter;libLLVMJIT;libLLVMCodeGen;libLLVMTarget;libLLVMMC;libLLVMScalarOpts;libLLVMipo;libLLVMTransformUtils;libLLVMCore;libLLVMSupport;libLLVMSystem;libLLVMAnalysis;libLLVMInstCombine;libLLVMipa;libLLVMMCParser;libLLVMExecutionEngine;
-libMesa_STATIC_LIBS := \
- libLLVMBitReader \
- libLLVMSelectionDAG \
- libLLVMAsmPrinter \
- libLLVMJIT \
- libLLVMCodeGen \
- libLLVMTarget \
- libLLVMMC \
- libLLVMScalarOpts \
- libLLVMipo \
- libLLVMTransformUtils \
- libLLVMCore \
- libLLVMSupport \
- libLLVMSystem \
- libLLVMAnalysis \
- libLLVMInstCombine \
- libLLVMipa \
- libLLVMMCParser \
- libLLVMExecutionEngine
-
-libMesa_SRC_FILES := \
- src/glsl/glcpp/pp.c \
- src/glsl/glcpp/glcpp-lex.c \
- src/glsl/glcpp/glcpp-parse.c \
- src/glsl/ast_expr.cpp \
- src/glsl/ast_function.cpp \
- src/glsl/ast_to_hir.cpp \
- src/glsl/ast_type.cpp \
- src/glsl/builtin_function.cpp \
- src/glsl/glsl_lexer.cpp \
- src/glsl/glsl_parser.cpp \
- src/glsl/glsl_parser_extras.cpp \
- src/glsl/glsl_symbol_table.cpp \
- src/glsl/glsl_types.cpp \
- src/glsl/hir_field_selection.cpp \
- src/glsl/ir.cpp \
- src/glsl/ir_basic_block.cpp \
- src/glsl/ir_clone.cpp \
- src/glsl/ir_constant_expression.cpp \
- src/glsl/ir_expression_flattening.cpp \
- src/glsl/ir_function.cpp \
- src/glsl/ir_function_can_inline.cpp \
- src/glsl/ir_hierarchical_visitor.cpp \
- src/glsl/ir_hv_accept.cpp \
- src/glsl/ir_import_prototypes.cpp \
- src/glsl/ir_print_visitor.cpp \
- src/glsl/ir_reader.cpp \
- src/glsl/ir_rvalue_visitor.cpp \
- src/glsl/ir_set_program_inouts.cpp \
- src/glsl/ir_validate.cpp \
- src/glsl/ir_variable.cpp \
- src/glsl/ir_variable_refcount.cpp \
- src/glsl/link_functions.cpp \
- src/glsl/linker.cpp \
- src/glsl/loop_analysis.cpp \
- src/glsl/loop_controls.cpp \
- src/glsl/loop_unroll.cpp \
- src/glsl/lower_discard.cpp \
- src/glsl/lower_if_to_cond_assign.cpp \
- src/glsl/lower_instructions.cpp \
- src/glsl/lower_jumps.cpp \
- src/glsl/lower_mat_op_to_vec.cpp \
- src/glsl/lower_noise.cpp \
- src/glsl/lower_texture_projection.cpp \
- src/glsl/lower_variable_index_to_cond_assign.cpp \
- src/glsl/lower_vec_index_to_cond_assign.cpp \
- src/glsl/lower_vec_index_to_swizzle.cpp \
- src/glsl/lower_vector.cpp \
- src/glsl/main.cpp \
- src/glsl/opt_algebraic.cpp \
- src/glsl/opt_constant_folding.cpp \
- src/glsl/opt_constant_propagation.cpp \
- src/glsl/opt_constant_variable.cpp \
- src/glsl/opt_copy_propagation.cpp \
- src/glsl/opt_dead_code.cpp \
- src/glsl/opt_dead_code_local.cpp \
- src/glsl/opt_dead_functions.cpp \
- src/glsl/opt_discard_simplification.cpp \
- src/glsl/opt_function_inlining.cpp \
- src/glsl/opt_if_simplification.cpp \
- src/glsl/opt_noop_swizzle.cpp \
- src/glsl/opt_redundant_jumps.cpp \
- src/glsl/opt_structure_splitting.cpp \
- src/glsl/opt_swizzle_swizzle.cpp \
- src/glsl/opt_tree_grafting.cpp \
- src/glsl/s_expression.cpp \
- src/glsl/strtod.c \
- src/glsl/ir_to_llvm.cpp \
- src/mesa/main/shaderobj.c \
- src/mesa/program/hash_table.c \
- src/mesa/program/prog_parameter.cpp \
- src/mesa/program/symbol_table.c \
- src/pixelflinger2/buffer.cpp \
- src/pixelflinger2/format.cpp \
- src/pixelflinger2/llvm_scanline.cpp \
- src/pixelflinger2/llvm_texture.cpp \
- src/pixelflinger2/pixelflinger2.cpp \
- src/pixelflinger2/raster.cpp \
- src/pixelflinger2/scanline.cpp \
- src/pixelflinger2/shader.cpp \
- src/pixelflinger2/texture.cpp \
- src/talloc/hieralloc.c
-
-libMesa_C_INCLUDES := \
- $(LOCAL_PATH) \
- $(LOCAL_PATH)/src/glsl \
- $(LOCAL_PATH)/src/mesa \
- $(LOCAL_PATH)/src/talloc \
- $(LOCAL_PATH)/src/mapi \
- $(LOCAL_PATH)/include \
- frameworks/compile/libbcc/include
-
-# Static library for host
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-ifeq ($(DEBUG_BUILD),true)
-LOCAL_CFLAGS += -DDEBUG -UNDEBUG -O0 -g
-else
-LOCAL_CFLAGS += -O3
-endif
-
-LOCAL_MODULE := libMesa
-LOCAL_SRC_FILES := $(libMesa_SRC_FILES)
-
-ifeq ($(USE_LLVM_EXECUTIONENGINE),true)
-LOCAL_CFLAGS += -DUSE_LLVM_EXECUTIONENGINE=1
-LOCAL_STATIC_LIBRARIES := libLLVMX86CodeGen libLLVMX86Info $(libMesa_STATIC_LIBS)
-else
-LOCAL_CFLAGS += -DUSE_LLVM_EXECUTIONENGINE=0
-LOCAL_SHARED_LIBRARIES := libbcc
-endif
-
-LOCAL_C_INCLUDES := $(libMesa_C_INCLUDES)
-
-include $(LLVM_ROOT_PATH)/llvm-host-build.mk
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-
-# Static library for target
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-ifeq ($(DEBUG_BUILD),true)
-LOCAL_CFLAGS += -DDEBUG -UNDEBUG -O0 -g
-else
-LOCAL_CFLAGS += -O3
-endif
-
-LOCAL_MODULE := libMesa
-LOCAL_SRC_FILES := $(libMesa_SRC_FILES)
-LOCAL_SHARED_LIBRARIES := libstlport libcutils libdl libutils
-
-ifeq ($(USE_LLVM_EXECUTIONENGINE),true)
-LOCAL_CFLAGS += -DUSE_LLVM_EXECUTIONENGINE=1
-LOCAL_STATIC_LIBRARIES := libLLVMARMCodeGen libLLVMARMInfo libLLVMARMDisassembler libLLVMARMAsmPrinter $(libMesa_STATIC_LIBS)
-else
-LOCAL_CFLAGS += -DUSE_LLVM_EXECUTIONENGINE=0
-LOCAL_SHARED_LIBRARIES += libbcc
-endif
-
-LOCAL_C_INCLUDES := $(libMesa_C_INCLUDES)
-
-include $(LLVM_ROOT_PATH)/llvm-device-build.mk
-include $(BUILD_STATIC_LIBRARY)
-
-# glsl_compiler for host
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-ifeq ($(DEBUG_BUILD),true)
-LOCAL_CFLAGS += -DDEBUG -UNDEBUG -O0 -g
-endif
-
-LOCAL_MODULE := glsl_compiler
-LOCAL_SRC_FILES := src/glsl/glsl_compiler.cpp
-LOCAL_C_INCLUDES := $(libMesa_C_INCLUDES)
-LOCAL_STATIC_LIBRARIES := libMesa
-
-include $(BUILD_HOST_EXECUTABLE)
-
-# Build children
-# ========================================================
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/src/glsl/ir_to_llvm.cpp b/src/glsl/ir_to_llvm.cpp
index 3211d9f..a99a58b 100644
--- a/src/glsl/ir_to_llvm.cpp
+++ b/src/glsl/ir_to_llvm.cpp
@@ -151,10 +151,11 @@ public:
if(type->is_record())
{
- std::vector<const llvm::Type*> fields;
+ std::vector<llvm::Type*> fields;
for (unsigned i = 0; i < type->length; i++)
fields.push_back(llvm_type(type->fields.structure[i].type));
- return llvm::StructType::get(ctx, fields);
+ return llvm::StructType::get(ctx, llvm::ArrayRef<llvm::Type*>(
+ fields));
}
const llvm::Type* base_type = llvm_base_type(type->base_type);
@@ -280,7 +281,7 @@ public:
else
{
llvm::Function::LinkageTypes linkage;
- std::vector<const llvm::Type*> params;
+ std::vector<llvm::Type*> params;
foreach_iter(exec_list_iterator, iter, sig->parameters) {
ir_variable* arg = (ir_variable*)iter.get();
params.push_back(llvm_type(arg->type));
@@ -295,9 +296,12 @@ public:
params.push_back(vecPtrTy); // outputs
params.push_back(vecPtrTy); // constants
}
- else
+ else {
linkage = llvm::Function::InternalLinkage;
- llvm::FunctionType* ft = llvm::FunctionType::get(llvm_type(sig->return_type), params, false);
+ }
+ llvm::FunctionType* ft = llvm::FunctionType::get(llvm_type(sig->return_type),
+ llvm::ArrayRef<llvm::Type*>(params),
+ false);
function = llvm::Function::Create(ft, linkage, functionName, mod);
free(functionName);
return function;
@@ -376,9 +380,11 @@ public:
llvm::Function * function = mod->getFunction(name);
if (!function) {
// predeclare the intrinsic
- std::vector<const llvm::Type*> args;
+ std::vector<llvm::Type*> args;
args.push_back(floatType);
- llvm::FunctionType* type = llvm::FunctionType::get(floatType, args, false);
+ llvm::FunctionType* type = llvm::FunctionType::get(floatType,
+ llvm::ArrayRef<llvm::Type*>(args),
+ false);
function = llvm::Function::Create(type, llvm::Function::ExternalLinkage, name, mod);
function->setCallingConv(llvm::CallingConv::C);
}
@@ -401,10 +407,12 @@ public:
llvm::Function * function = mod->getFunction(name);
if (!function) {
// predeclare the intrinsic
- std::vector<const llvm::Type*> args;
+ std::vector<llvm::Type*> args;
args.push_back(floatType);
args.push_back(floatType);
- llvm::FunctionType* type = llvm::FunctionType::get(floatType, args, false);
+ llvm::FunctionType* type = llvm::FunctionType::get(floatType,
+ llvm::ArrayRef<llvm::Type*>(args),
+ false);
function = llvm::Function::Create(type, llvm::Function::ExternalLinkage, name, mod);
function->setCallingConv(llvm::CallingConv::C);
}
diff --git a/src/pixelflinger2/llvm_scanline.cpp b/src/pixelflinger2/llvm_scanline.cpp
index 26c62cd..a0bd2dc 100644
--- a/src/pixelflinger2/llvm_scanline.cpp
+++ b/src/pixelflinger2/llvm_scanline.cpp
@@ -224,7 +224,7 @@ static Value * IntVectorToScreenColor(IRBuilder<> & builder, const GGLPixelForma
comps[2] = builder.CreateLShr(comps[2], 3);
comps[1] = builder.CreateShl(comps[1], 3);
comps[0] = builder.CreateShl(comps[0], 8);
-
+
comps[0] = builder.CreateOr(comps[0], comps[1]);
comps[0] = builder.CreateOr(comps[0], comps[2]);
return comps[0];
@@ -419,7 +419,7 @@ Value * GenerateFSBlend(const GGLState * gglCtx, const GGLPixelFormat format, /*
static FunctionType * ScanLineFunctionType(IRBuilder<> & builder)
{
- std::vector<const Type*> funcArgs;
+ std::vector<Type*> funcArgs;
const VectorType * vectorType = floatVecType(builder);
const PointerType * vectorPtr = PointerType::get(vectorType, 0);
const Type * intType = builder.getInt32Ty();
@@ -436,8 +436,8 @@ static FunctionType * ScanLineFunctionType(IRBuilder<> & builder)
funcArgs.push_back(intType); // count
FunctionType *functionType = FunctionType::get(/*Result=*/builder.getVoidTy(),
- /*Params=*/funcArgs,
- /*isVarArg=*/false);
+ llvm::ArrayRef<Type*>(funcArgs),
+ /*isVarArg=*/false);
return functionType;
}