diff options
Diffstat (limited to 'src/mesa/pipe/llvm')
-rw-r--r-- | src/mesa/pipe/llvm/instructions.cpp | 21 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/llvmtgsi.cpp | 40 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/storage.cpp | 14 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/storage.h | 1 |
4 files changed, 8 insertions, 68 deletions
diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/mesa/pipe/llvm/instructions.cpp index 5a40888696f..037bec653fd 100644 --- a/src/mesa/pipe/llvm/instructions.cpp +++ b/src/mesa/pipe/llvm/instructions.cpp @@ -167,26 +167,6 @@ llvm::Value *Instructions::callFAbs(llvm::Value *val) llvm::Value * Instructions::lit(llvm::Value *in) { -#if 0 - printVector(in); - return in; - - ExtractElementInst *x = new ExtractElementInst(in, unsigned(0), - name("x"), - m_block); - - ExtractElementInst *y = new ExtractElementInst(in, unsigned(1), - name("y"), - m_block); - - ExtractElementInst *w = new ExtractElementInst(in, unsigned(3), - name("w"), - m_block); - return vectorFromVals(ConstantFP::get(Type::FloatTy, APFloat(1.f)), - ConstantFP::get(Type::FloatTy, APFloat(0.f)), - ConstantFP::get(Type::FloatTy, APFloat(0.f)), - ConstantFP::get(Type::FloatTy, APFloat(1.f))); -#else if (!m_llvmLit) { m_llvmLit = makeLitFunction(m_mod); } @@ -194,7 +174,6 @@ llvm::Value * Instructions::lit(llvm::Value *in) call->setCallingConv(CallingConv::C); call->setTailCall(false); return call; -#endif } llvm::Value * Instructions::sub(llvm::Value *in1, llvm::Value *in2) diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp index 049bf0fa6e7..56b488fb1ae 100644 --- a/src/mesa/pipe/llvm/llvmtgsi.cpp +++ b/src/mesa/pipe/llvm/llvmtgsi.cpp @@ -141,7 +141,6 @@ translate_instruction(llvm::Module *module, val = storage->tempElement(src->SrcRegister.Index); } else { fprintf(stderr, "ERROR: not support llvm source\n"); - printf("translate instr END\n"); return; } @@ -160,9 +159,6 @@ translate_instruction(llvm::Module *module, src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y || src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z || src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W) { - fprintf(stderr, "SWIZZLE is %d %d %d %d\n", - src->SrcRegister.SwizzleX, src->SrcRegister.SwizzleY, - src->SrcRegister.SwizzleZ, src->SrcRegister.SwizzleW); int swizzle = src->SrcRegister.SwizzleX * 1000; swizzle += src->SrcRegister.SwizzleY * 100; swizzle += src->SrcRegister.SwizzleZ * 10; @@ -517,7 +513,6 @@ translate_instruction(llvm::Module *module, struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { - printf("--- storing to %d %p\n", dst->DstRegister.Index, out); storage->store(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else if (dst->DstRegister.File == TGSI_FILE_TEMPORARY) { storage->setTempElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); @@ -552,16 +547,6 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) tgsi_parse_init(&parse, tokens); - Function* func_printf = mod->getFunction("printf"); - //parse.FullHeader.Processor.Processor - - //parse.FullVersion.Version.MajorVersion - //parse.FullVersion.Version.MinorVersion - - //parse.FullHeader.Header.HeaderSize - //parse.FullHeader.Header.BodySize - //parse.FullHeader.Processor.Processor - fi = tgsi_default_full_instruction(); fd = tgsi_default_full_declaration(); Storage storage(label_entry, ptr_OUT, ptr_IN, ptr_CONST); @@ -569,8 +554,6 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) while(!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); - fprintf(stderr, "Translating %d\n", parse.FullToken.Token.Type); - switch (parse.FullToken.Token.Type) { case TGSI_TOKEN_TYPE_DECLARATION: translate_declaration(mod, @@ -596,8 +579,6 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) new ReturnInst(label_entry); - //TXT("\ntgsi-dump end -------------------\n"); - tgsi_parse_free(&parse); prog->num_consts = storage.numConsts(); @@ -611,25 +592,21 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) struct ga_llvm_prog * ga_llvm_from_tgsi(struct pipe_context *pipe, const struct tgsi_token *tokens) { - std::cout << "Creating llvm " <<std::endl; + std::cout << "Creating llvm from: " <<std::endl; struct ga_llvm_prog *ga_llvm = (struct ga_llvm_prog *)malloc(sizeof(struct ga_llvm_prog)); - fprintf(stderr, "DUMPX \n"); + fprintf(stderr, "----- TGSI Start ---- \n"); tgsi_dump(tokens, 0); - fprintf(stderr, "DUMPEND \n"); + fprintf(stderr, "----- TGSI End ---- \n"); llvm::Module *mod = tgsi_to_llvm(ga_llvm, tokens); /* Run optimization passes over it */ PassManager passes; - // Add an appropriate TargetData instance for this module... passes.add(new TargetData(mod)); AddStandardCompilePasses(passes); - std::cout<<"Running optimization passes..."<<std::endl; - bool b = passes.run(*mod); - std::cout<<"\tModified mod = "<<b<<std::endl; + passes.run(*mod); - llvm::ExistingModuleProvider *mp = - new llvm::ExistingModuleProvider(mod); + llvm::ExistingModuleProvider *mp = new llvm::ExistingModuleProvider(mod); llvm::ExecutionEngine *ee = 0; if (!pipe->llvm_execution_engine) { ee = llvm::ExecutionEngine::create(mp, false); @@ -681,12 +658,5 @@ int ga_llvm_prog_exec(struct ga_llvm_prog *prog, std::cout << "---- END LLVM Execution "<<std::endl; - for (int i = 0; i < num_vertices; ++i) { - for (int j = 0; j < num_attribs; ++j) { - printf("OUT(%d, %d) [%f, %f, %f, %f]\n", i, j, - dests[i][j][0], dests[i][j][1], - dests[i][j][2], dests[i][j][3]); - } - } return 0; } diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp index dc7c1f3928c..ba78de8260e 100644 --- a/src/mesa/pipe/llvm/storage.cpp +++ b/src/mesa/pipe/llvm/storage.cpp @@ -26,7 +26,6 @@ Storage::Storage(llvm::BasicBlock *block, llvm::Value *out, m_undefFloatVec = UndefValue::get(m_floatVecType); m_undefIntVec = UndefValue::get(m_intVecType); - m_shuffleId = 0; m_numConsts = 0; } @@ -88,15 +87,11 @@ llvm::Value *Storage::constElement(int idx) if (m_consts.find(idx) != m_consts.end()) { return m_consts[idx]; } - char ptrName[13]; - char name[9]; - snprintf(ptrName, 13, "const_ptr%d", idx); - snprintf(name, 9, "const%d", idx); GetElementPtrInst *getElem = new GetElementPtrInst(m_CONST, constantInt(idx), - ptrName, + name("const_ptr"), m_block); - LoadInst *load = new LoadInst(getElem, name, + LoadInst *load = new LoadInst(getElem, name("const"), false, m_block); m_consts[idx] = load; return load; @@ -105,12 +100,9 @@ llvm::Value *Storage::constElement(int idx) llvm::Value *Storage::shuffleVector(llvm::Value *vec, int shuffle) { Constant *mask = shuffleMask(shuffle); - ++m_shuffleId; - char name[11]; - snprintf(name, 11, "shuffle%d", m_shuffleId); ShuffleVectorInst *res = new ShuffleVectorInst(vec, m_undefFloatVec, mask, - name, m_block); + name("shuffle"), m_block); return res; } diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h index f39d308fdd2..66a33633325 100644 --- a/src/mesa/pipe/llvm/storage.h +++ b/src/mesa/pipe/llvm/storage.h @@ -57,7 +57,6 @@ private: llvm::Value *m_undefFloatVec; llvm::Value *m_undefIntVec; - int m_shuffleId; char m_name[32]; int m_idx; |