diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2008-02-13 08:46:05 -0500 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2008-02-13 08:46:05 -0500 |
commit | 12d5b078e8390cb2c598def31fd75260a54ace1a (patch) | |
tree | ccd7fd8b4c7a3897decc380fb1353fc6f3167fdd /src/mesa/pipe | |
parent | 7e51d2a9986231f4ca44a3643628645923e4d468 (diff) |
get rid of the terrible auto-generated entry point
it's not used anymore.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/llvm/Makefile | 6 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/llvm_base_shader.cpp | 833 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/llvm_entry.c | 163 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/tgsitollvm.cpp | 3 |
4 files changed, 3 insertions, 1002 deletions
diff --git a/src/mesa/pipe/llvm/Makefile b/src/mesa/pipe/llvm/Makefile index a0494ba966..9c6e16d86b 100644 --- a/src/mesa/pipe/llvm/Makefile +++ b/src/mesa/pipe/llvm/Makefile @@ -15,7 +15,7 @@ GALLIVM_SOURCES = \ storagesoa.cpp \ instructionssoa.cpp -INC_SOURCES = gallivm_builtins.cpp llvm_base_shader.cpp +INC_SOURCES = gallivm_builtins.cpp CPP_SOURCES = \ $(GALLIVM_SOURCES) @@ -65,8 +65,6 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(INC_SOURCES) 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=$@ -f -funcname=createBaseShader # Emacs tags tags: @@ -77,7 +75,7 @@ tags: clean: -rm -f *.o */*.o *~ *.so *~ server/*.o -rm -f depend depend.bak - -rm -f gallivm_builtins.cpp llvm_base_shader.cpp + -rm -f gallivm_builtins.cpp symlinks: diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp deleted file mode 100644 index 90a25a440a..0000000000 --- a/src/mesa/pipe/llvm/llvm_base_shader.cpp +++ /dev/null @@ -1,833 +0,0 @@ -// Generated by llvm2cpp - DO NOT MODIFY! - - -Module* createBaseShader() { - // Module Construction - Module* mod = new Module("Shader"); - mod->setDataLayout("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"); - mod->setTargetTriple("i686-pc-linux-gnu"); - - // Type Definitions - std::vector<const Type*>StructTy_struct_ShaderInput_fields; - VectorType* VectorTy_1 = VectorType::get(Type::FloatTy, 4); - - PointerType* PointerTy_0 = PointerType::get(VectorTy_1, 0); - - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(IntegerType::get(32)); - StructType* StructTy_struct_ShaderInput = StructType::get(StructTy_struct_ShaderInput_fields, /*isPacked=*/false); - mod->addTypeName("struct.ShaderInput", StructTy_struct_ShaderInput); - - OpaqueType* OpaqueTy_struct_pipe_sampler_state = OpaqueType::get(); - mod->addTypeName("struct.pipe_sampler_state", OpaqueTy_struct_pipe_sampler_state); - - OpaqueType* OpaqueTy_struct_softpipe_tile_cache = OpaqueType::get(); - mod->addTypeName("struct.softpipe_tile_cache", OpaqueTy_struct_softpipe_tile_cache); - - std::vector<const Type*>StructTy_struct_tgsi_sampler_fields; - PointerType* PointerTy_2 = PointerType::get(OpaqueTy_struct_pipe_sampler_state, 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_2); - std::vector<const Type*>FuncTy_4_args; - PATypeHolder StructTy_struct_tgsi_sampler_fwd = OpaqueType::get(); - PointerType* PointerTy_5 = PointerType::get(StructTy_struct_tgsi_sampler_fwd, 0); - - FuncTy_4_args.push_back(PointerTy_5); - PointerType* PointerTy_6 = PointerType::get(Type::FloatTy, 0); - - FuncTy_4_args.push_back(PointerTy_6); - FuncTy_4_args.push_back(PointerTy_6); - FuncTy_4_args.push_back(PointerTy_6); - FuncTy_4_args.push_back(Type::FloatTy); - ArrayType* ArrayTy_8 = ArrayType::get(Type::FloatTy, 4); - - PointerType* PointerTy_7 = PointerType::get(ArrayTy_8, 0); - - FuncTy_4_args.push_back(PointerTy_7); - FunctionType* FuncTy_4 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_4_args, - /*isVarArg=*/false); - - PointerType* PointerTy_3 = PointerType::get(FuncTy_4, 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_3); - PointerType* PointerTy_9 = PointerType::get(IntegerType::get(8), 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_9); - PointerType* PointerTy_10 = PointerType::get(OpaqueTy_struct_softpipe_tile_cache, 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_10); - StructType* StructTy_struct_tgsi_sampler = StructType::get(StructTy_struct_tgsi_sampler_fields, /*isPacked=*/false); - mod->addTypeName("struct.tgsi_sampler", StructTy_struct_tgsi_sampler); - cast<OpaqueType>(StructTy_struct_tgsi_sampler_fwd.get())->refineAbstractTypeTo(StructTy_struct_tgsi_sampler); - StructTy_struct_tgsi_sampler = cast<StructType>(StructTy_struct_tgsi_sampler_fwd.get()); - - - std::vector<const Type*>FuncTy_11_args; - ArrayType* ArrayTy_13 = ArrayType::get(VectorTy_1, 16); - - PointerType* PointerTy_12 = PointerType::get(ArrayTy_13, 0); - - FuncTy_11_args.push_back(PointerTy_12); - ArrayType* ArrayTy_15 = ArrayType::get(ArrayTy_8, 16); - - PointerType* PointerTy_14 = PointerType::get(ArrayTy_15, 0); - - FuncTy_11_args.push_back(PointerTy_14); - FuncTy_11_args.push_back(IntegerType::get(32)); - FuncTy_11_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_11 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_11_args, - /*isVarArg=*/false); - - std::vector<const Type*>FuncTy_16_args; - FuncTy_16_args.push_back(PointerTy_0); - FuncTy_16_args.push_back(PointerTy_7); - FuncTy_16_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_16 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_16_args, - /*isVarArg=*/false); - - std::vector<const Type*>FuncTy_17_args; - FuncTy_17_args.push_back(PointerTy_7); - FuncTy_17_args.push_back(PointerTy_0); - FuncTy_17_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_17 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_17_args, - /*isVarArg=*/false); - - std::vector<const Type*>FuncTy_18_args; - FuncTy_18_args.push_back(PointerTy_9); - FuncTy_18_args.push_back(PointerTy_9); - FuncTy_18_args.push_back(PointerTy_7); - FuncTy_18_args.push_back(IntegerType::get(32)); - FuncTy_18_args.push_back(IntegerType::get(32)); - FuncTy_18_args.push_back(IntegerType::get(32)); - FuncTy_18_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_18 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_18_args, - /*isVarArg=*/false); - - ArrayType* ArrayTy_20 = ArrayType::get(VectorTy_1, 32); - - PointerType* PointerTy_19 = PointerType::get(ArrayTy_20, 0); - - ArrayType* ArrayTy_22 = ArrayType::get(VectorTy_1, 128); - - PointerType* PointerTy_21 = PointerType::get(ArrayTy_22, 0); - - PointerType* PointerTy_23 = PointerType::get(StructTy_struct_ShaderInput, 0); - - PointerType* PointerTy_24 = PointerType::get(PointerTy_0, 0); - - std::vector<const Type*>FuncTy_26_args; - FuncTy_26_args.push_back(PointerTy_23); - FunctionType* FuncTy_26 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_26_args, - /*isVarArg=*/false); - - PointerType* PointerTy_25 = PointerType::get(FuncTy_26, 0); - - std::vector<const Type*>FuncTy_27_args; - FuncTy_27_args.push_back(Type::FloatTy); - FuncTy_27_args.push_back(Type::FloatTy); - FuncTy_27_args.push_back(PointerTy_12); - FuncTy_27_args.push_back(PointerTy_12); - FuncTy_27_args.push_back(IntegerType::get(32)); - FuncTy_27_args.push_back(PointerTy_7); - FuncTy_27_args.push_back(IntegerType::get(32)); - FuncTy_27_args.push_back(PointerTy_5); - FunctionType* FuncTy_27 = FunctionType::get( - /*Result=*/IntegerType::get(32), - /*Params=*/FuncTy_27_args, - /*isVarArg=*/false); - - PointerType* PointerTy_28 = PointerType::get(IntegerType::get(32), 0); - - - // Function Declarations - - Function* func_from_array = new Function( - /*Type=*/FuncTy_11, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"from_array", mod); - func_from_array->setCallingConv(CallingConv::C); - const ParamAttrsList *func_from_array_PAL = 0; - { - ParamAttrsVector Attrs; - ParamAttrsWithIndex PAWI; - PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind; - Attrs.push_back(PAWI); - func_from_array_PAL = ParamAttrsList::get(Attrs); - - } - func_from_array->setParamAttrs(func_from_array_PAL); - - Function* func_from_consts = new Function( - /*Type=*/FuncTy_16, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"from_consts", mod); - func_from_consts->setCallingConv(CallingConv::C); - const ParamAttrsList *func_from_consts_PAL = 0; - { - ParamAttrsVector Attrs; - ParamAttrsWithIndex PAWI; - PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind; - Attrs.push_back(PAWI); - func_from_consts_PAL = ParamAttrsList::get(Attrs); - - } - func_from_consts->setParamAttrs(func_from_consts_PAL); - - Function* func_to_array = new Function( - /*Type=*/FuncTy_17, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"to_array", mod); - func_to_array->setCallingConv(CallingConv::C); - const ParamAttrsList *func_to_array_PAL = 0; - { - ParamAttrsVector Attrs; - ParamAttrsWithIndex PAWI; - PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind; - Attrs.push_back(PAWI); - func_to_array_PAL = ParamAttrsList::get(Attrs); - - } - func_to_array->setParamAttrs(func_to_array_PAL); - - Function* func_run_vertex_shader = new Function( - /*Type=*/FuncTy_18, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"run_vertex_shader", mod); - func_run_vertex_shader->setCallingConv(CallingConv::C); - const ParamAttrsList *func_run_vertex_shader_PAL = 0; - func_run_vertex_shader->setParamAttrs(func_run_vertex_shader_PAL); - - Function* func_execute_shader = new Function( - /*Type=*/FuncTy_26, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"execute_shader", mod); // (external, no body) - func_execute_shader->setCallingConv(CallingConv::C); - const ParamAttrsList *func_execute_shader_PAL = 0; - func_execute_shader->setParamAttrs(func_execute_shader_PAL); - - Function* func_run_fragment_shader = new Function( - /*Type=*/FuncTy_27, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"run_fragment_shader", mod); - func_run_fragment_shader->setCallingConv(CallingConv::C); - const ParamAttrsList *func_run_fragment_shader_PAL = 0; - func_run_fragment_shader->setParamAttrs(func_run_fragment_shader_PAL); - - // Global Variable Declarations - - - // Constant Definitions - Constant* const_int32_29 = Constant::getNullValue(IntegerType::get(32)); - ConstantInt* const_int32_30 = ConstantInt::get(APInt(32, "-1", 10)); - ConstantInt* const_int32_31 = ConstantInt::get(APInt(32, "1", 10)); - UndefValue* const_packed_32 = UndefValue::get(VectorTy_1); - ConstantInt* const_int32_33 = ConstantInt::get(APInt(32, "2", 10)); - ConstantInt* const_int32_34 = ConstantInt::get(APInt(32, "3", 10)); - ConstantInt* const_int32_35 = ConstantInt::get(APInt(32, "4", 10)); - - // Global Variable Definitions - - // Function Definitions - - // Function: from_array (func_from_array) - { - Function::arg_iterator args = func_from_array->arg_begin(); - Value* ptr_res = args++; - ptr_res->setName("res"); - Value* ptr_ainputs = args++; - ptr_ainputs->setName("ainputs"); - Value* int32_count = args++; - int32_count->setName("count"); - Value* int32_num_attribs = args++; - int32_num_attribs->setName("num_attribs"); - - BasicBlock* label_entry = new BasicBlock("entry",func_from_array,0); - BasicBlock* label_forcond2_preheader_split = new BasicBlock("forcond2.preheader.split",func_from_array,0); - BasicBlock* label_forcond2 = new BasicBlock("forcond2",func_from_array,0); - BasicBlock* label_forbody6 = new BasicBlock("forbody6",func_from_array,0); - BasicBlock* label_forinc57 = new BasicBlock("forinc57",func_from_array,0); - BasicBlock* label_afterfor60 = new BasicBlock("afterfor60",func_from_array,0); - - // Block entry (label_entry) - ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_29, "cmp", label_entry); - ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_29, "cmp5", label_entry); - BinaryOperator* int1_bothcond = BinaryOperator::create(Instruction::And, int1_cmp, int1_cmp5, "bothcond", label_entry); - new BranchInst(label_forcond2_preheader_split, label_afterfor60, int1_bothcond, label_entry); - - // Block forcond2.preheader.split (label_forcond2_preheader_split) - BinaryOperator* int32_tmp21 = BinaryOperator::create(Instruction::Add, int32_count, const_int32_30, "tmp21", label_forcond2_preheader_split); - ICmpInst* int1_tmp22 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp21, const_int32_29, "tmp22", label_forcond2_preheader_split); - SelectInst* int32_tmp25 = new SelectInst(int1_tmp22, const_int32_31, int32_count, "tmp25", label_forcond2_preheader_split); - new BranchInst(label_forcond2, label_forcond2_preheader_split); - - // Block forcond2 (label_forcond2) - Argument* fwdref_38 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forcond2); - int32_i_0_reg2mem_0->reserveOperandSpace(2); - int32_i_0_reg2mem_0->addIncoming(const_int32_29, label_forcond2_preheader_split); - int32_i_0_reg2mem_0->addIncoming(fwdref_38, label_forinc57); - - Argument* fwdref_39 = new Argument(VectorTy_1); - PHINode* packed_vec_1_reg2mem_0 = new PHINode(VectorTy_1, "vec.1.reg2mem.0", label_forcond2); - packed_vec_1_reg2mem_0->reserveOperandSpace(2); - packed_vec_1_reg2mem_0->addIncoming(const_packed_32, label_forcond2_preheader_split); - packed_vec_1_reg2mem_0->addIncoming(fwdref_39, label_forinc57); - - BinaryOperator* int32_tmp = BinaryOperator::create(Instruction::Add, int32_num_attribs, const_int32_30, "tmp", label_forcond2); - ICmpInst* int1_tmp18 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp, const_int32_29, "tmp18", label_forcond2); - SelectInst* int32_tmp19 = new SelectInst(int1_tmp18, const_int32_31, int32_num_attribs, "tmp19", label_forcond2); - new BranchInst(label_forbody6, label_forcond2); - - // Block forbody6 (label_forbody6) - Argument* fwdref_41 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0", label_forbody6); - int32_j_0_reg2mem_0->reserveOperandSpace(2); - int32_j_0_reg2mem_0->addIncoming(const_int32_29, label_forcond2); - int32_j_0_reg2mem_0->addIncoming(fwdref_41, label_forbody6); - - PHINode* packed_vec_0_reg2mem_0 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody6); - packed_vec_0_reg2mem_0->reserveOperandSpace(2); - packed_vec_0_reg2mem_0->addIncoming(packed_vec_1_reg2mem_0, label_forcond2); - packed_vec_0_reg2mem_0->addIncoming(fwdref_39, label_forbody6); - - std::vector<Value*> ptr_arraydecay11_indices; - ptr_arraydecay11_indices.push_back(int32_i_0_reg2mem_0); - ptr_arraydecay11_indices.push_back(int32_j_0_reg2mem_0); - ptr_arraydecay11_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11 = new GetElementPtrInst(ptr_ainputs, ptr_arraydecay11_indices.begin(), ptr_arraydecay11_indices.end(), "arraydecay11", label_forbody6); - LoadInst* float_tmp13 = new LoadInst(ptr_arraydecay11, "tmp13", false, label_forbody6); - InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_29, "tmp15", label_forbody6); - std::vector<Value*> ptr_arrayidx23_indices; - ptr_arrayidx23_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx23_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx23_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx23 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx23_indices.begin(), ptr_arrayidx23_indices.end(), "arrayidx23", label_forbody6); - LoadInst* float_tmp24 = new LoadInst(ptr_arrayidx23, "tmp24", false, label_forbody6); - InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_31, "tmp26", label_forbody6); - std::vector<Value*> ptr_arrayidx34_indices; - ptr_arrayidx34_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx34_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx34_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx34 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx34_indices.begin(), ptr_arrayidx34_indices.end(), "arrayidx34", label_forbody6); - LoadInst* float_tmp35 = new LoadInst(ptr_arrayidx34, "tmp35", false, label_forbody6); - InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_33, "tmp37", label_forbody6); - std::vector<Value*> ptr_arrayidx45_indices; - ptr_arrayidx45_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx45_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx45_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx45 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx45_indices.begin(), ptr_arrayidx45_indices.end(), "arrayidx45", label_forbody6); - LoadInst* float_tmp46 = new LoadInst(ptr_arrayidx45, "tmp46", false, label_forbody6); - InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_34, "tmp48", label_forbody6); - std::vector<Value*> ptr_arrayidx54_indices; - ptr_arrayidx54_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx54_indices.push_back(int32_j_0_reg2mem_0); - Instruction* ptr_arrayidx54 = new GetElementPtrInst(ptr_res, ptr_arrayidx54_indices.begin(), ptr_arrayidx54_indices.end(), "arrayidx54", label_forbody6); - StoreInst* void_42 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6); - BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_31, "indvar.next", label_forbody6); - ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_tmp19, "exitcond", label_forbody6); - new BranchInst(label_forinc57, label_forbody6, int1_exitcond, label_forbody6); - - // Block forinc57 (label_forinc57) - BinaryOperator* int32_indvar_next20 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_31, "indvar.next20", label_forinc57); - ICmpInst* int1_exitcond26 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next20, int32_tmp25, "exitcond26", label_forinc57); - new BranchInst(label_afterfor60, label_forcond2, int1_exitcond26, label_forinc57); - - // Block afterfor60 (label_afterfor60) - new ReturnInst(label_afterfor60); - - // Resolve Forward References - fwdref_39->replaceAllUsesWith(packed_tmp48); delete fwdref_39; - fwdref_41->replaceAllUsesWith(int32_indvar_next); delete fwdref_41; - fwdref_38->replaceAllUsesWith(int32_indvar_next20); delete fwdref_38; - - } - - // Function: from_consts (func_from_consts) - { - Function::arg_iterator args = func_from_consts->arg_begin(); - Value* ptr_res_46 = args++; - ptr_res_46->setName("res"); - Value* ptr_ainputs_47 = args++; - ptr_ainputs_47->setName("ainputs"); - Value* int32_count_48 = args++; - int32_count_48->setName("count"); - - BasicBlock* label_entry_49 = new BasicBlock("entry",func_from_consts,0); - BasicBlock* label_forbody_preheader = new BasicBlock("forbody.preheader",func_from_consts,0); - BasicBlock* label_forbody = new BasicBlock("forbody",func_from_consts,0); - BasicBlock* label_afterfor = new BasicBlock("afterfor",func_from_consts,0); - - // Block entry (label_entry_49) - ICmpInst* int1_cmp_50 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_48, const_int32_29, "cmp", label_entry_49); - new BranchInst(label_forbody_preheader, label_afterfor, int1_cmp_50, label_entry_49); - - // Block forbody.preheader (label_forbody_preheader) - BinaryOperator* int32_tmp_52 = BinaryOperator::create(Instruction::Add, int32_count_48, const_int32_30, "tmp", label_forbody_preheader); - ICmpInst* int1_tmp9 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_52, const_int32_29, "tmp9", label_forbody_preheader); - SelectInst* int32_tmp10 = new SelectInst(int1_tmp9, const_int32_31, int32_count_48, "tmp10", label_forbody_preheader); - new BranchInst(label_forbody, label_forbody_preheader); - - // Block forbody (label_forbody) - Argument* fwdref_55 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_54 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody); - int32_i_0_reg2mem_0_54->reserveOperandSpace(2); - int32_i_0_reg2mem_0_54->addIncoming(const_int32_29, label_forbody_preheader); - int32_i_0_reg2mem_0_54->addIncoming(fwdref_55, label_forbody); - - Argument* fwdref_57 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_56 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody); - packed_vec_0_reg2mem_0_56->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_56->addIncoming(const_packed_32, label_forbody_preheader); - packed_vec_0_reg2mem_0_56->addIncoming(fwdref_57, label_forbody); - - std::vector<Value*> ptr_arraydecay_indices; - ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arraydecay_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_47, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody); - LoadInst* float_tmp5 = new LoadInst(ptr_arraydecay, "tmp5", false, label_forbody); - InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_56, float_tmp5, const_int32_29, "tmp7", label_forbody); - std::vector<Value*> ptr_arrayidx12_indices; - ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx12_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody); - LoadInst* float_tmp13_58 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody); - InsertElementInst* packed_tmp15_59 = new InsertElementInst(packed_tmp7, float_tmp13_58, const_int32_31, "tmp15", label_forbody); - std::vector<Value*> ptr_arrayidx20_indices; - ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx20_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody); - LoadInst* float_tmp21 = new LoadInst(ptr_arrayidx20, "tmp21", false, label_forbody); - InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_59, float_tmp21, const_int32_33, "tmp23", label_forbody); - std::vector<Value*> ptr_arrayidx28_indices; - ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx28_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody); - LoadInst* float_tmp29 = new LoadInst(ptr_arrayidx28, "tmp29", false, label_forbody); - InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_34, "tmp31", label_forbody); - GetElementPtrInst* ptr_arrayidx34_60 = new GetElementPtrInst(ptr_res_46, int32_i_0_reg2mem_0_54, "arrayidx34", label_forbody); - StoreInst* void_61 = new StoreInst(packed_tmp31, ptr_arrayidx34_60, false, label_forbody); - BinaryOperator* int32_indvar_next_62 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_54, const_int32_31, "indvar.next", label_forbody); - ICmpInst* int1_exitcond_63 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_62, int32_tmp10, "exitcond", label_forbody); - new BranchInst(label_afterfor, label_forbody, int1_exitcond_63, label_forbody); - - // Block afterfor (label_afterfor) - new ReturnInst(label_afterfor); - - // Resolve Forward References - fwdref_57->replaceAllUsesWith(packed_tmp31); delete fwdref_57; - fwdref_55->replaceAllUsesWith(int32_indvar_next_62); delete fwdref_55; - - } - - // Function: to_array (func_to_array) - { - Function::arg_iterator args = func_to_array->arg_begin(); - Value* ptr_dests = args++; - ptr_dests->setName("dests"); - Value* ptr_in = args++; - ptr_in->setName("in"); - Value* int32_num_attribs_66 = args++; - int32_num_attribs_66->setName("num_attribs"); - - BasicBlock* label_entry_67 = new BasicBlock("entry",func_to_array,0); - BasicBlock* label_forbody_preheader_68 = new BasicBlock("forbody.preheader",func_to_array,0); - BasicBlock* label_forbody_69 = new BasicBlock("forbody",func_to_array,0); - BasicBlock* label_afterfor_70 = new BasicBlock("afterfor",func_to_array,0); - - // Block entry (label_entry_67) - ICmpInst* int1_cmp_71 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_66, const_int32_29, "cmp", label_entry_67); - new BranchInst(label_forbody_preheader_68, label_afterfor_70, int1_cmp_71, label_entry_67); - - // Block forbody.preheader (label_forbody_preheader_68) - BinaryOperator* int32_tmp_73 = BinaryOperator::create(Instruction::Add, int32_num_attribs_66, const_int32_30, "tmp", label_forbody_preheader_68); - ICmpInst* int1_tmp9_74 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_73, const_int32_29, "tmp9", label_forbody_preheader_68); - SelectInst* int32_tmp10_75 = new SelectInst(int1_tmp9_74, const_int32_31, int32_num_attribs_66, "tmp10", label_forbody_preheader_68); - new BranchInst(label_forbody_69, label_forbody_preheader_68); - - // Block forbody (label_forbody_69) - Argument* fwdref_78 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_77 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_69); - int32_i_0_reg2mem_0_77->reserveOperandSpace(2); - int32_i_0_reg2mem_0_77->addIncoming(const_int32_29, label_forbody_preheader_68); - int32_i_0_reg2mem_0_77->addIncoming(fwdref_78, label_forbody_69); - - std::vector<Value*> ptr_arraydecay_79_indices; - ptr_arraydecay_79_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arraydecay_79_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay_79 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_79_indices.begin(), ptr_arraydecay_79_indices.end(), "arraydecay", label_forbody_69); - GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_77, "arrayidx6", label_forbody_69); - LoadInst* packed_tmp7_80 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_69); - ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_80, const_int32_29, "tmp11", label_forbody_69); - StoreInst* void_81 = new StoreInst(float_tmp11, ptr_arraydecay_79, false, label_forbody_69); - std::vector<Value*> ptr_arrayidx13_indices; - ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arrayidx13_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_69); - ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_80, const_int32_31, "tmp15", label_forbody_69); - StoreInst* void_82 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_69); - std::vector<Value*> ptr_arrayidx17_indices; - ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arrayidx17_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_69); - ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_80, const_int32_33, "tmp19", label_forbody_69); - StoreInst* void_83 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_69); - std::vector<Value*> ptr_arrayidx21_indices; - ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arrayidx21_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_69); - ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_80, const_int32_34, "tmp23", label_forbody_69); - StoreInst* void_84 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_69); - BinaryOperator* int32_indvar_next_85 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_77, const_int32_31, "indvar.next", label_forbody_69); - ICmpInst* int1_exitcond_86 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_85, int32_tmp10_75, "exitcond", label_forbody_69); - new BranchInst(label_afterfor_70, label_forbody_69, int1_exitcond_86, label_forbody_69); - - // Block afterfor (label_afterfor_70) - new ReturnInst(label_afterfor_70); - - // Resolve Forward References - fwdref_78->replaceAllUsesWith(int32_indvar_next_85); delete fwdref_78; - - } - - // Function: run_vertex_shader (func_run_vertex_shader) - { - Function::arg_iterator args = func_run_vertex_shader->arg_begin(); - Value* ptr_inputs = args++; - ptr_inputs->setName("inputs"); - Value* ptr_results = args++; - ptr_results->setName("results"); - Value* ptr_aconsts = args++; - ptr_aconsts->setName("aconsts"); - Value* int32_num_vertices = args++; - int32_num_vertices->setName("num_vertices"); - Value* int32_num_inputs = args++; - int32_num_inputs->setName("num_inputs"); - Value* int32_num_attribs_89 = args++; - int32_num_attribs_89->setName("num_attribs"); - Value* int32_num_consts = args++; - int32_num_consts->setName("num_consts"); - - BasicBlock* label_entry_90 = new BasicBlock("entry",func_run_vertex_shader,0); - BasicBlock* label_forbody_preheader_i = new BasicBlock("forbody.preheader.i",func_run_vertex_shader,0); - BasicBlock* label_forbody_i = new BasicBlock("forbody.i",func_run_vertex_shader,0); - BasicBlock* label_from_consts_exit = new BasicBlock("from_consts.exit",func_run_vertex_shader,0); - - // Block entry (label_entry_90) - AllocaInst* ptr_consts = new AllocaInst(ArrayTy_20, "consts", label_entry_90); - AllocaInst* ptr_temps = new AllocaInst(ArrayTy_22, "temps", label_entry_90); - AllocaInst* ptr_args = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_90); - std::vector<Value*> ptr_tmp_indices; - ptr_tmp_indices.push_back(const_int32_29); - ptr_tmp_indices.push_back(const_int32_29); - Instruction* ptr_tmp = new GetElementPtrInst(ptr_args, ptr_tmp_indices.begin(), ptr_tmp_indices.end(), "tmp", label_entry_90); - CastInst* ptr_conv = new BitCastInst(ptr_results, PointerTy_0, "conv", label_entry_90); - StoreInst* void_91 = new StoreInst(ptr_conv, ptr_tmp, false, label_entry_90); - std::vector<Value*> ptr_tmp2_indices; - ptr_tmp2_indices.push_back(const_int32_29); - ptr_tmp2_indices.push_back(const_int32_31); - Instruction* ptr_tmp2 = new GetElementPtrInst(ptr_args, ptr_tmp2_indices.begin(), ptr_tmp2_indices.end(), "tmp2", label_entry_90); - CastInst* ptr_conv4 = new BitCastInst(ptr_inputs, PointerTy_0, "conv4", label_entry_90); - StoreInst* void_92 = new StoreInst(ptr_conv4, ptr_tmp2, false, label_entry_90); - ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_29, "cmp.i", label_entry_90); - new BranchInst(label_forbody_preheader_i, label_from_consts_exit, int1_cmp_i, label_entry_90); - - // Block forbody.preheader.i (label_forbody_preheader_i) - BinaryOperator* int32_tmp_i = BinaryOperator::create(Instruction::Add, int32_num_consts, const_int32_30, "tmp.i", label_forbody_preheader_i); - ICmpInst* int1_tmp9_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_i, const_int32_29, "tmp9.i", label_forbody_preheader_i); - SelectInst* int32_tmp10_i = new SelectInst(int1_tmp9_i, const_int32_31, int32_num_consts, "tmp10.i", label_forbody_preheader_i); - new BranchInst(label_forbody_i, label_forbody_preheader_i); - - // Block forbody.i (label_forbody_i) - Argument* fwdref_95 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i); - int32_i_0_reg2mem_0_i->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i->addIncoming(const_int32_29, label_forbody_preheader_i); - int32_i_0_reg2mem_0_i->addIncoming(fwdref_95, label_forbody_i); - - Argument* fwdref_96 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i); - packed_vec_0_reg2mem_0_i->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i->addIncoming(const_packed_32, label_forbody_preheader_i); - packed_vec_0_reg2mem_0_i->addIncoming(fwdref_96, label_forbody_i); - - std::vector<Value*> ptr_arraydecay_i_indices; - ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arraydecay_i_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_aconsts, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_i); - LoadInst* float_tmp5_i = new LoadInst(ptr_arraydecay_i, "tmp5.i", false, label_forbody_i); - InsertElementInst* packed_tmp7_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp5_i, const_int32_29, "tmp7.i", label_forbody_i); - std::vector<Value*> ptr_arrayidx12_i_indices; - ptr_arrayidx12_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arrayidx12_i_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx12_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx12_i_indices.begin(), ptr_arrayidx12_i_indices.end(), "arrayidx12.i", label_forbody_i); - LoadInst* float_tmp13_i = new LoadInst(ptr_arrayidx12_i, "tmp13.i", false, label_forbody_i); - InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_tmp7_i, float_tmp13_i, const_int32_31, "tmp15.i", label_forbody_i); - std::vector<Value*> ptr_arrayidx20_i_indices; - ptr_arrayidx20_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arrayidx20_i_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx20_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx20_i_indices.begin(), ptr_arrayidx20_i_indices.end(), "arrayidx20.i", label_forbody_i); - LoadInst* float_tmp21_i = new LoadInst(ptr_arrayidx20_i, "tmp21.i", false, label_forbody_i); - InsertElementInst* packed_tmp23_i = new InsertElementInst(packed_tmp15_i, float_tmp21_i, const_int32_33, "tmp23.i", label_forbody_i); - std::vector<Value*> ptr_arrayidx28_i_indices; - ptr_arrayidx28_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arrayidx28_i_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx28_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx28_i_indices.begin(), ptr_arrayidx28_i_indices.end(), "arrayidx28.i", label_forbody_i); - LoadInst* float_tmp29_i = new LoadInst(ptr_arrayidx28_i, "tmp29.i", false, label_forbody_i); - InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i, float_tmp29_i, const_int32_34, "tmp31.i", label_forbody_i); - std::vector<Value*> ptr_arrayidx34_i_indices; - ptr_arrayidx34_i_indices.push_back(const_int32_29); - ptr_arrayidx34_i_indices.push_back(int32_i_0_reg2mem_0_i); - Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_consts, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody_i); - StoreInst* void_97 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i, false, label_forbody_i); - BinaryOperator* int32_indvar_next_98 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i, const_int32_31, "indvar.next", label_forbody_i); - ICmpInst* int1_exitcond_99 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_98, int32_tmp10_i, "exitcond", label_forbody_i); - new BranchInst(label_from_consts_exit, label_forbody_i, int1_exitcond_99, label_forbody_i); - - // Block from_consts.exit (label_from_consts_exit) - std::vector<Value*> ptr_tmp7_indices; - ptr_tmp7_indices.push_back(const_int32_29); - ptr_tmp7_indices.push_back(const_int32_34); - Instruction* ptr_tmp7 = new GetElementPtrInst(ptr_args, ptr_tmp7_indices.begin(), ptr_tmp7_indices.end(), "tmp7", label_from_consts_exit); - std::vector<Value*> ptr_arraydecay8_indices; - ptr_arraydecay8_indices.push_back(const_int32_29); - ptr_arraydecay8_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay8 = new GetElementPtrInst(ptr_consts, ptr_arraydecay8_indices.begin(), ptr_arraydecay8_indices.end(), "arraydecay8", label_from_consts_exit); - StoreInst* void_101 = new StoreInst(ptr_arraydecay8, ptr_tmp7, false, label_from_consts_exit); - std::vector<Value*> ptr_tmp9_indices; - ptr_tmp9_indices.push_back(const_int32_29); - ptr_tmp9_indices.push_back(const_int32_33); - Instruction* ptr_tmp9 = new GetElementPtrInst(ptr_args, ptr_tmp9_indices.begin(), ptr_tmp9_indices.end(), "tmp9", label_from_consts_exit); - std::vector<Value*> ptr_arraydecay10_indices; - ptr_arraydecay10_indices.push_back(const_int32_29); - ptr_arraydecay10_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay10 = new GetElementPtrInst(ptr_temps, ptr_arraydecay10_indices.begin(), ptr_arraydecay10_indices.end(), "arraydecay10", label_from_consts_exit); - StoreInst* void_102 = new StoreInst(ptr_arraydecay10, ptr_tmp9, false, label_from_consts_exit); - CallInst* void_103 = new CallInst(func_execute_shader, ptr_args, "", label_from_consts_exit); - void_103->setCallingConv(CallingConv::C); - void_103->setTailCall(false);const ParamAttrsList *void_103_PAL = 0; - void_103->setParamAttrs(void_103_PAL); - - new ReturnInst(label_from_consts_exit); - - // Resolve Forward References - fwdref_96->replaceAllUsesWith(packed_tmp31_i); delete fwdref_96; - fwdref_95->replaceAllUsesWith(int32_indvar_next_98); delete fwdref_95; - - } - - // Function: run_fragment_shader (func_run_fragment_shader) - { - Function::arg_iterator args = func_run_fragment_shader->arg_begin(); - Value* float_x = args++; - float_x->setName("x"); - Value* float_y = args++; - float_y->setName("y"); - Value* ptr_results_105 = args++; - ptr_results_105->setName("results"); - Value* ptr_inputs_106 = args++; - ptr_inputs_106->setName("inputs"); - Value* int32_num_inputs_107 = args++; - int32_num_inputs_107->setName("num_inputs"); - Value* ptr_aconsts_108 = args++; - ptr_aconsts_108->setName("aconsts"); - Value* int32_num_consts_109 = args++; - int32_num_consts_109->setName("num_consts"); - Value* ptr_samplers = args++; - ptr_samplers->setName("samplers"); - - BasicBlock* label_entry_110 = new BasicBlock("entry",func_run_fragment_shader,0); - BasicBlock* label_forbody_preheader_i_111 = new BasicBlock("forbody.preheader.i",func_run_fragment_shader,0); - BasicBlock* label_forbody_i_112 = new BasicBlock("forbody.i",func_run_fragment_shader,0); - BasicBlock* label_from_consts_exit_113 = new BasicBlock("from_consts.exit",func_run_fragment_shader,0); - - // Block entry (label_entry_110) - AllocaInst* ptr_consts_114 = new AllocaInst(ArrayTy_20, "consts", label_entry_110); - AllocaInst* ptr_temps_115 = new AllocaInst(ArrayTy_22, "temps", label_entry_110); - AllocaInst* ptr_args_116 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_110); - std::vector<Value*> ptr_tmp_117_indices; - ptr_tmp_117_indices.push_back(const_int32_29); - ptr_tmp_117_indices.push_back(const_int32_35); - Instruction* ptr_tmp_117 = new GetElementPtrInst(ptr_args_116, ptr_tmp_117_indices.begin(), ptr_tmp_117_indices.end(), "tmp", label_entry_110); - StoreInst* void_118 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_entry_110); - ICmpInst* int1_cmp_i_119 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_109, const_int32_29, "cmp.i", label_entry_110); - new BranchInst(label_forbody_preheader_i_111, label_from_consts_exit_113, int1_cmp_i_119, label_entry_110); - - // Block forbody.preheader.i (label_forbody_preheader_i_111) - BinaryOperator* int32_tmp_i_121 = BinaryOperator::create(Instruction::Add, int32_num_consts_109, const_int32_30, "tmp.i", label_forbody_preheader_i_111); - ICmpInst* int1_tmp9_i_122 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_i_121, const_int32_29, "tmp9.i", label_forbody_preheader_i_111); - SelectInst* int32_tmp10_i_123 = new SelectInst(int1_tmp9_i_122, const_int32_31, int32_num_consts_109, "tmp10.i", label_forbody_preheader_i_111); - new BranchInst(label_forbody_i_112, label_forbody_preheader_i_111); - - // Block forbody.i (label_forbody_i_112) - Argument* fwdref_126 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i_125 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i_112); - int32_i_0_reg2mem_0_i_125->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i_125->addIncoming(const_int32_29, label_forbody_preheader_i_111); - int32_i_0_reg2mem_0_i_125->addIncoming(fwdref_126, label_forbody_i_112); - - Argument* fwdref_128 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_127 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i_112); - packed_vec_0_reg2mem_0_i_127->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_127->addIncoming(const_packed_32, label_forbody_preheader_i_111); - packed_vec_0_reg2mem_0_i_127->addIncoming(fwdref_128, label_forbody_i_112); - - std::vector<Value*> ptr_arraydecay_i_129_indices; - ptr_arraydecay_i_129_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arraydecay_i_129_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay_i_129 = new GetElementPtrInst(ptr_aconsts_108, ptr_arraydecay_i_129_indices.begin(), ptr_arraydecay_i_129_indices.end(), "arraydecay.i", label_forbody_i_112); - LoadInst* float_tmp5_i_130 = new LoadInst(ptr_arraydecay_i_129, "tmp5.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp7_i_131 = new InsertElementInst(packed_vec_0_reg2mem_0_i_127, float_tmp5_i_130, const_int32_29, "tmp7.i", label_forbody_i_112); - std::vector<Value*> ptr_arrayidx12_i_132_indices; - ptr_arrayidx12_i_132_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arrayidx12_i_132_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx12_i_132 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx12_i_132_indices.begin(), ptr_arrayidx12_i_132_indices.end(), "arrayidx12.i", label_forbody_i_112); - LoadInst* float_tmp13_i_133 = new LoadInst(ptr_arrayidx12_i_132, "tmp13.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp15_i_134 = new InsertElementInst(packed_tmp7_i_131, float_tmp13_i_133, const_int32_31, "tmp15.i", label_forbody_i_112); - std::vector<Value*> ptr_arrayidx20_i_135_indices; - ptr_arrayidx20_i_135_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arrayidx20_i_135_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx20_i_135 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx20_i_135_indices.begin(), ptr_arrayidx20_i_135_indices.end(), "arrayidx20.i", label_forbody_i_112); - LoadInst* float_tmp21_i_136 = new LoadInst(ptr_arrayidx20_i_135, "tmp21.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp23_i_137 = new InsertElementInst(packed_tmp15_i_134, float_tmp21_i_136, const_int32_33, "tmp23.i", label_forbody_i_112); - std::vector<Value*> ptr_arrayidx28_i_138_indices; - ptr_arrayidx28_i_138_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arrayidx28_i_138_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx28_i_138 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx28_i_138_indices.begin(), ptr_arrayidx28_i_138_indices.end(), "arrayidx28.i", label_forbody_i_112); - LoadInst* float_tmp29_i_139 = new LoadInst(ptr_arrayidx28_i_138, "tmp29.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp31_i_140 = new InsertElementInst(packed_tmp23_i_137, float_tmp29_i_139, const_int32_34, "tmp31.i", label_forbody_i_112); - std::vector<Value*> ptr_arrayidx34_i_141_indices; - ptr_arrayidx34_i_141_indices.push_back(const_int32_29); - ptr_arrayidx34_i_141_indices.push_back(int32_i_0_reg2mem_0_i_125); - Instruction* ptr_arrayidx34_i_141 = new GetElementPtrInst(ptr_consts_114, ptr_arrayidx34_i_141_indices.begin(), ptr_arrayidx34_i_141_indices.end(), "arrayidx34.i", label_forbody_i_112); - StoreInst* void_142 = new StoreInst(packed_tmp31_i_140, ptr_arrayidx34_i_141, false, label_forbody_i_112); - BinaryOperator* int32_indvar_next7 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_125, const_int32_31, "indvar.next7", label_forbody_i_112); - ICmpInst* int1_exitcond8 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next7, int32_tmp10_i_123, "exitcond8", label_forbody_i_112); - new BranchInst(label_from_consts_exit_113, label_forbody_i_112, int1_exitcond8, label_forbody_i_112); - - // Block from_consts.exit (label_from_consts_exit_113) - std::vector<Value*> ptr_tmp3_indices; - ptr_tmp3_indices.push_back(const_int32_29); - ptr_tmp3_indices.push_back(const_int32_34); - Instruction* ptr_tmp3 = new GetElementPtrInst(ptr_args_116, ptr_tmp3_indices.begin(), ptr_tmp3_indices.end(), "tmp3", label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay4_indices; - ptr_arraydecay4_indices.push_back(const_int32_29); - ptr_arraydecay4_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay4 = new GetElementPtrInst(ptr_consts_114, ptr_arraydecay4_indices.begin(), ptr_arraydecay4_indices.end(), "arraydecay4", label_from_consts_exit_113); - StoreInst* void_144 = new StoreInst(ptr_arraydecay4, ptr_tmp3, false, label_from_consts_exit_113); - std::vector<Value*> ptr_tmp5_indices; - ptr_tmp5_indices.push_back(const_int32_29); - ptr_tmp5_indices.push_back(const_int32_33); - Instruction* ptr_tmp5 = new GetElementPtrInst(ptr_args_116, ptr_tmp5_indices.begin(), ptr_tmp5_indices.end(), "tmp5", label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay6_indices; - ptr_arraydecay6_indices.push_back(const_int32_29); - ptr_arraydecay6_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay6 = new GetElementPtrInst(ptr_temps_115, ptr_arraydecay6_indices.begin(), ptr_arraydecay6_indices.end(), "arraydecay6", label_from_consts_exit_113); - StoreInst* void_145 = new StoreInst(ptr_arraydecay6, ptr_tmp5, false, label_from_consts_exit_113); - std::vector<Value*> ptr_tmp8_indices; - ptr_tmp8_indices.push_back(const_int32_29); - ptr_tmp8_indices.push_back(const_int32_31); - Instruction* ptr_tmp8 = new GetElementPtrInst(ptr_args_116, ptr_tmp8_indices.begin(), ptr_tmp8_indices.end(), "tmp8", label_from_consts_exit_113); - std::vector<Value*> ptr_tmp12_indices; - ptr_tmp12_indices.push_back(const_int32_29); - ptr_tmp12_indices.push_back(const_int32_29); - Instruction* ptr_tmp12 = new GetElementPtrInst(ptr_args_116, ptr_tmp12_indices.begin(), ptr_tmp12_indices.end(), "tmp12", label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay11_146_indices; - ptr_arraydecay11_146_indices.push_back(const_int32_29); - ptr_arraydecay11_146_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_146 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_146_indices.begin(), ptr_arraydecay11_146_indices.end(), "arraydecay11", label_from_consts_exit_113); - StoreInst* void_147 = new StoreInst(ptr_arraydecay11_146, ptr_tmp8, false, label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay16_indices; - ptr_arraydecay16_indices.push_back(const_int32_29); - ptr_arraydecay16_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_indices.begin(), ptr_arraydecay16_indices.end(), "arraydecay16", label_from_consts_exit_113); - StoreInst* void_148 = new StoreInst(ptr_arraydecay16, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_149 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_150 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_150->setCallingConv(CallingConv::C); - void_150->setTailCall(false);const ParamAttrsList *void_150_PAL = 0; - void_150->setParamAttrs(void_150_PAL); - - LoadInst* int32_tmp23 = new LoadInst(ptr_tmp_117, "tmp23", false, label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay11_1_indices; - ptr_arraydecay11_1_indices.push_back(const_int32_31); - ptr_arraydecay11_1_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_1 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_1_indices.begin(), ptr_arraydecay11_1_indices.end(), "arraydecay11.1", label_from_consts_exit_113); - StoreInst* void_151 = new StoreInst(ptr_arraydecay11_1, ptr_tmp8, false, label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay16_1_indices; - ptr_arraydecay16_1_indices.push_back(const_int32_31); - ptr_arraydecay16_1_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16_1 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_1_indices.begin(), ptr_arraydecay16_1_indices.end(), "arraydecay16.1", label_from_consts_exit_113); - StoreInst* void_152 = new StoreInst(ptr_arraydecay16_1, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_153 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_154 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_154->setCallingConv(CallingConv::C); - void_154->setTailCall(false);const ParamAttrsList *void_154_PAL = 0; - void_154->setParamAttrs(void_154_PAL); - - LoadInst* int32_tmp23_1 = new LoadInst(ptr_tmp_117, "tmp23.1", false, label_from_consts_exit_113); - BinaryOperator* int32_shl_1 = BinaryOperator::create(Instruction::Shl, int32_tmp23_1, const_int32_31, "shl.1", label_from_consts_exit_113); - BinaryOperator* int32_or_1 = BinaryOperator::create(Instruction::Or, int32_shl_1, int32_tmp23, "or.1", label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay11_2_indices; - ptr_arraydecay11_2_indices.push_back(const_int32_33); - ptr_arraydecay11_2_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_2 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_2_indices.begin(), ptr_arraydecay11_2_indices.end(), "arraydecay11.2", label_from_consts_exit_113); - StoreInst* void_155 = new StoreInst(ptr_arraydecay11_2, ptr_tmp8, false, label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay16_2_indices; - ptr_arraydecay16_2_indices.push_back(const_int32_33); - ptr_arraydecay16_2_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16_2 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_2_indices.begin(), ptr_arraydecay16_2_indices.end(), "arraydecay16.2", label_from_consts_exit_113); - StoreInst* void_156 = new StoreInst(ptr_arraydecay16_2, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_157 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_158 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_158->setCallingConv(CallingConv::C); - void_158->setTailCall(false);const ParamAttrsList *void_158_PAL = 0; - void_158->setParamAttrs(void_158_PAL); - - LoadInst* int32_tmp23_2 = new LoadInst(ptr_tmp_117, "tmp23.2", false, label_from_consts_exit_113); - BinaryOperator* int32_shl_2 = BinaryOperator::create(Instruction::Shl, int32_tmp23_2, const_int32_33, "shl.2", label_from_consts_exit_113); - BinaryOperator* int32_or_2 = BinaryOperator::create(Instruction::Or, int32_shl_2, int32_or_1, "or.2", label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay11_3_indices; - ptr_arraydecay11_3_indices.push_back(const_int32_34); - ptr_arraydecay11_3_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_3 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_3_indices.begin(), ptr_arraydecay11_3_indices.end(), "arraydecay11.3", label_from_consts_exit_113); - StoreInst* void_159 = new StoreInst(ptr_arraydecay11_3, ptr_tmp8, false, label_from_consts_exit_113); - std::vector<Value*> ptr_arraydecay16_3_indices; - ptr_arraydecay16_3_indices.push_back(const_int32_34); - ptr_arraydecay16_3_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16_3 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_3_indices.begin(), ptr_arraydecay16_3_indices.end(), "arraydecay16.3", label_from_consts_exit_113); - StoreInst* void_160 = new StoreInst(ptr_arraydecay16_3, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_161 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_162 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_162->setCallingConv(CallingConv::C); - void_162->setTailCall(false);const ParamAttrsList *void_162_PAL = 0; - void_162->setParamAttrs(void_162_PAL); - - LoadInst* int32_tmp23_3 = new LoadInst(ptr_tmp_117, "tmp23.3", false, label_from_consts_exit_113); - BinaryOperator* int32_shl_3 = BinaryOperator::create(Instruction::Shl, int32_tmp23_3, const_int32_34, "shl.3", label_from_consts_exit_113); - BinaryOperator* int32_or_3 = BinaryOperator::create(Instruction::Or, int32_shl_3, int32_or_2, "or.3", label_from_consts_exit_113); - BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_or_3, const_int32_30, "neg", label_from_consts_exit_113); - new ReturnInst(int32_neg, label_from_consts_exit_113); - - // Resolve Forward References - fwdref_128->replaceAllUsesWith(packed_tmp31_i_140); delete fwdref_128; - fwdref_126->replaceAllUsesWith(int32_indvar_next7); delete fwdref_126; - - } - - return mod; -} diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c deleted file mode 100644 index fa50b60e66..0000000000 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ /dev/null @@ -1,163 +0,0 @@ -/* clang --emit-llvm llvm_entry.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Zack Rusin zack@tungstengraphics.com - */ - -/* clang --emit-llvm llvm_builtins.c |llvm-as |opt -std-compile-opts |llvm-dis */ -typedef __attribute__(( ocu_vector_type(4) )) float float4; - -void from_array(float4 (*res)[16], float (*ainputs)[16][4], - int count, int num_attribs) -{ - for (int i = 0; i < count; ++i) { - for (int j = 0; j < num_attribs; ++j) { - float4 vec; - vec.x = ainputs[i][j][0]; - vec.y = ainputs[i][j][1]; - vec.z = ainputs[i][j][2]; - vec.w = ainputs[i][j][3]; - res[i][j] = vec; - } - } -} - -void from_consts(float4 *res, float (*ainputs)[4], - int count) -{ - for (int i = 0; i < count; ++i) { - float4 vec; - vec.x = ainputs[i][0]; - vec.y = ainputs[i][1]; - vec.z = ainputs[i][2]; - vec.w = ainputs[i][3]; - res[i] = vec; - } -} - -void to_array(float (*dests)[4], float4 *in, int num_attribs) -{ - for (int i = 0; i < num_attribs; ++i) { - float *rd = dests[i]; - float4 ri = in[i]; - rd[0] = ri.x; - rd[1] = ri.y; - rd[2] = ri.z; - rd[3] = ri.w; - } -} - - -struct ShaderInput -{ - float4 *dests; - float4 *inputs; - float4 *temps; - float4 *consts; - int kilmask; -}; - -extern void execute_shader(struct ShaderInput *input); - -void run_vertex_shader(void *inputs, - void *results, - float (*aconsts)[4], - int num_vertices, - int num_inputs, - int num_attribs, - int num_consts) -{ - float4 consts[32]; - float4 temps[128];//MAX_PROGRAM_TEMPS - - struct ShaderInput args; - args.dests = results; - args.inputs = inputs; - - /*printf("XXX LLVM run_vertex_shader vertices = %d, inputs = %d, attribs = %d, consts = %d\n", - num_vertices, num_inputs, num_attribs, num_consts);*/ - from_consts(consts, aconsts, num_consts); - args.consts = consts; - args.temps = temps; - - execute_shader(&args); -} - - -struct pipe_sampler_state; -struct softpipe_tile_cache; - -#define NUM_CHANNELS 4 /* R,G,B,A */ -#define QUAD_SIZE 4 /* 4 pixel/quad */ - -struct tgsi_sampler -{ - const struct pipe_sampler_state *state; - /** Get samples for four fragments in a quad */ - void (*get_samples)(struct tgsi_sampler *sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]); - void *pipe; /*XXX temporary*/ - struct softpipe_tile_cache *cache; -}; - - -int run_fragment_shader(float x, float y, - float4 (*results)[16], - float4 (*inputs)[16], - int num_inputs, - float (*aconsts)[4], - int num_consts, - struct tgsi_sampler *samplers) -{ - float4 consts[32]; - float4 temps[128];//MAX_PROGRAM_TEMPS - struct ShaderInput args; - int mask = 0; - args.kilmask = 0; - - from_consts(consts, aconsts, num_consts); - args.consts = consts; - args.temps = temps; - //printf("AAAAAAAAAAAAAAAAAAAAAAA FRAGMENT SHADER %f %f\n", x, y); - for (int i = 0; i < 4; ++i) { - args.inputs = inputs[i]; - args.dests = results[i]; - mask = args.kilmask; - args.kilmask = 0; - execute_shader(&args); - args.kilmask = mask | (args.kilmask << i); - } - return ~args.kilmask; -} - diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 3497eebcd9..20fce9c9cc 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -44,7 +44,6 @@ #include <iostream> using namespace llvm; -#include "llvm_base_shader.cpp" static inline FunctionType *vertexShaderFunctionType() { @@ -1074,7 +1073,7 @@ translate_instructionir(llvm::Module *module, llvm::Module * tgsi_to_llvm(struct gallivm_ir *ir, const struct tgsi_token *tokens) { - llvm::Module *mod = createBaseShader(); + llvm::Module *mod = new Module("shader"); struct tgsi_parse_context parse; struct tgsi_full_instruction fi; struct tgsi_full_declaration fd; |